HIDDriverKit

RSS for tag

Develop drivers for devices that users interact with using HIDDriverKit.

Posts under HIDDriverKit tag

71 Posts

Post

Replies

Boosts

Views

Activity

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.2k
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
1.1k
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.5k
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.7k
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.9k
Apr ’22
DriverKit Communicating a SwiftUI APP
I read the example "Communicating Between a DriverKit Extension and a Client App". https://developer.apple.com/documentation/driverkit/communicating_between_a_driverkit_extension_and_a_client_app But I still don't know, can I communicate with DriverKit through SwiftUI APP? Instead of using IOServiceOpen in CppUserClient, can I use IOServiceOpen in SwiftUI APP like this? Or are there other options?
1
0
1.9k
Mar ’22
Can I write my own HIDServiceFilter or communicate with existing ones?
I want to update the HIDPointerAccelerationTable which is used inside IOHIDPointerScrollFilter. Using the following does not seem to work (I am guessing there is a whitelist of properties that are passed down the stack): hidutil property --matching '{"ProductID":0x47}' --set '{"HIDPointerAccelerationTable":0}' I verify that nothing happens by monitoring this log stream: sudo log stream --level trace --predicate 'subsystem == "com.apple.iohid"' I cannot see where this is instantiated in the open-source code, although I do know that it is a CFPlugin. Not being able to update this property means I would have to reimplement the IOHIDPointerScrollFilter as part of a DriverKit driver, but its looking like a big task because DriverKit doesn't suppose CF/stdlib stuff. Is there a way to update the HIDPointerAccelerationTable property in IOHIDPointerScrollFilter? Can I write my own HIDServiceFilter? How can I register it? Or is this just an internal thing.
1
0
1.2k
Jan ’22
HIDDriverKit driver fails to dispatch events
HI, I have a simple IOUserHIDEventDriver derived class for a regular mouse which *only* logs messages for the incoming HID reports. The driver successfully loads when the USB transmitter is plugged in and I can receive the HID reports. I can also see that dispatchRelativePointerEvent()(for testing I overrode this method) is being called in response to the HID reports. But the cursor refuses to move! It's as if the dispatch function fails to push the HID reports back into the subsystem for further processing. I do have SIP disabled (or else the driver won't be loaded). I tried running the app (which loads the driver) from /Applications, but that doesn't work either. My entitlements all look fine too. What could be going on? TIA
2
0
1.6k
Jan ’22
Use different class for .iig
My .iig file looks like this, I need to use different class IOUserHIDEventService and IOUserClient. How to modify the class of .llg? Use two different class functions in public: DriverKit.iig #ifndef DriverKit_h #define DriverKit_h #include <Availability.h> #include <DriverKit/IOService.iig> #include <HIDDriverKit/IOUserHIDEventService.iig> class IOHIDElement; class IOHIDDigitizerCollection; class DriverKit: public IOUserHIDEventService { public:   virtual bool init() override;   virtual void free() override;   virtual kern_return_t Start(IOService * provider) override; .......   ....... #endif /* DriverKit_h */
2
0
1.8k
Jan ’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.2k
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
1.1k
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
927
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.5k
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.7k
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.9k
Activity
Apr ’22
DriverKit Communicating a SwiftUI APP
I read the example "Communicating Between a DriverKit Extension and a Client App". https://developer.apple.com/documentation/driverkit/communicating_between_a_driverkit_extension_and_a_client_app But I still don't know, can I communicate with DriverKit through SwiftUI APP? Instead of using IOServiceOpen in CppUserClient, can I use IOServiceOpen in SwiftUI APP like this? Or are there other options?
Replies
1
Boosts
0
Views
1.9k
Activity
Mar ’22
Can I write my own HIDServiceFilter or communicate with existing ones?
I want to update the HIDPointerAccelerationTable which is used inside IOHIDPointerScrollFilter. Using the following does not seem to work (I am guessing there is a whitelist of properties that are passed down the stack): hidutil property --matching '{"ProductID":0x47}' --set '{"HIDPointerAccelerationTable":0}' I verify that nothing happens by monitoring this log stream: sudo log stream --level trace --predicate 'subsystem == "com.apple.iohid"' I cannot see where this is instantiated in the open-source code, although I do know that it is a CFPlugin. Not being able to update this property means I would have to reimplement the IOHIDPointerScrollFilter as part of a DriverKit driver, but its looking like a big task because DriverKit doesn't suppose CF/stdlib stuff. Is there a way to update the HIDPointerAccelerationTable property in IOHIDPointerScrollFilter? Can I write my own HIDServiceFilter? How can I register it? Or is this just an internal thing.
Replies
1
Boosts
0
Views
1.2k
Activity
Jan ’22
HIDDriverKit driver fails to dispatch events
HI, I have a simple IOUserHIDEventDriver derived class for a regular mouse which *only* logs messages for the incoming HID reports. The driver successfully loads when the USB transmitter is plugged in and I can receive the HID reports. I can also see that dispatchRelativePointerEvent()(for testing I overrode this method) is being called in response to the HID reports. But the cursor refuses to move! It's as if the dispatch function fails to push the HID reports back into the subsystem for further processing. I do have SIP disabled (or else the driver won't be loaded). I tried running the app (which loads the driver) from /Applications, but that doesn't work either. My entitlements all look fine too. What could be going on? TIA
Replies
2
Boosts
0
Views
1.6k
Activity
Jan ’22
Use different class for .iig
My .iig file looks like this, I need to use different class IOUserHIDEventService and IOUserClient. How to modify the class of .llg? Use two different class functions in public: DriverKit.iig #ifndef DriverKit_h #define DriverKit_h #include <Availability.h> #include <DriverKit/IOService.iig> #include <HIDDriverKit/IOUserHIDEventService.iig> class IOHIDElement; class IOHIDDigitizerCollection; class DriverKit: public IOUserHIDEventService { public:   virtual bool init() override;   virtual void free() override;   virtual kern_return_t Start(IOService * provider) override; .......   ....... #endif /* DriverKit_h */
Replies
2
Boosts
0
Views
1.8k
Activity
Jan ’22
HID touch input device support
After some iOS version, HID touch does not recognize so needs to install an extra touch driver on iOS(suppose it is after Big SUR iOS...) Is there any way to use HID touch function without installing touch driver?
Replies
0
Boosts
0
Views
1.3k
Activity
Jan ’22