USBDriverKit

RSS for tag

Develop drivers for USB-based devices using USBDriverKit.

Posts under USBDriverKit tag

192 Posts

Post

Replies

Boosts

Views

Activity

Can't use <memory> <vector> and some other includes with DriverKit framework
I have XCode 15.0 project with system extension target (c++), and can't include some standard headers, like or . Compilation error: __debug file not found. Base SDK and Supported platforms: DriverKit. Reinstallation of XCode didn't help, as well as manual copy of __debug file into framework include folder. No problems with other C++ targets (command line tools, etc) Please reply if you have identical projects, but without compilation errors. May be that is my system configuration problem and not common DriverKit feature ?
1
0
821
Nov ’23
How to let the system take over a device after the DriverKit process exits?
I have created a USB filter using Mac DriverKit, but the filter is unable to retrieve configuration information during startup. After the USB filter has started and registered the service, my app can send the configuration information to the filter. Therefore, I would like to know if there is a way to exit the USB filter and allow the system to take control of the USB device once the filter has exited. I have tried calling Terminate(0), but it did not work as even after the USB filter exited, the Finder still couldn't display the USB device.
0
0
721
Nov ’23
How does the driverkit serve as a bridge between hardware and the system?
I want to use DriverKit to develop a USBDriver, which serves as a bridge between USB devices and the system. All messages between USB devices and the system will be forwarded through the USBDriver. Can anyone give me some tips or suggestions? What API should I use? I couldn't find anything like this in the documentation or sample code. class MyUSBDriver: public IOUserClient { public: virtual bool init() override; virtual kern_return_t Start(IOService * provider) override; virtual kern_return_t Stop(IOService * provider) override; virtual void free() override; virtual kern_return_t GetRegistryEntryID(uint64_t * registryEntryID) override; virtual kern_return_t NewUserClient(uint32_t type, IOUserClient** userClient) override; virtual kern_return_t ExternalMethod(uint64_t selector, IOUserClientMethodArguments* arguments, const IOUserClientMethodDispatch* dispatch, OSObject* target, void* reference) override; }; I am now able to retrieve the device descriptor in the Start method IOUSBHostDevice *device = OSDynamicCast(IOUSBHostDevice, provider); if (device) { const IOUSBDeviceDescriptor *deviceDescriptor = device->CopyDeviceDescriptor(); if (deviceDescriptor) { uint16_t idVendor = deviceDescriptor->idVendor; uint16_t idProduct = deviceDescriptor->idProduct; uint8_t iSerialNumber = deviceDescriptor->iSerialNumber; IOUSBHostFreeDescriptor(deviceDescriptor); } }
0
0
763
Nov ’23
cannot install CreatingAnAudioDeviceDriver app on ipados 17! Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.yOSaDQ/extracted/SimpleAudio.app/SystemExtensions/com.xreal.nrsdk.driver.demo.Driver.d
Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.yOSaDQ/extracted/SimpleAudio.app/SystemExtensions/com.xreal.nrsdk.driver.demo.Driver.dext : 0xe8008015 (A valid provisioning profile for this executable was not found.) Verify that the Developer App certificate for your account is trusted on your device. Open Settings on the device and navigate to General -> VPN & Device Management, then select your Developer App certificate to trust it.
2
2
1.4k
Oct ’23
Using DriverKit to simulate graphics tablet input
Hi, My goal is to enable this project https://github.com/evidlo/remarkable_mouse to provide native tablet inputs with full information to applications on MacOS, allowing me to reuse my reMarkable tablet for the computer instead of having to buy yet another device, such as a Wacom tablet or an iPad Pro for sidecar when the necessary hardware is already in my posession. I would like to understand whether it is possible to use DriverKit in order to simulate a graphics tablet input device with extra inputs such as pressure and tilt in user-space. Or is this something where IOKit or other comes into play, requiring the creation of a kernel space driver? In either case, what would be the right steps to take? How would I create a virtual device and what are the limitations? If you have the knowledge, how complex would you consider this project to be? The path should basically be some inter-process communication from remarkable_mouse, possibly file-based, triggering tablet events through the driver. At least in the first stage. I assume better performance would be achieved if the whole system was self-contained but porting the reMarkable communication is another challenge on its own. I am experienced developing in other environments but MacOS and driver development are fairly new to me. I've read through the documentation on how to handle the tablet events but creating them seems much murkier. I have searched around for this specific topic without getting much. An open-source tablet driver would be a great place to start but sadly I found none. I've also inquired with ChatGPT but only got high level tips and pseudocode. Any help is greatly appreciated, thank you!
0
0
894
Oct ’23
Is it possible to synchronously request configuration information within the Start method of DriverKit?
Is there a way to synchronously retrieve configuration information from the app or read configuration information from a file within the Start method of DriverKit? I have attempted to use OSMappedFile to read a file, but my driver crashes or I receive the error message "Sandbox: com.injection.epusbfilter.dext(20610) deny(1) file-read-data /private/tmp/driverkit_config.txt" in the console, even though I have set com.apple.security.app-sandbox to false. OSMappedFile *mappedFile; do { const char *path = "/private/tmp/cfg"; // 创建 OSMappedFile 实例 kern_return_t result = OSMappedFile::createFromPath(path, 0, 0, &mappedFile); if (result != KERN_SUCCESS) { Log("Failed to create and map the file."); ret = -1; break; } *size = mappedFile->size(); // 获取映射到内存中的数据 char *charData = reinterpret_cast<char *>(const_cast<void *>(mappedFile->data())); Log("get cfg:%s", charData); if (strlen(charData) > 0) { if (charData[0] == '1') { ret = 1; break; } } else { ret = -2; break; } } while(false); mappedFile->free();
2
0
711
Oct ’23
DriverKit crash at 0x1d4d60010 OSMetaClassBase::Invoke(IORPC) (.cold.1) + 44
I created a driver using DriverKit on Intel macOS 12.6.1 and Xcode 13.3. I enabled auto-manage signing, and set the signing certificate to 'Sign to Run Locally'. Then, I created a provision profile for the driver and selected my M1 test device. After installing the profile, I ran the app on the M1 device and successfully activated the driver. When I plugin the USB device, I can see the following log: DK: epusbfilter-0x100009dce::start(IOUSBHostInterface-0x10000946d) ok epusbfilter - init com.injection.epusbfilter.dext[57573] Corpse failure, too many 6 I also found a crash log ------------------------------------- Translated Report (Full Report Below) ------------------------------------- Process: com.injection.epusbfilter.dext [53185] Path: /Library/SystemExtensions/*/com.injection.epusbfilter.dext Identifier: com.injection.epusbfilter.dext Version: 1.0 (1) Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 270 Date/Time: 2023-09-19 15:01:01.8502 +0800 OS Version: macOS 13.2 (22D49) Report Version: 12 Anonymous UUID: 5EB7EBD9-A435-FC45-73E6-C2C5844A8082 Time Awake Since Boot: 79000 seconds System Integrity Protection: disabled Crashed Thread: 1 Dispatch queue: Root Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Application Specific Information: abort() called Thread 0: 0 libsystem_kernel.dylib 0x1d5043b78 __semwait_signal_nocancel + 8 1 libsystem_c.dylib 0x1d4fcfec8 nanosleep$NOCANCEL + 212 2 libsystem_c.dylib 0x1d4fee204 sleep$NOCANCEL + 48 3 libdispatch.dylib 0x1d4f807b4 _dispatch_queue_cleanup2 + 200 4 libsystem_pthread.dylib 0x1d50fbc50 _pthread_tsd_cleanup + 132 5 libsystem_pthread.dylib 0x1d50f3220 _pthread_exit + 88 6 libsystem_pthread.dylib 0x1d50f4180 pthread_exit + 88 7 libdispatch.dylib 0x1d4f7bbcc dispatch_main + 128 8 DriverKit 0x1d4d33178 DriverExecutableMain + 84 9 dyld 0x104e95e50 start + 2544 Thread 1 Crashed:: Dispatch queue: Root 0 libsystem_kernel.dylib 0x1d5043720 __pthread_kill + 8 1 libsystem_pthread.dylib 0x1d50f40ec pthread_kill + 268 2 libsystem_c.dylib 0x1d5033cac abort + 180 3 DriverKit 0x1d4d5f890 panic + 256 4 DriverKit 0x1d4d5fa60 __assert_rtn + 88 5 DriverKit 0x1d4d60010 OSMetaClassBase::Invoke(IORPC) (.cold.1) + 44 6 DriverKit 0x1d4d32064 OSMetaClassBase::Invoke(IORPC) + 1396 7 DriverKit 0x1d4d32c5c Server(void*, mach_msg_header_t*, mach_msg_header_t*) + 520 8 DriverKit 0x1d4d3b420 uiomessage(void*) + 180 9 DriverKit 0x1d4d34694 uiomachchannel(void*, dispatch_mach_reason_t, dispatch_mach_msg_s*, int) + 380 10 libdispatch.dylib 0x1d4f8868c _dispatch_mach_msg_invoke + 472 11 libdispatch.dylib 0x1d4f74484 _dispatch_lane_serial_drain + 380 12 libdispatch.dylib 0x1d4f89620 _dispatch_mach_invoke + 852 13 libdispatch.dylib 0x1d4f74484 _dispatch_lane_serial_drain + 380 14 libdispatch.dylib 0x1d4f75130 _dispatch_lane_invoke + 436 15 libdispatch.dylib 0x1d4f7640c _dispatch_workloop_invoke + 1784 16 libdispatch.dylib 0x1d4f7ff5c _dispatch_workloop_worker_thread + 652 17 libsystem_pthread.dylib 0x1d50f5024 _pthread_wqthread + 404 18 libsystem_pthread.dylib 0x1d50fc678 start_wqthread + 8 Thread 2: 0 libsystem_pthread.dylib 0x1d50fc670 start_wqthread + 0 Thread 3: 0 libsystem_kernel.dylib 0x1d504401c __sigsuspend_nocancel + 8 1 libdispatch.dylib 0x1d4f808b4 _dispatch_sigsuspend + 48 2 libdispatch.dylib 0x1d4f80884 _dispatch_sig_thread + 56 Thread 1 crashed with ARM Thread State (64-bit): x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000 x4: 0xffffa0016a011948 x5: 0x0000000000000010 x6: 0x00006000010481b0 x7: 0x0000000000000000 x8: 0x725b4b6e56620c88 x9: 0x725b4b6f3d67bc88 x10: 0x00000000000001b0 x11: 0x0000600001048000 x12: 0x0000000000000090 x13: 0x00000000ffffff92 x14: 0x00000000000007fb x15: 0x0000000080636ffb x16: 0x0000000000000148 x17: 0x00000001d7176c60 x18: 0x0000000000000000 x19: 0x0000000000000006 x20: 0x0000000000004003 x21: 0x000000016b05b0e0 x22: 0x0000000000000000 x23: 0x00006000010480e8 x24: 0x0000600001048058 x25: 0xd200fde7d57ecca6 x26: 0x0000000000000085 x27: 0x000060000374c328 x28: 0x0000600001d4c000 fp: 0x000000016b059a90 lr: 0x00000001d50f40ec sp: 0x000000016b059a70 pc: 0x00000001d5043720 cpsr: 0x40001000 far: 0x0000600002c48000 esr: 0x56000080 Address size fault Binary Images: 0x1d503a000 - 0x1d5075fe3 libsystem_kernel.dylib (*) <60df52bd-fc1a-3888-b05b-24b44be3af15> /System/DriverKit/usr/lib/system/libsystem_kernel.dylib 0x1d4fc6000 - 0x1d5039fff libsystem_c.dylib (*) <eee04d9a-7574-3a74-8f4e-cfb05f89f7da> /System/DriverKit/usr/lib/system/libsystem_c.dylib 0x1d4f62000 - 0x1d4fadfff libdispatch.dylib (*) <4e310a5c-9629-305e-a1dd-6632bddd3362> /System/DriverKit/usr/lib/system/libdispatch.dylib 0x1d50ee000 - 0x1d50fdff3 libsystem_pthread.dylib (*) <c1ed564d-b480-3058-937e-b40c3d3df09d> /System/DriverKit/usr/lib/system/libsystem_pthread.dylib 0x1d4d27000 - 0x1d4d6b00d DriverKit (*) <839dc0a2-1e69-38e8-8bf5-ff0ecc531539> /System/DriverKit/System/Library/Frameworks/DriverKit.framework/DriverKit 0x104e90000 - 0x104f1bfff dyld (*) <fe8a9d9e-f65d-34ca-942c-175b99c0601b> /usr/lib/dyld Could anyone please help me with resolving this problem?
1
0
997
Sep ’23
DriverKit in the background
After DriverKit being released last year, I wonder if the background mode External accessory communication in Background Modes applies also for drivers made with DriverKit. Is this mode only for products in the MFi group? If so, is there any plans to include DriverKit in this group in order to get data from an external device in the background, which is not in the MFi group?
1
0
915
Aug ’23
USBDriverKit driver doesn't match, instead uses standard HID drivers
I'm trying to built a USBDriverKit driver on the Mac. The driver loads properly but when my device is inserted the driver is ignored and instead the com.apple.AppleUserHIDDrivers driver is loaded. I do not understand what is causing this. The device both have USB and HID cababilities but I want it to work with USBDriverKit so that the driver can be used on the Ipad as well. How can I get the driver to match properly? Entitlements: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.developer.driverkit</key> <true/> <key>com.apple.developer.driverkit.transport.usb</key> <array> <dict> <key>idVendor</key> <integer>1240</integer> </dict> </array> <key>com.apple.developer.driverkit.userclient-access</key> <true/> <key>com.apple.security.app-sandbox</key> <true/> </dict> </plist> Info.plist: ... <dict> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>IOKitPersonalities</key> <dict> <key>ClickerDriver</key> <dict> <key>IOKitDebug</key> <string>65535</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>IOClass</key> <string>IOUserService</string> <key>IOProviderClass</key> <string>IOUSBHostInterface</string> <key>IOUserClass</key> <string>ClickerDriver</string> <key>IOUserServerName</key> <string>example.Clicker.driver</string> <key>bInterfaceClass</key> <string>3</string> <key>bInterfaceSubClass</key> <string>0</string> <key>bConfigurationValue</key> <string>1</string> <key>bInterfaceNumber</key> <string>0</string> <key>idProduct</key> <integer>63</integer> <key>idVendor</key> <integer>1240</integer> <key>UserClientProperties</key> <dict> <key>IOClass</key> <string>IOUserUserClient</string> <key>IOUserClass</key> <string>ClickerDriverUserClient</string> </dict> </dict> </dict> <key>OSBundleUsageDescription</key> <string>The app interprets monitors key presses. </string> </dict> </plist> Output of ioreg -b -n "Simple HID Device Demo" -r -l is attacheded. ioreg.log
5
0
2.5k
Aug ’23
Does DriverKit work on iPads with M2 or newer Apple Silicon chipsets?
In Apple Developer Documentation / DriverKit, Notes that "The base DriverKit framework is available ... and iPadOS for devices with an M1 processor.", There is no mention of the M2 and subsequent Apple Silicon chipsets, Does DriverKit work on iPads with M2 and subsequent Apple Silicon chipsets? Apple Developer Documentation / DriverKit : https://developer.apple.com/documentation/driverkit
1
0
901
Jul ’23
Is there a problem with slow speed when using libUSB to control type transfer on the MAC m2 architecture?
Why is using control type transfer on the MAC m2 architecture slower than other platforms? The following is my test code, which was tested using the same USB device in Mac m2, Mac x64, and Ubuntu x64 environments. #include <stdio.h> #include <string.h> #include <stdlib.h> #include <libusb.h> #include <sys/time.h> uint64_t get_us() { uint64_t time = 0; struct timeval tv; gettimeofday(&tv, NULL); time = tv.tv_sec * 1000 * 1000 + tv.tv_usec; return time; } int main() { // open usb handle int ret; ret = libusb_init(NULL); libusb_device_handle *usb_handle; usb_handle = libusb_open_device_with_vid_pid(NULL, 0x248a, 0x8266); if (usb_handle == NULL) { exit(1); } ret = libusb_set_auto_detach_kernel_driver(usb_handle, 1); ret = libusb_claim_interface(usb_handle, 0); uint64_t start = get_us(); unsigned char buf[256]; ret = libusb_control_transfer(usb_handle, 0xC1, 0x02, 0x8014, 0, buf, 12, 1000); ret = libusb_control_transfer(usb_handle, 0xC1, 0x02, 0x8014, 0, buf, 12, 1000); ret = libusb_control_transfer(usb_handle, 0xC1, 0x02, 0x8014, 0, buf, 12, 1000); ret = libusb_control_transfer(usb_handle, 0xC1, 0x02, 0x8014, 0, buf, 12, 1000); memset(buf, 0, 256); ret = libusb_control_transfer(usb_handle, 0x41, 0x02, 0x9548, 0, buf, 16, 1000); ret = libusb_control_transfer(usb_handle, 0x41, 0x02, 0x9548, 0, buf, 16, 1000); ret = libusb_control_transfer(usb_handle, 0x41, 0x02, 0x9548, 0, buf, 16, 1000); ret = libusb_control_transfer(usb_handle, 0x41, 0x02, 0x9548, 0, buf, 16, 1000); uint64_t end = get_us(); printf("spent time %ld(us)\n", end - start); libusb_close(usb_handle); libusb_exit(NULL); return 0; } Finally, my conclusion is to call libusb_control_transfer() function on the MAC m2 architecture takes about 10 times slower than the average in x64 architecture. The following are the software running records and wireshark software packet capture records on the MAC m2 architecture. MacBook-Pro % ./libusb_test spent time 22949(us) The following are the running records and wireshark software packet capture records on Ubuntu20 X64. ubuntu20:~$ ./libusb_test spent time 1246(us) From the data captured by Wireshark software, it can be seen that on the MAC m2 architecture, a control transmission takes about 3ms from submission to reply. On the x64 architecture, only around 200us is required. I also tested bulk type transmission, and the performance on the MAC m2 architecture is consistent with that on the x64 architecture. Is this the reason for the MAC m2 architecture USB driver? Is there a solution to this problem?
0
0
792
Jun ’23
Mac M2 pro libusb read/write performance
I am writing a C program on Mac that calls the libUSB API. However, I found some performance differences between the same programs on MAC x64 and MAC M2 systems. Program on Mac m2 call libusb_control_transfer() function is much slower than programs on Mac x64. For example, running a program on Mac x64 takes 3 seconds to complete a function, while on Mac m2 it takes 10 seconds. I try to count the number of times a program calls libusb_control_transfer() and the time it takes each time, and finally calculate the average time it takes to call libusb_control_transfer(). The following figure shows the performance of the program on Mac m2.(Unit is us per time) The following figure shows the performance of the program on Mac x64. (Unit is us per time) The difference in average time spent calling a function has reached over 10 times. Is this performance gap caused by the USB driver or the libUSB library? Thanks.
2
0
1.2k
May ’23
DriverKit provisioning issues
Hello, DriverKit support, My goal is to build an iPad app + DriverKit extension. I requested for DriverKit entitlements from Apple and received approval for it. Now I have to go through the quest and create proper AppID and AdHoc provisioning profiles for our app and DriverKit / USB transport target. Can you please check what I’m doing wrong? XCode is 14.2. AppID Here is what I have and set up for the AppID: and also for Additional Capabilities: Provisioning Profiles Then I tried to create a DriverKit provisioning profile. When I’m adding a profile here is what I have: Here comes my first question: Shall I have DriverKit in the Distribution section? Okay, I tried to create a profile of the “DriverKit App Development” type. At some step, I set up the entitlement: But the portal gives me an error once I clicked to "Generate": FAIL Then I tried to create an AdHoc provisioning profile for my AppID: FAIL again What is going wrong here with the process? Did I receive everything is needed from Apple ? Shalln’t I have “DrivertKit” in the Distribution section ? What type of provisioning profile (for AdHoc and AppStore) distribution is needed ? Thank you in advance!!!
1
0
867
May ’23
Release ExclusiveAccess to an usb device taken by another application?
Seems like both Dropbox and Google Drive has a pretty sad implementation/bug that acquire exclusive access to USB devices that expose MTP (media transfer protocol). The way google and dropbox did it is just wrong as they 1) should ask for permission for reading data on new devices, 2) not open the usb device in exclusive mode... 3) make use of MTP's Multi-Session mode. Well, as it will take them about 4.5 years to correct this, I wonder if there is a way for a app-store/user-space application in macOS 11/12/13 (big sur, monterey, ventura) to do the following: Detect if there is another app that has exclusive lock to a specific usb device Get the name of the app so that an alert could say, "please quit google-drive for this to work..." Release the exclusive lock, i.e. hand over the usb peripheral to my application
0
0
1.1k
Apr ’23
In macOS 13.1, how to communicate with USB billboard device
In macOS 13.1 environment, all IOUSBDevice devices in the current system can be found via the IOServiceAddMatchingNotification function. In the registered callback function, properties such as idVendor, idProduct, and locationID of the device can be read. However, when calling the IOCreatePlugInInterfaceForService function, for USB HID and USB HID devices, a successful status of 0x00000000(kIOReturnSuccess) is returned, but for usb billboard device(type-c ,only have control pipe), an error of 0xe00002be(kIOReturnNoResources) is always returned. Thanks a lot !
1
0
1.4k
Apr ’23
Can't use <memory> <vector> and some other includes with DriverKit framework
I have XCode 15.0 project with system extension target (c++), and can't include some standard headers, like or . Compilation error: __debug file not found. Base SDK and Supported platforms: DriverKit. Reinstallation of XCode didn't help, as well as manual copy of __debug file into framework include folder. No problems with other C++ targets (command line tools, etc) Please reply if you have identical projects, but without compilation errors. May be that is my system configuration problem and not common DriverKit feature ?
Replies
1
Boosts
0
Views
821
Activity
Nov ’23
How to let the system take over a device after the DriverKit process exits?
I have created a USB filter using Mac DriverKit, but the filter is unable to retrieve configuration information during startup. After the USB filter has started and registered the service, my app can send the configuration information to the filter. Therefore, I would like to know if there is a way to exit the USB filter and allow the system to take control of the USB device once the filter has exited. I have tried calling Terminate(0), but it did not work as even after the USB filter exited, the Finder still couldn't display the USB device.
Replies
0
Boosts
0
Views
721
Activity
Nov ’23
How does the driverkit serve as a bridge between hardware and the system?
I want to use DriverKit to develop a USBDriver, which serves as a bridge between USB devices and the system. All messages between USB devices and the system will be forwarded through the USBDriver. Can anyone give me some tips or suggestions? What API should I use? I couldn't find anything like this in the documentation or sample code. class MyUSBDriver: public IOUserClient { public: virtual bool init() override; virtual kern_return_t Start(IOService * provider) override; virtual kern_return_t Stop(IOService * provider) override; virtual void free() override; virtual kern_return_t GetRegistryEntryID(uint64_t * registryEntryID) override; virtual kern_return_t NewUserClient(uint32_t type, IOUserClient** userClient) override; virtual kern_return_t ExternalMethod(uint64_t selector, IOUserClientMethodArguments* arguments, const IOUserClientMethodDispatch* dispatch, OSObject* target, void* reference) override; }; I am now able to retrieve the device descriptor in the Start method IOUSBHostDevice *device = OSDynamicCast(IOUSBHostDevice, provider); if (device) { const IOUSBDeviceDescriptor *deviceDescriptor = device->CopyDeviceDescriptor(); if (deviceDescriptor) { uint16_t idVendor = deviceDescriptor->idVendor; uint16_t idProduct = deviceDescriptor->idProduct; uint8_t iSerialNumber = deviceDescriptor->iSerialNumber; IOUSBHostFreeDescriptor(deviceDescriptor); } }
Replies
0
Boosts
0
Views
763
Activity
Nov ’23
cannot install CreatingAnAudioDeviceDriver app on ipados 17! Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.yOSaDQ/extracted/SimpleAudio.app/SystemExtensions/com.xreal.nrsdk.driver.demo.Driver.d
Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.yOSaDQ/extracted/SimpleAudio.app/SystemExtensions/com.xreal.nrsdk.driver.demo.Driver.dext : 0xe8008015 (A valid provisioning profile for this executable was not found.) Verify that the Developer App certificate for your account is trusted on your device. Open Settings on the device and navigate to General -> VPN & Device Management, then select your Developer App certificate to trust it.
Replies
2
Boosts
2
Views
1.4k
Activity
Oct ’23
Using DriverKit to simulate graphics tablet input
Hi, My goal is to enable this project https://github.com/evidlo/remarkable_mouse to provide native tablet inputs with full information to applications on MacOS, allowing me to reuse my reMarkable tablet for the computer instead of having to buy yet another device, such as a Wacom tablet or an iPad Pro for sidecar when the necessary hardware is already in my posession. I would like to understand whether it is possible to use DriverKit in order to simulate a graphics tablet input device with extra inputs such as pressure and tilt in user-space. Or is this something where IOKit or other comes into play, requiring the creation of a kernel space driver? In either case, what would be the right steps to take? How would I create a virtual device and what are the limitations? If you have the knowledge, how complex would you consider this project to be? The path should basically be some inter-process communication from remarkable_mouse, possibly file-based, triggering tablet events through the driver. At least in the first stage. I assume better performance would be achieved if the whole system was self-contained but porting the reMarkable communication is another challenge on its own. I am experienced developing in other environments but MacOS and driver development are fairly new to me. I've read through the documentation on how to handle the tablet events but creating them seems much murkier. I have searched around for this specific topic without getting much. An open-source tablet driver would be a great place to start but sadly I found none. I've also inquired with ChatGPT but only got high level tips and pseudocode. Any help is greatly appreciated, thank you!
Replies
0
Boosts
0
Views
894
Activity
Oct ’23
ICA driver API
May be trivial question, but I can't find a clear answer. What interface should ICA (scanner) driver implement to communicate with the application ? i.e. to receive acquisition request with parameters and transfer image[s]. Thanks
Replies
0
Boosts
0
Views
856
Activity
Oct ’23
Is it possible to synchronously request configuration information within the Start method of DriverKit?
Is there a way to synchronously retrieve configuration information from the app or read configuration information from a file within the Start method of DriverKit? I have attempted to use OSMappedFile to read a file, but my driver crashes or I receive the error message "Sandbox: com.injection.epusbfilter.dext(20610) deny(1) file-read-data /private/tmp/driverkit_config.txt" in the console, even though I have set com.apple.security.app-sandbox to false. OSMappedFile *mappedFile; do { const char *path = "/private/tmp/cfg"; // 创建 OSMappedFile 实例 kern_return_t result = OSMappedFile::createFromPath(path, 0, 0, &mappedFile); if (result != KERN_SUCCESS) { Log("Failed to create and map the file."); ret = -1; break; } *size = mappedFile->size(); // 获取映射到内存中的数据 char *charData = reinterpret_cast<char *>(const_cast<void *>(mappedFile->data())); Log("get cfg:%s", charData); if (strlen(charData) > 0) { if (charData[0] == '1') { ret = 1; break; } } else { ret = -2; break; } } while(false); mappedFile->free();
Replies
2
Boosts
0
Views
711
Activity
Oct ’23
Driverkit for filtering
As i read Driverkit can be used to write the device driver. But, I want to filter a device. can Driverkit be used for filtering a particular device?
Replies
1
Boosts
0
Views
1.2k
Activity
Oct ’23
DriverKit crash at 0x1d4d60010 OSMetaClassBase::Invoke(IORPC) (.cold.1) + 44
I created a driver using DriverKit on Intel macOS 12.6.1 and Xcode 13.3. I enabled auto-manage signing, and set the signing certificate to 'Sign to Run Locally'. Then, I created a provision profile for the driver and selected my M1 test device. After installing the profile, I ran the app on the M1 device and successfully activated the driver. When I plugin the USB device, I can see the following log: DK: epusbfilter-0x100009dce::start(IOUSBHostInterface-0x10000946d) ok epusbfilter - init com.injection.epusbfilter.dext[57573] Corpse failure, too many 6 I also found a crash log ------------------------------------- Translated Report (Full Report Below) ------------------------------------- Process: com.injection.epusbfilter.dext [53185] Path: /Library/SystemExtensions/*/com.injection.epusbfilter.dext Identifier: com.injection.epusbfilter.dext Version: 1.0 (1) Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 270 Date/Time: 2023-09-19 15:01:01.8502 +0800 OS Version: macOS 13.2 (22D49) Report Version: 12 Anonymous UUID: 5EB7EBD9-A435-FC45-73E6-C2C5844A8082 Time Awake Since Boot: 79000 seconds System Integrity Protection: disabled Crashed Thread: 1 Dispatch queue: Root Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Application Specific Information: abort() called Thread 0: 0 libsystem_kernel.dylib 0x1d5043b78 __semwait_signal_nocancel + 8 1 libsystem_c.dylib 0x1d4fcfec8 nanosleep$NOCANCEL + 212 2 libsystem_c.dylib 0x1d4fee204 sleep$NOCANCEL + 48 3 libdispatch.dylib 0x1d4f807b4 _dispatch_queue_cleanup2 + 200 4 libsystem_pthread.dylib 0x1d50fbc50 _pthread_tsd_cleanup + 132 5 libsystem_pthread.dylib 0x1d50f3220 _pthread_exit + 88 6 libsystem_pthread.dylib 0x1d50f4180 pthread_exit + 88 7 libdispatch.dylib 0x1d4f7bbcc dispatch_main + 128 8 DriverKit 0x1d4d33178 DriverExecutableMain + 84 9 dyld 0x104e95e50 start + 2544 Thread 1 Crashed:: Dispatch queue: Root 0 libsystem_kernel.dylib 0x1d5043720 __pthread_kill + 8 1 libsystem_pthread.dylib 0x1d50f40ec pthread_kill + 268 2 libsystem_c.dylib 0x1d5033cac abort + 180 3 DriverKit 0x1d4d5f890 panic + 256 4 DriverKit 0x1d4d5fa60 __assert_rtn + 88 5 DriverKit 0x1d4d60010 OSMetaClassBase::Invoke(IORPC) (.cold.1) + 44 6 DriverKit 0x1d4d32064 OSMetaClassBase::Invoke(IORPC) + 1396 7 DriverKit 0x1d4d32c5c Server(void*, mach_msg_header_t*, mach_msg_header_t*) + 520 8 DriverKit 0x1d4d3b420 uiomessage(void*) + 180 9 DriverKit 0x1d4d34694 uiomachchannel(void*, dispatch_mach_reason_t, dispatch_mach_msg_s*, int) + 380 10 libdispatch.dylib 0x1d4f8868c _dispatch_mach_msg_invoke + 472 11 libdispatch.dylib 0x1d4f74484 _dispatch_lane_serial_drain + 380 12 libdispatch.dylib 0x1d4f89620 _dispatch_mach_invoke + 852 13 libdispatch.dylib 0x1d4f74484 _dispatch_lane_serial_drain + 380 14 libdispatch.dylib 0x1d4f75130 _dispatch_lane_invoke + 436 15 libdispatch.dylib 0x1d4f7640c _dispatch_workloop_invoke + 1784 16 libdispatch.dylib 0x1d4f7ff5c _dispatch_workloop_worker_thread + 652 17 libsystem_pthread.dylib 0x1d50f5024 _pthread_wqthread + 404 18 libsystem_pthread.dylib 0x1d50fc678 start_wqthread + 8 Thread 2: 0 libsystem_pthread.dylib 0x1d50fc670 start_wqthread + 0 Thread 3: 0 libsystem_kernel.dylib 0x1d504401c __sigsuspend_nocancel + 8 1 libdispatch.dylib 0x1d4f808b4 _dispatch_sigsuspend + 48 2 libdispatch.dylib 0x1d4f80884 _dispatch_sig_thread + 56 Thread 1 crashed with ARM Thread State (64-bit): x0: 0x0000000000000000 x1: 0x0000000000000000 x2: 0x0000000000000000 x3: 0x0000000000000000 x4: 0xffffa0016a011948 x5: 0x0000000000000010 x6: 0x00006000010481b0 x7: 0x0000000000000000 x8: 0x725b4b6e56620c88 x9: 0x725b4b6f3d67bc88 x10: 0x00000000000001b0 x11: 0x0000600001048000 x12: 0x0000000000000090 x13: 0x00000000ffffff92 x14: 0x00000000000007fb x15: 0x0000000080636ffb x16: 0x0000000000000148 x17: 0x00000001d7176c60 x18: 0x0000000000000000 x19: 0x0000000000000006 x20: 0x0000000000004003 x21: 0x000000016b05b0e0 x22: 0x0000000000000000 x23: 0x00006000010480e8 x24: 0x0000600001048058 x25: 0xd200fde7d57ecca6 x26: 0x0000000000000085 x27: 0x000060000374c328 x28: 0x0000600001d4c000 fp: 0x000000016b059a90 lr: 0x00000001d50f40ec sp: 0x000000016b059a70 pc: 0x00000001d5043720 cpsr: 0x40001000 far: 0x0000600002c48000 esr: 0x56000080 Address size fault Binary Images: 0x1d503a000 - 0x1d5075fe3 libsystem_kernel.dylib (*) <60df52bd-fc1a-3888-b05b-24b44be3af15> /System/DriverKit/usr/lib/system/libsystem_kernel.dylib 0x1d4fc6000 - 0x1d5039fff libsystem_c.dylib (*) <eee04d9a-7574-3a74-8f4e-cfb05f89f7da> /System/DriverKit/usr/lib/system/libsystem_c.dylib 0x1d4f62000 - 0x1d4fadfff libdispatch.dylib (*) <4e310a5c-9629-305e-a1dd-6632bddd3362> /System/DriverKit/usr/lib/system/libdispatch.dylib 0x1d50ee000 - 0x1d50fdff3 libsystem_pthread.dylib (*) <c1ed564d-b480-3058-937e-b40c3d3df09d> /System/DriverKit/usr/lib/system/libsystem_pthread.dylib 0x1d4d27000 - 0x1d4d6b00d DriverKit (*) <839dc0a2-1e69-38e8-8bf5-ff0ecc531539> /System/DriverKit/System/Library/Frameworks/DriverKit.framework/DriverKit 0x104e90000 - 0x104f1bfff dyld (*) <fe8a9d9e-f65d-34ca-942c-175b99c0601b> /usr/lib/dyld Could anyone please help me with resolving this problem?
Replies
1
Boosts
0
Views
997
Activity
Sep ’23
DriverKit in the background
After DriverKit being released last year, I wonder if the background mode External accessory communication in Background Modes applies also for drivers made with DriverKit. Is this mode only for products in the MFi group? If so, is there any plans to include DriverKit in this group in order to get data from an external device in the background, which is not in the MFi group?
Replies
1
Boosts
0
Views
915
Activity
Aug ’23
USBDriverKit driver doesn't match, instead uses standard HID drivers
I'm trying to built a USBDriverKit driver on the Mac. The driver loads properly but when my device is inserted the driver is ignored and instead the com.apple.AppleUserHIDDrivers driver is loaded. I do not understand what is causing this. The device both have USB and HID cababilities but I want it to work with USBDriverKit so that the driver can be used on the Ipad as well. How can I get the driver to match properly? Entitlements: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.developer.driverkit</key> <true/> <key>com.apple.developer.driverkit.transport.usb</key> <array> <dict> <key>idVendor</key> <integer>1240</integer> </dict> </array> <key>com.apple.developer.driverkit.userclient-access</key> <true/> <key>com.apple.security.app-sandbox</key> <true/> </dict> </plist> Info.plist: ... <dict> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>IOKitPersonalities</key> <dict> <key>ClickerDriver</key> <dict> <key>IOKitDebug</key> <string>65535</string> <key>CFBundleIdentifier</key> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <key>IOClass</key> <string>IOUserService</string> <key>IOProviderClass</key> <string>IOUSBHostInterface</string> <key>IOUserClass</key> <string>ClickerDriver</string> <key>IOUserServerName</key> <string>example.Clicker.driver</string> <key>bInterfaceClass</key> <string>3</string> <key>bInterfaceSubClass</key> <string>0</string> <key>bConfigurationValue</key> <string>1</string> <key>bInterfaceNumber</key> <string>0</string> <key>idProduct</key> <integer>63</integer> <key>idVendor</key> <integer>1240</integer> <key>UserClientProperties</key> <dict> <key>IOClass</key> <string>IOUserUserClient</string> <key>IOUserClass</key> <string>ClickerDriverUserClient</string> </dict> </dict> </dict> <key>OSBundleUsageDescription</key> <string>The app interprets monitors key presses. </string> </dict> </plist> Output of ioreg -b -n "Simple HID Device Demo" -r -l is attacheded. ioreg.log
Replies
5
Boosts
0
Views
2.5k
Activity
Aug ’23
Does DriverKit work on iPads with M2 or newer Apple Silicon chipsets?
In Apple Developer Documentation / DriverKit, Notes that "The base DriverKit framework is available ... and iPadOS for devices with an M1 processor.", There is no mention of the M2 and subsequent Apple Silicon chipsets, Does DriverKit work on iPads with M2 and subsequent Apple Silicon chipsets? Apple Developer Documentation / DriverKit : https://developer.apple.com/documentation/driverkit
Replies
1
Boosts
0
Views
901
Activity
Jul ’23
Is there a problem with slow speed when using libUSB to control type transfer on the MAC m2 architecture?
Why is using control type transfer on the MAC m2 architecture slower than other platforms? The following is my test code, which was tested using the same USB device in Mac m2, Mac x64, and Ubuntu x64 environments. #include <stdio.h> #include <string.h> #include <stdlib.h> #include <libusb.h> #include <sys/time.h> uint64_t get_us() { uint64_t time = 0; struct timeval tv; gettimeofday(&tv, NULL); time = tv.tv_sec * 1000 * 1000 + tv.tv_usec; return time; } int main() { // open usb handle int ret; ret = libusb_init(NULL); libusb_device_handle *usb_handle; usb_handle = libusb_open_device_with_vid_pid(NULL, 0x248a, 0x8266); if (usb_handle == NULL) { exit(1); } ret = libusb_set_auto_detach_kernel_driver(usb_handle, 1); ret = libusb_claim_interface(usb_handle, 0); uint64_t start = get_us(); unsigned char buf[256]; ret = libusb_control_transfer(usb_handle, 0xC1, 0x02, 0x8014, 0, buf, 12, 1000); ret = libusb_control_transfer(usb_handle, 0xC1, 0x02, 0x8014, 0, buf, 12, 1000); ret = libusb_control_transfer(usb_handle, 0xC1, 0x02, 0x8014, 0, buf, 12, 1000); ret = libusb_control_transfer(usb_handle, 0xC1, 0x02, 0x8014, 0, buf, 12, 1000); memset(buf, 0, 256); ret = libusb_control_transfer(usb_handle, 0x41, 0x02, 0x9548, 0, buf, 16, 1000); ret = libusb_control_transfer(usb_handle, 0x41, 0x02, 0x9548, 0, buf, 16, 1000); ret = libusb_control_transfer(usb_handle, 0x41, 0x02, 0x9548, 0, buf, 16, 1000); ret = libusb_control_transfer(usb_handle, 0x41, 0x02, 0x9548, 0, buf, 16, 1000); uint64_t end = get_us(); printf("spent time %ld(us)\n", end - start); libusb_close(usb_handle); libusb_exit(NULL); return 0; } Finally, my conclusion is to call libusb_control_transfer() function on the MAC m2 architecture takes about 10 times slower than the average in x64 architecture. The following are the software running records and wireshark software packet capture records on the MAC m2 architecture. MacBook-Pro % ./libusb_test spent time 22949(us) The following are the running records and wireshark software packet capture records on Ubuntu20 X64. ubuntu20:~$ ./libusb_test spent time 1246(us) From the data captured by Wireshark software, it can be seen that on the MAC m2 architecture, a control transmission takes about 3ms from submission to reply. On the x64 architecture, only around 200us is required. I also tested bulk type transmission, and the performance on the MAC m2 architecture is consistent with that on the x64 architecture. Is this the reason for the MAC m2 architecture USB driver? Is there a solution to this problem?
Replies
0
Boosts
0
Views
792
Activity
Jun ’23
Mac M2 pro libusb read/write performance
I am writing a C program on Mac that calls the libUSB API. However, I found some performance differences between the same programs on MAC x64 and MAC M2 systems. Program on Mac m2 call libusb_control_transfer() function is much slower than programs on Mac x64. For example, running a program on Mac x64 takes 3 seconds to complete a function, while on Mac m2 it takes 10 seconds. I try to count the number of times a program calls libusb_control_transfer() and the time it takes each time, and finally calculate the average time it takes to call libusb_control_transfer(). The following figure shows the performance of the program on Mac m2.(Unit is us per time) The following figure shows the performance of the program on Mac x64. (Unit is us per time) The difference in average time spent calling a function has reached over 10 times. Is this performance gap caused by the USB driver or the libUSB library? Thanks.
Replies
2
Boosts
0
Views
1.2k
Activity
May ’23
DriverKit System Extension not loading at boot time
I have a IOUSBHostInterface system extension that works great, however if I leave the device plugged in during a reboot, the usual driver is loaded instead and an un-plug + replug is required to load my driver. How can I fix this? It limits the usefulness of my driver.
Replies
2
Boosts
1
Views
1.5k
Activity
May ’23
DriverKit provisioning issues
Hello, DriverKit support, My goal is to build an iPad app + DriverKit extension. I requested for DriverKit entitlements from Apple and received approval for it. Now I have to go through the quest and create proper AppID and AdHoc provisioning profiles for our app and DriverKit / USB transport target. Can you please check what I’m doing wrong? XCode is 14.2. AppID Here is what I have and set up for the AppID: and also for Additional Capabilities: Provisioning Profiles Then I tried to create a DriverKit provisioning profile. When I’m adding a profile here is what I have: Here comes my first question: Shall I have DriverKit in the Distribution section? Okay, I tried to create a profile of the “DriverKit App Development” type. At some step, I set up the entitlement: But the portal gives me an error once I clicked to "Generate": FAIL Then I tried to create an AdHoc provisioning profile for my AppID: FAIL again What is going wrong here with the process? Did I receive everything is needed from Apple ? Shalln’t I have “DrivertKit” in the Distribution section ? What type of provisioning profile (for AdHoc and AppStore) distribution is needed ? Thank you in advance!!!
Replies
1
Boosts
0
Views
867
Activity
May ’23
USB 3 not supportive for External Drives
My mac mini M1 with monterey 13.3.1 usb 3 problem not supportive for External Drives Specially NTFS Format pendrive & drives
Replies
0
Boosts
0
Views
821
Activity
Apr ’23
Release ExclusiveAccess to an usb device taken by another application?
Seems like both Dropbox and Google Drive has a pretty sad implementation/bug that acquire exclusive access to USB devices that expose MTP (media transfer protocol). The way google and dropbox did it is just wrong as they 1) should ask for permission for reading data on new devices, 2) not open the usb device in exclusive mode... 3) make use of MTP's Multi-Session mode. Well, as it will take them about 4.5 years to correct this, I wonder if there is a way for a app-store/user-space application in macOS 11/12/13 (big sur, monterey, ventura) to do the following: Detect if there is another app that has exclusive lock to a specific usb device Get the name of the app so that an alert could say, "please quit google-drive for this to work..." Release the exclusive lock, i.e. hand over the usb peripheral to my application
Replies
0
Boosts
0
Views
1.1k
Activity
Apr ’23
In macOS 13.1, how to communicate with USB billboard device
In macOS 13.1 environment, all IOUSBDevice devices in the current system can be found via the IOServiceAddMatchingNotification function. In the registered callback function, properties such as idVendor, idProduct, and locationID of the device can be read. However, when calling the IOCreatePlugInInterfaceForService function, for USB HID and USB HID devices, a successful status of 0x00000000(kIOReturnSuccess) is returned, but for usb billboard device(type-c ,only have control pipe), an error of 0xe00002be(kIOReturnNoResources) is always returned. Thanks a lot !
Replies
1
Boosts
0
Views
1.4k
Activity
Apr ’23
SiLabsUSBDriver
Mac_OSX_VCP_Driver does not work on Ventura.
Replies
0
Boosts
0
Views
644
Activity
Apr ’23