How would I go about implementing an OSX (desktop) Core Location provider? - macos

I want to use Mac OSX for a location application, but want to provide fake location data (via a GPS log file). How would I go about implementing this? I've looked at http://developer.apple.com/library/mac/#documentation/CoreLocation/Reference/CoreLocation_Framework/index.html but it only talks about USING the framework, not about how it gets its location information. I've implemented location providers for the Android platform, but seen nothing so far about core location.
There is clearly an interface for it: if it is copied from iOS I know there is a super-secret Bluetooth GPS protocol to provide location information from GPS devices (there is at least one device that does so) and I expect a similar hook is somewhere in OSX.
Thanks.

Related

How to develop driver to read disk by System Extension and DriverKit for macOS10.15+

I had developed a kernel extension(kext) by IOKit, but it will be deprecated in the future. So I want develope another driver use dext to replace kext using the DriverKit. But I don't find the executable solutions, like that I cannot find the some class to repalce IOMedia. When I intend to include IOKit in my code,I found the TARGET_OS_DRIVERKIT is 1.
Can someone help me? Thanks a lot!
IOMedia is a subclass of IOStorage and part of the IOStorageFamily. As of the macOS 11.2 SDK (Xcode 12.4) this has not yet been ported to DriverKit.
The SCSIControllerDriverKit API has been in beta since WWDC 2020. It didn't ship with the release versions of macOS 11.0.x-11.2. It's included in the (as of this writing) current betas of 11.3. Perhaps it will see general release with macOS 11.3. This is not a direct port of the storage stack; instead, it's essentially a port of the IOParallelSCSIController KPI. This lets you implement a driver for, well, a SCSI controller. Such a driver can tell the OS about one or more SCSI devices, including block devices, and will start receiving SCSI commands from the system, which it is expected to forward to the underlying controller device. It does not allow you to implement "filter" storage drivers, or to issue SCSI commands to other devices in the system.

How to setup dji L2 api demo?

I'm intended to create an android app in which you can control the drone (in my case phantom 2 vision) I want to control it using a virtual joystick, I already have the Level 2 API. To do that I wanted to see a "working app" with my own eyes, to understand how I should use the API. I tried to run the dji demo application (I followed the steps they pointed on the documentation, like put the api key in the manifest), the application seems to work ok, but I only can control the gimbal, the virtual joystick does not work for some reason. Is there any limitation in terms of android OS version, devices, phantom firmware version etc?. I made some questions on dji's forum but no one gave me a concrete answer, I hope some one here can give me a hint :)
I'm using a Samsung galaxy note 10.1. I'm working on the DJI-SDK-Android-V2.4.0 project.
I could get "D/GsProtocolJoystickDemoActivity: GroundStationResult GS_Result_Failed"
while I was debugging.
Since you could invoke the API from gimbal and camera correctly, I am assuming that you have already activated your app. Here is my point, the virtual joystick could be used only in the ground station mode. My suggestions are as following:
Turn the remote controller mode to the F mode
Invoke DJIDrone.getDJIGroundStation().openGroundStation().
Invoke the joystick methods.
Please Note: The app key should have the LEVEL2 access so that you could invoke the Ground Station relative methods.

Gamepad and joystick support on Mac OS X in user space

I have been searching through how to do gamepad and joystick support on Mac for some days and all resources that I found seems to suggest a pre-installed driver along with using Apple's HID API, which works.
The drawback about this approach is that each joystick and gamepad will require another kernel extension to be loaded, so it can be recognized by HID manager, or at least a code less Info.plist saying it conforms to the earlier installed driver. For instance, when I have an 360 Xbox driver KEXT in house, the Xbox controller from Microsoft will work, but not the Logitech one (I tried F710).
As Apple suggests the application that uses a gamepad or joystick should be able to do themselves at user space without introducing any KEXT stuff. Is there a way to do it?
The thing I had in mind was something like using IORegistry or IOUSB API to get the device when they get plugged in (USB Prober shows it at least). Then somehow get the description of the device, then use that description to register the device as a HID one. Then the whole HID manager can be used.
Am I on the right track? Or is there any other way to do this?
Since IOKit API actually provided keywords like kHIDUsage_GD_Joystick, and there's an ForceFeedback.h library, I suppose Apple designed their HID API with joystick and force feedback in mind. That's the slim hope I had that this might work.
Some reference documentation and open source project:
Colin Munro's 360 driver
HID API Documents
DDHID Project
After revisiting this, I found out the solution to be operating directly on the file descriptors of the device. libusb is an excellent library which greatly simplify your life on this and they have Mac supported.
xboxdrv link is a great example on how to operate on file socket using libusb.
In pseudo code, it should look like this:
enumerate device
detect kernel driver and detach it if possible
open device
file off a initial transfer
wait on the callback function to handle msg and error properly
start run loop or select on fd to call libusb_event_handle
Check libusb for more info link.

Create fake flash drive programmatically

I want to create a fake flash drive programmatically under Mac OSX and Windows.
It should behave like a normal drive, that means it should appear in explorer/finder, should be unmountable,.. If someone puts some data in it, it should be handled in a backend software.
Is that possible?
I'm not aware of any existing cross-platform frameworks. For Windows, the documentation for writing device drivers is here: http://msdn.microsoft.com/en-us/library/ff557573. See also http://msdn.microsoft.com/en-us/windows/hardware/gg463062 but note that this is hard-core stuff.

How to list all attached USB devices in Visual C++

In Short: I need to detect hotplug events of my USB CDC device by PID/VID and get the corresponding virtual COM port which was created by Windows in Visual C++ and in the end create a dll.
I have a USB CDC device which I need to be notified of when connected/disconnected on Windows. My approach is to use RegisterDeviceNotification and an "invisible" Window to receive WM_DEVICECHANGE notifications. This part is working so far.
Now as far as I found out I need to get the list of USB devices that is plugged, iterate over it and filter out the devices with my PID/VID? I assume that I am then able to get more informations about the device including the COM port?
Is the only way to achieve my goal to use SetupDi calls in setupapi.h? Is using WDK / DDK the only way to achieve my goal?
As soon as that is working I open-source it on http://github.com/vinzenzweber/USBEventHandler. The Mac version is available already!
After digging through tons of useless documentation at msdn and some debugging I found the missing link: SetupDi calls in setupapi.h: More infos as well as source code for Mac and Windows can be found in my USBEventHandler project at github.com with sources for Mac and Windows.

Resources