HIDDriverKit

RSS for tag

Develop drivers for devices that users interact with using HIDDriverKit.

Posts under HIDDriverKit tag

70 Posts

Post

Replies

Boosts

Views

Activity

Pointer re-center
I am using an BLE HID mouse, and I have an option to recenter the mouse according to screen resolution that I get from an iPhone. I have 2 issues regarding this post: Getting the screen resolution of an iPhone 11 sends back the resolution of an iPhone 11 Pro and vise versa. To re-center the pointer, I send an HID movement to the iPhone, first to the corner (doesn't matter which one), second to center which is just the resolution divided by 2 on both width and height. Not consistent, but the pointer doesn't always go to the center. My questions are: Why is the resolution sends differently on these devices? Is there a correct way to center the pointer using HID movement commands?
0
0
739
Aug ’23
importing HID Driver Kit Framework
Hi everyone, I am fairly new to Apple development. I have been working on a project where I need Mac to interface with an HID device (custom device). I have successfully communicated with the device using IOKit, Core Foundation and Driver Kit frameworks by simply importing these frameworks in the project and making use of their APIs. However, my client is now asking that I develop the communication explicitly using HID Driver Kit. Bear in mind that I have not purchased the apple developer certificate nor do I have any provisional signing certificates and without any of these, Xcode was allowing me to use frameworks like IOKit, DriverKit etc. Now, when I tried importing HIDDriverKit into the project, I am not able to find this framework in the "Frameworks and Libraries" tab. How do I import this framework into my project? Do I have to purchase apple developer ID or get the provisional signing certificates or any other formalities are required? Please let me know what can be done. Any pointers or suggestions are welcome. Best, Vishnu
3
0
1k
Jul ’23
Getting started developing a DriverKit extension, need subscription?
Hello everyone, I am new to developing software for the MacOS platform. I have been doing so on other platforms for years and would like to know what I need to start developing a DriverKit extension, that enables me to read HID input and transform it into commands (I assume I need Xcode and I've already seen examples and some documentation to the technical side of the issue; I am having troubles wrapping my head around entitlements, App ID and the likes). I am not yet talking about distribution, let alone in the AppStore, I am just talking about developing a piece of software for a customly made device, that should appear as a HID (pointer-device with additional touch surface, buttons and the likes). Do I have to purchase an annual Apple Developer subscription right away? Or can I finish the driver and possibly a UI application for its configuration locally and then buy the subscription if I want to enroll my application in AppStore? It's a hobby project, that will be useful to at least me and such a project motivates me to go through with it, even though it is admittedly somewhat complex. Best regards, Igor.
0
0
844
Apr ’23
MI Dual Mode Wireless Mouse side buttons not working via BT connection
I am using MI dual mode mouse on my MacBook Pro 2018, OS Ventura, but the side buttons don't work when using Bluetooth. The side buttons do work well via USB dongle but not Bluetooth. I did some research and found that, the Mouse/HID descriptor send invalid code for the 2 side buttons when using BT. Anyone who might know how I can solve this issue?
6
2
5.2k
Mar ’23
Accessing an HID interface in a USB Composite Audio device
I develop an app for a USB Composite device that has an audio class 1 interface and a midi interface. USBInterfaceOpen() (part of the IOUSBInterfaceStruct800) can open the midi interface and I can send and receive raw midi messages using the USB api just fine (using libusb). I do not need to detach the kernel driver and the audio device keep working. We want to change our product so that it is an audio class 2 device and has a HID interface. When I use USBInterfaceOpen() on the HID interface, it returns with the error another process has device opened for exclusive access It is very odd that MacOS will let an application open a midi interface that MacOS does have a driver loaded for (its internal midi driver) but MacOS will not allow an application to open a HID interface in a USB Composite device with audio class 2 unless the application first detaches the kernel driver causing all audio function to stop. The app must be able to control the product while at the same time audio continues to function in the OS. On Windows and Linux the HID interface can be used without the audio device being removed from the OS. MacOS is prohibiting us from moving forward with this solution. Is this a bug in MacOS? Developing on MacOS is 12.5, XCode = 13.4, tried target 10.14, 11.0 and 12.0
1
0
1.1k
Jan ’23
iPad 10th Gen and IOKitLib/IOHIDManager
I'm creating an iPad room information app which needs to communicate over USB with an LED light strip. The USB controller is HID class, vendor ID is 0x20a0 and product ID is 0x41e5. It requires sending a simple feature report to control the LEDs. I've got it working on the Mac using IOKit, and compiling on the 10th gen USB C iPad using copied headers and bridging IOKitLib and IOHIDManager, but sandboxing prevents the code executing on the iPad (IOServiceOpen failed: 0xe00002e2). Is joining the MFi program really the only way to get this to get the necessary entitlements? At our current scale, we don't need to distribute in the App Store.
0
0
1.4k
Jan ’23
How to customize additional Buttons for a bluetooth device by an APP?
Hi Guys, I need to customize several keys for a bluetooth device. Sometimes the functional of the bluetooth device keys need to change, like change functional from "pgup" to "left" key. So far to customize the key it must go to the Iphone Settings=>Accessibility=>Touch=>AssistiveTouch=>Devices=>"bluetooth device name"=>Customize Additional Buttons/ Above progress is too complicated for user. I want to built an APP to simplify above progress. Currently I found the apple only provide the DriverKit Extension or HIDDriveKit for MacOS or PadOS but no IOS. Is there any methods? Thanks for the help.
0
0
2.5k
Jan ’23
Creating IOHIDEvent objects for DriverKit/IOHIDUserService
The documentation for IOHIDUserService lists the following instance method: virtual void dispatchEvent(IOHIDEvent *event); It specifically says, "You can also call it directly to dispatch events for which you create an IOHIDEvent object." I see nowhere in any documentation on the details for the IOHIDEvent class and creating your own. Google searches let me find https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-368.20/IOHIDFamily/IOHIDEvent.h.auto.html Unfortunately i see nowhere on my computer where IOHIDEvent.h exists. Is this something i'm going to have to build/pull in manually, or is there a framework that I'm just not seeing that I can pull in to create an IOHIDEvent?
1
0
1.7k
Oct ’22
DriverKit code signing/driver loading issues.
I have been trying to get a stub DriverKit driver loading on my computers without success. I keep getting errors regarding the code signature being invalid. I've been beating my head against the wall for a couple weeks now, so I'd appreciate the help. Layout: Standard Application that does the install/removal. BundleId (changed to protect the innocent) com.somename.someapp. Second target with DriverKit driver: com.somename.someapp.mydriver. To start out this is an IOUserHIDEventService. Question 1) I assume these need to be different with their own entitlements. Is that correct? Question 2) this is my current Entitlement layout; App has SystemExtension. Driver has DriverKit, DriverKit HID Transport, and DriverKit HID Event Service Family. Is this correct for this layout? Question 3) Does the Code Signing Identity/Profile in the Apple Developer section need to match exactly, or can that have more than what is requested? (I started equal, but gave more just to try to troubleshoot) Question 4) I have requested and have been approved to have the "Additional Capabilities" versions of the DriverKit entitlements in Identities. Do i need both checked? can I only have the distribution one? Question 5) I have SIP disabled on my machine (csrutil status shows disabled). I thought this was supposed to bypass the code signing checks? I still see the driver loading being killed because of invalid code signing. Question 6) Does the "Additional Capabilities" version of the DriverKit entitlements that I needed get get approval for bypass the need to disable SIP, or will i need to keep it off for the entirety of development? Thanks!
13
0
3.6k
Oct ’22
USBDriverKit driver not dispatching events
I have a driver that is not much more than the sample code for a USB mouse. I am able to get the driver to match with my device (Logitech G600 mouse), and I can see logging inside my handleReport() function, but dispatchRelativePointerEvent does not seem to cause any effect, although it returns KERN_SUCCESS. I've tried it with both SUPERDISPATCH and without (it isn't clear to me if the superclass method needs to be called in the kernel or not in this case), and by subclassing both IOUserHIDEventService and IOUserHIDEventDriver. Below is my handleReport function. Thanks in advance for any assistance, and this is on macOS Ventura Beta 2 void G600Driver::handleReport(uint64_t timestamp,                               uint8_t *report,                               uint32_t reportLength,                               IOHIDReportType type,                               uint32_t reportID) {   kern_return_t kr = dispatchRelativePointerEvent(timestamp, -10, -10, 0, 0, SUPERDISPATCH);   DRLOG("ret: %d", kr); }```
4
0
2k
Sep ’22
More than one DriverKit module in an Application?
Since Logitech isn't updating their mouse software for M1 after almost two years, i'm going to try to make my own 'driver' for it. In doing so I want to create a virtual HID device that i can tell to send joystick button presses when I press my mouse's macro keys (G600). Looks like to do this properly i would want to create two drivers, one as an HID service IOUserHIDEventService that translates the mouse's HID reports, and an IOUserUSBHostHIDDevice that will create a new HID device with its own descriptor and reports. So that begs the question, can an application contain more than one driver module, or is it limited to one at a time?
1
0
1.2k
Sep ’22
Is absolute bluetooth mouse movements supported in ios?
am trying to send Bluetooth HID Mouse Commands. However the HTML cursor coordinates relative to device screen have no accurate impact on how Screen Cursor (Accessibility Pointer) in IOS Device moves. For example. Mouse Command: M 0 <X-Axis> <Y-Axis> 00 Values we can send (0 - 127 +ve) and (255 = -1, 254 = -2, ... 128 = -127) because bluetooth accepts unsigned integers. If my HTML Cursor is at (X=20,Y=20), How can I determine what exact value should I send to Bluetooth Screen Cursor (Accessibility Pointer) to go to exact accurate position where HTML Cursor is at.
0
0
1.5k
Aug ’22
Panic occurs in driverkit(karabiner).
It occurs only in m1 macbookPro. Panic does not occur in intel macbook. Load my Product EndpointSecurity using NSEndpointSecurityEarlyBoot. Install karabiner. Reboot After the reboot is completed, a panic occurs before 1 minute later.(100%) forever rebooting There is a singularity here. If EndpointSecurity calls the es_subscribe() function, no panic occurs. Here's the question. To use NSEndpointySecurityEarlyBoot, must the es_subscribe() function be called at least once unconditionally? If the es_subscribe() is not called, is the panicking behavior normal? For reference, system diagnostic logs cannot be collected.  This is because panic occurs forever when rebooting.
0
0
1.1k
Jul ’22
Press some special characters by HID usage codes
Hi everyone, I am developing a virtual keyboard device connected to an iOS device by Bluetooth. And how to press any special characters by HID usage. I have tried all combinations of keys option + shift + key or option + key but there aren't any characters that I want Particularly, I want to press the character '@' in the Lithuanian language for iOS devices by Bluetooth virtual keyboard. Are there any combinations of keys to press these special characters? Dien Vu
0
0
895
Jun ’22
Remap different keyboard using IOHID
Hi there! I'm currently new to Mac OS dev (coming from a history of Linux dev). I have an external BT keyboard and a couple keys are mapped differently than my Mac keyboard (§ to ` for example). I'm wondering if it's possible to write a kernel extension that detects the key sent from the BT keyboard and remap the key code. I don't really know whether this is possible and if it is, where to look in the ecosystem. It's a bit different from Linux. Thank you!
1
0
1.1k
May ’22
How to use the stdlib/CF in DriverKit?
I am porting some code with heavy use of stdlib and CF. Linking against CF produces the error: CoreFoundation is not available when building for DriverKit. I get errors like error: no member named 'clock_t' in the global namespace. What is the correct approach here? Could I statically link stdlib? Should I move my processing code to a separate process? Related: https://stackoverflow.com/questions/61797150/can-i-use-stl-in-a-driverkit-driver/61820426#61820426
3
0
1.5k
Apr ’22
memory leak of API IOCreatePlugInInterfaceForService in IOKit
we are developing USB hid library to interact with HID device, however we're facing on memory lacking when we calling IOCreatePlugInInterfaceForService then calling IODestroyPlugInInterface, the memory is not released and each time of calling it take about 0.3 MB Ram, after long time running, the program crash because runout of memory. what should we do in this case to avoid memory leak? // Create a device interface/HANDLE static BOOL CreateHidDeviceInterface(io_object_t deviceObject, HANDLE* pHandle) { BOOL retVal = FALSE; IOCFPlugInInterface** ppPluginInterface = NULL; SInt32 score = 0; IOReturn pluginResult; HRESULT interfaceResult; // Create a plugin so we can create an interface pluginResult = IOCreatePlugInInterfaceForService(deviceObject, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &ppPluginInterface, &score); if (pluginResult == kIOReturnSuccess) { // Create the interface (HANDLE) interfaceResult = (*ppPluginInterface)->QueryInterface(ppPluginInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (void**)pHandle); if (interfaceResult == S_OK) { retVal = TRUE; } IODestroyPlugInInterface(ppPluginInterface); } return retVal; }
1
0
1.4k
Apr ’22
Pointer re-center
I am using an BLE HID mouse, and I have an option to recenter the mouse according to screen resolution that I get from an iPhone. I have 2 issues regarding this post: Getting the screen resolution of an iPhone 11 sends back the resolution of an iPhone 11 Pro and vise versa. To re-center the pointer, I send an HID movement to the iPhone, first to the corner (doesn't matter which one), second to center which is just the resolution divided by 2 on both width and height. Not consistent, but the pointer doesn't always go to the center. My questions are: Why is the resolution sends differently on these devices? Is there a correct way to center the pointer using HID movement commands?
Replies
0
Boosts
0
Views
739
Activity
Aug ’23
importing HID Driver Kit Framework
Hi everyone, I am fairly new to Apple development. I have been working on a project where I need Mac to interface with an HID device (custom device). I have successfully communicated with the device using IOKit, Core Foundation and Driver Kit frameworks by simply importing these frameworks in the project and making use of their APIs. However, my client is now asking that I develop the communication explicitly using HID Driver Kit. Bear in mind that I have not purchased the apple developer certificate nor do I have any provisional signing certificates and without any of these, Xcode was allowing me to use frameworks like IOKit, DriverKit etc. Now, when I tried importing HIDDriverKit into the project, I am not able to find this framework in the "Frameworks and Libraries" tab. How do I import this framework into my project? Do I have to purchase apple developer ID or get the provisional signing certificates or any other formalities are required? Please let me know what can be done. Any pointers or suggestions are welcome. Best, Vishnu
Replies
3
Boosts
0
Views
1k
Activity
Jul ’23
HID driverKit Support on iPadOS?
Hi, I learned to know that PCI, USB and Audio Driver Kits are supported on iPadOS. Does anyone know when or if HID driver kit will be supported on iPadOS? Thanks, Nike
Replies
0
Boosts
1
Views
746
Activity
Jul ’23
HID support for iOS?
Hi, I wonder if there is any possibility to use HID devices on iOS (iPad) and what should I do to enable it? Develop, install existing driver or something else? Thanks a lot! Nike
Replies
0
Boosts
0
Views
975
Activity
Jul ’23
Getting started developing a DriverKit extension, need subscription?
Hello everyone, I am new to developing software for the MacOS platform. I have been doing so on other platforms for years and would like to know what I need to start developing a DriverKit extension, that enables me to read HID input and transform it into commands (I assume I need Xcode and I've already seen examples and some documentation to the technical side of the issue; I am having troubles wrapping my head around entitlements, App ID and the likes). I am not yet talking about distribution, let alone in the AppStore, I am just talking about developing a piece of software for a customly made device, that should appear as a HID (pointer-device with additional touch surface, buttons and the likes). Do I have to purchase an annual Apple Developer subscription right away? Or can I finish the driver and possibly a UI application for its configuration locally and then buy the subscription if I want to enroll my application in AppStore? It's a hobby project, that will be useful to at least me and such a project motivates me to go through with it, even though it is admittedly somewhat complex. Best regards, Igor.
Replies
0
Boosts
0
Views
844
Activity
Apr ’23
MI Dual Mode Wireless Mouse side buttons not working via BT connection
I am using MI dual mode mouse on my MacBook Pro 2018, OS Ventura, but the side buttons don't work when using Bluetooth. The side buttons do work well via USB dongle but not Bluetooth. I did some research and found that, the Mouse/HID descriptor send invalid code for the 2 side buttons when using BT. Anyone who might know how I can solve this issue?
Replies
6
Boosts
2
Views
5.2k
Activity
Mar ’23
Accessing an HID interface in a USB Composite Audio device
I develop an app for a USB Composite device that has an audio class 1 interface and a midi interface. USBInterfaceOpen() (part of the IOUSBInterfaceStruct800) can open the midi interface and I can send and receive raw midi messages using the USB api just fine (using libusb). I do not need to detach the kernel driver and the audio device keep working. We want to change our product so that it is an audio class 2 device and has a HID interface. When I use USBInterfaceOpen() on the HID interface, it returns with the error another process has device opened for exclusive access It is very odd that MacOS will let an application open a midi interface that MacOS does have a driver loaded for (its internal midi driver) but MacOS will not allow an application to open a HID interface in a USB Composite device with audio class 2 unless the application first detaches the kernel driver causing all audio function to stop. The app must be able to control the product while at the same time audio continues to function in the OS. On Windows and Linux the HID interface can be used without the audio device being removed from the OS. MacOS is prohibiting us from moving forward with this solution. Is this a bug in MacOS? Developing on MacOS is 12.5, XCode = 13.4, tried target 10.14, 11.0 and 12.0
Replies
1
Boosts
0
Views
1.1k
Activity
Jan ’23
iPad 10th Gen and IOKitLib/IOHIDManager
I'm creating an iPad room information app which needs to communicate over USB with an LED light strip. The USB controller is HID class, vendor ID is 0x20a0 and product ID is 0x41e5. It requires sending a simple feature report to control the LEDs. I've got it working on the Mac using IOKit, and compiling on the 10th gen USB C iPad using copied headers and bridging IOKitLib and IOHIDManager, but sandboxing prevents the code executing on the iPad (IOServiceOpen failed: 0xe00002e2). Is joining the MFi program really the only way to get this to get the necessary entitlements? At our current scale, we don't need to distribute in the App Store.
Replies
0
Boosts
0
Views
1.4k
Activity
Jan ’23
How to customize additional Buttons for a bluetooth device by an APP?
Hi Guys, I need to customize several keys for a bluetooth device. Sometimes the functional of the bluetooth device keys need to change, like change functional from "pgup" to "left" key. So far to customize the key it must go to the Iphone Settings=>Accessibility=>Touch=>AssistiveTouch=>Devices=>"bluetooth device name"=>Customize Additional Buttons/ Above progress is too complicated for user. I want to built an APP to simplify above progress. Currently I found the apple only provide the DriverKit Extension or HIDDriveKit for MacOS or PadOS but no IOS. Is there any methods? Thanks for the help.
Replies
0
Boosts
0
Views
2.5k
Activity
Jan ’23
Creating IOHIDEvent objects for DriverKit/IOHIDUserService
The documentation for IOHIDUserService lists the following instance method: virtual void dispatchEvent(IOHIDEvent *event); It specifically says, "You can also call it directly to dispatch events for which you create an IOHIDEvent object." I see nowhere in any documentation on the details for the IOHIDEvent class and creating your own. Google searches let me find https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-368.20/IOHIDFamily/IOHIDEvent.h.auto.html Unfortunately i see nowhere on my computer where IOHIDEvent.h exists. Is this something i'm going to have to build/pull in manually, or is there a framework that I'm just not seeing that I can pull in to create an IOHIDEvent?
Replies
1
Boosts
0
Views
1.7k
Activity
Oct ’22
DriverKit code signing/driver loading issues.
I have been trying to get a stub DriverKit driver loading on my computers without success. I keep getting errors regarding the code signature being invalid. I've been beating my head against the wall for a couple weeks now, so I'd appreciate the help. Layout: Standard Application that does the install/removal. BundleId (changed to protect the innocent) com.somename.someapp. Second target with DriverKit driver: com.somename.someapp.mydriver. To start out this is an IOUserHIDEventService. Question 1) I assume these need to be different with their own entitlements. Is that correct? Question 2) this is my current Entitlement layout; App has SystemExtension. Driver has DriverKit, DriverKit HID Transport, and DriverKit HID Event Service Family. Is this correct for this layout? Question 3) Does the Code Signing Identity/Profile in the Apple Developer section need to match exactly, or can that have more than what is requested? (I started equal, but gave more just to try to troubleshoot) Question 4) I have requested and have been approved to have the "Additional Capabilities" versions of the DriverKit entitlements in Identities. Do i need both checked? can I only have the distribution one? Question 5) I have SIP disabled on my machine (csrutil status shows disabled). I thought this was supposed to bypass the code signing checks? I still see the driver loading being killed because of invalid code signing. Question 6) Does the "Additional Capabilities" version of the DriverKit entitlements that I needed get get approval for bypass the need to disable SIP, or will i need to keep it off for the entirety of development? Thanks!
Replies
13
Boosts
0
Views
3.6k
Activity
Oct ’22
USBDriverKit driver not dispatching events
I have a driver that is not much more than the sample code for a USB mouse. I am able to get the driver to match with my device (Logitech G600 mouse), and I can see logging inside my handleReport() function, but dispatchRelativePointerEvent does not seem to cause any effect, although it returns KERN_SUCCESS. I've tried it with both SUPERDISPATCH and without (it isn't clear to me if the superclass method needs to be called in the kernel or not in this case), and by subclassing both IOUserHIDEventService and IOUserHIDEventDriver. Below is my handleReport function. Thanks in advance for any assistance, and this is on macOS Ventura Beta 2 void G600Driver::handleReport(uint64_t timestamp,                               uint8_t *report,                               uint32_t reportLength,                               IOHIDReportType type,                               uint32_t reportID) {   kern_return_t kr = dispatchRelativePointerEvent(timestamp, -10, -10, 0, 0, SUPERDISPATCH);   DRLOG("ret: %d", kr); }```
Replies
4
Boosts
0
Views
2k
Activity
Sep ’22
More than one DriverKit module in an Application?
Since Logitech isn't updating their mouse software for M1 after almost two years, i'm going to try to make my own 'driver' for it. In doing so I want to create a virtual HID device that i can tell to send joystick button presses when I press my mouse's macro keys (G600). Looks like to do this properly i would want to create two drivers, one as an HID service IOUserHIDEventService that translates the mouse's HID reports, and an IOUserUSBHostHIDDevice that will create a new HID device with its own descriptor and reports. So that begs the question, can an application contain more than one driver module, or is it limited to one at a time?
Replies
1
Boosts
0
Views
1.2k
Activity
Sep ’22
Is absolute bluetooth mouse movements supported in ios?
am trying to send Bluetooth HID Mouse Commands. However the HTML cursor coordinates relative to device screen have no accurate impact on how Screen Cursor (Accessibility Pointer) in IOS Device moves. For example. Mouse Command: M 0 <X-Axis> <Y-Axis> 00 Values we can send (0 - 127 +ve) and (255 = -1, 254 = -2, ... 128 = -127) because bluetooth accepts unsigned integers. If my HTML Cursor is at (X=20,Y=20), How can I determine what exact value should I send to Bluetooth Screen Cursor (Accessibility Pointer) to go to exact accurate position where HTML Cursor is at.
Replies
0
Boosts
0
Views
1.5k
Activity
Aug ’22
Panic occurs in driverkit(karabiner).
It occurs only in m1 macbookPro. Panic does not occur in intel macbook. Load my Product EndpointSecurity using NSEndpointSecurityEarlyBoot. Install karabiner. Reboot After the reboot is completed, a panic occurs before 1 minute later.(100%) forever rebooting There is a singularity here. If EndpointSecurity calls the es_subscribe() function, no panic occurs. Here's the question. To use NSEndpointySecurityEarlyBoot, must the es_subscribe() function be called at least once unconditionally? If the es_subscribe() is not called, is the panicking behavior normal? For reference, system diagnostic logs cannot be collected.  This is because panic occurs forever when rebooting.
Replies
0
Boosts
0
Views
1.1k
Activity
Jul ’22
Press some special characters by HID usage codes
Hi everyone, I am developing a virtual keyboard device connected to an iOS device by Bluetooth. And how to press any special characters by HID usage. I have tried all combinations of keys option + shift + key or option + key but there aren't any characters that I want Particularly, I want to press the character '@' in the Lithuanian language for iOS devices by Bluetooth virtual keyboard. Are there any combinations of keys to press these special characters? Dien Vu
Replies
0
Boosts
0
Views
895
Activity
Jun ’22
"Virtual" HID from reports
How could I turn a stream of HID reports I have on stdout into a HID (that would eg appear to hidutil)?
Replies
0
Boosts
0
Views
813
Activity
Jun ’22
Remap different keyboard using IOHID
Hi there! I'm currently new to Mac OS dev (coming from a history of Linux dev). I have an external BT keyboard and a couple keys are mapped differently than my Mac keyboard (§ to ` for example). I'm wondering if it's possible to write a kernel extension that detects the key sent from the BT keyboard and remap the key code. I don't really know whether this is possible and if it is, where to look in the ecosystem. It's a bit different from Linux. Thank you!
Replies
1
Boosts
0
Views
1.1k
Activity
May ’22
How to use the stdlib/CF in DriverKit?
I am porting some code with heavy use of stdlib and CF. Linking against CF produces the error: CoreFoundation is not available when building for DriverKit. I get errors like error: no member named 'clock_t' in the global namespace. What is the correct approach here? Could I statically link stdlib? Should I move my processing code to a separate process? Related: https://stackoverflow.com/questions/61797150/can-i-use-stl-in-a-driverkit-driver/61820426#61820426
Replies
3
Boosts
0
Views
1.5k
Activity
Apr ’22
memory leak of API IOCreatePlugInInterfaceForService in IOKit
we are developing USB hid library to interact with HID device, however we're facing on memory lacking when we calling IOCreatePlugInInterfaceForService then calling IODestroyPlugInInterface, the memory is not released and each time of calling it take about 0.3 MB Ram, after long time running, the program crash because runout of memory. what should we do in this case to avoid memory leak? // Create a device interface/HANDLE static BOOL CreateHidDeviceInterface(io_object_t deviceObject, HANDLE* pHandle) { BOOL retVal = FALSE; IOCFPlugInInterface** ppPluginInterface = NULL; SInt32 score = 0; IOReturn pluginResult; HRESULT interfaceResult; // Create a plugin so we can create an interface pluginResult = IOCreatePlugInInterfaceForService(deviceObject, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &ppPluginInterface, &score); if (pluginResult == kIOReturnSuccess) { // Create the interface (HANDLE) interfaceResult = (*ppPluginInterface)->QueryInterface(ppPluginInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (void**)pHandle); if (interfaceResult == S_OK) { retVal = TRUE; } IODestroyPlugInInterface(ppPluginInterface); } return retVal; }
Replies
1
Boosts
0
Views
1.4k
Activity
Apr ’22