Gain user-space access to hardware devices and drivers using IOKit.

Posts under IOKit tag

200 Posts

Post

Replies

Boosts

Views

Activity

IOUSBHostDevice fails and throws error in sandboxed app
I get the following errors when running the code below in a sandboxed app (it works when not sandboxed) and I have the com.apple.security.device.usb entitlement enabled. Error:Unable to open io_service_t object and create user client. with reason: IOServiceOpen failed. Error Domain=IOUSBHostErrorDomain Code=-536870174 "Failed to create IOUSBHostObject." UserInfo={NSLocalizedRecoverySuggestion=, NSLocalizedDescription=Failed to create IOUSBHostObject., NSLocalizedFailureReason=IOServiceOpen failed.} import Foundation import IOKit import IOKit.usb import IOKit.usb.IOUSBLib import IOKit.serial import IOUSBHost import IOUSBHost.IOUSBHostInterface class USBService {     enum UsbError: Error {         case noDeviceMatched         case deviceCriteriaNotUnique     }          init() {              }          func getDevice(idVendor: Int?, idProduct: Int?) throws {         let deviceSearchPattern: [IOUSBHostMatchingPropertyKey : Int] = [                    .vendorID : idVendor!,                    .productID : idProduct!,                ]                let deviceDomain = [ "IOProviderClass": "IOUSBHostDevice" ]                let searchRequest = (deviceSearchPattern as NSDictionary).mutableCopy() as! NSMutableDictionary                searchRequest.addEntries(from: deviceDomain)         let service = IOServiceGetMatchingService(kIOMasterPortDefault, searchRequest)         guard service != 0 else {                    throw UsbError.noDeviceMatched         }                       let device = try IOUSBHostDevice.init(__ioService: service, options: [], queue: nil, interestHandler: nil)                  print(device.deviceDescriptor?.pointee.idProduct)     } }
3
0
2.7k
May ’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
2.2k
Apr ’22
designing this gadget for iOS Lightning
Hey there, I'm freelancer on electronic circuits designer, and on my current project I want to design a hub that connects to iPhone and works as: 1. lightning to 3.5mm headphone jack, 2. a button to send a simple data as HID to iPhone and 3. has a lightning female port that enables to connection to charger to charge iPhone. The company needs just a few of this device (actually 50) just for they're and they're few VIP costumers use. I'm designing this gadget for iOS and Android devices. I don't have problem with USB and USB-c, but I there is some ambiguity. I searched web and Also Apple MFi program FAQ, I have some questions: What kind of hardware-based considerations I should have in comparison to USB-c? What is standards and protocols of data transfer of lightning port? Is it similar to USB interface? Is USB hub controller ICs work on lightning as well as USB-c? What is accessory identification chip? What is it's datasheet? Were and how to buy it? For this amount of production (something about 50), is there necessary to get MFi certificate? Is there a datasheet of accessory identification chip for me to complete the design and then enrolling to MFi program? Thanks, Hamidreza Hassanvand
1
0
864
Apr ’22
modernizing legacy IOKit Driver code: IOKit/usb/IOUSBLib.h
Hi there forum, I picked up an old Opensource project from github which is a driver for the Xbox 360 controller. I was going through and hoping to update the repo/build for Apple Silicon and learn some macOS Kernel driver dev along the way. I have been scouring the Apple IOKit documentation archive making my 1/4 through the IOKit doc archive, but, currently, I have an issue with the header search paths. I need to import IOKit/usb/IOUSBLib.h as it contains the symbols utilised by the driver, and it appears that by default Xcode does not use the IOKit Frameworkheaders, but Kernel.framework headers (if I search for definition of symbols that can be found, Xcode opens the Kernel.Framework IOKit path.). Any idea how I can add the user-space IOKit to my driver? I saw that there's the kernel/kernlib, kernel/IOKit, and just IOKit. But a bit lost why this header file is not in the search path. Thanks in advance, If you're curious the code is here: https://github.com/VariableDeclared/360Controller/tree/pj/update-source-for-macos-12.0 Peter
2
0
1.4k
Mar ’22
IOHIDDeviceSetReport hangs application and causes HID device to become unresponsive
IOHIDDeviceSetReport blocks until the report is sent, and when you call it from the main thread in a situation where more than a couple bluetooth devices are connected (which is often, considering Apple's mice, keyboards and trackpads are all bluetooth) and the system can't keep up with the traffic the report rather frequently never makes it through, resulting in a hanged application and an unresponsive bluetooth HID device that will only respond after being disconnected and reconnected. Is there any way around this situation? Ideally IOHIDDeviceSetReport would timeout An output report failing to get through would not make the HID device unresponsive IOHIDDeviceSetReportWithCallback would work, but it seems under the hood it has simply never been implemented There would be a way to set reports asynchronously but it seems none of those are the case. Does anyone have any light to shed on this matter? macOS12 here.
0
1
811
Feb ’22
IOI2CSendRequest missing features
I am playing with IOI2CSendRequest and found a couple things I cannot do with it: E-DDC read of EDIDs that are longer than 256 bytes. This requires a transaction with two sends (one for the segment pointer and one for the offset) with a start bit before each and then the reply preceded by a start bit and ended by a stop bit. IOI2CSendRequest can only do one send and one reply in a single transaction. The E-DDC transaction cannot be split because a second transaction would add an extra stop bit which would reset the segment pointer. A transaction without the offset part works with the GTX 680 or Intel UHD 630 but not with the AMD W5700. DisplayPort DPCD read from DisplayPort device connected to a DisplayPort branch device. This requires a send to the sideband message down request buffer and a reply from the sideband message down reply buffer. This cannot be done with a single IOI2CSendRequest send and reply because the reply is not immediate. I don't think the reply can be polled because I think that is handled by a DisplayPort interrupt and the reply is probably read by the GPU driver and not passed to the user client. Is there a special way to setup the IOI2CRequest to do the above? In the E-DDC case, the i2c handler could maybe suppress the stop bit of the first send after it recognizes that the send is for the segment pointer. In the DisplayPort sideband case, the i2c handler could recognize that the user client wants to get a reply from a sideband message by examining the request sent in the contents of the DisplayPort send buffer, and should therefore queue up the request and wait for the reply. What about M1 Macs? I understand there are some undocumented APIs that people are using to do DDC/CI (MCCS) or to read the EDID but I don't know if they can get more than 256 bytes of the EDID.
0
0
883
Feb ’22
Verbose logging of AppleUSBAudio driver
Hi, I'm developing firmware for a USB audio device for which audio playback currently cuts off after about a second. The normal system logs via Console do not seem to throw any error related to USB audio (and nor do kernel-only logs via log stream --process 0). Is there a good way to dive deeper into what might be happening? Looking into the AppleUSBAudio driver, it contains a bunch of verbose "USB Sound assertion (%s) in %s at line %d\n" logs via IOLog(). Are they supposed to end up in the system logs under normal conditions, or does this require setting IOKit debug verbosity in boot-args? New to debugging Mac OS kernel things.. thanks for helping!
1
0
831
Feb ’22
When OS Sleep disabling network access
Hi, I am finding that network access is lost from my application when the computer goes to sleep. When I receive kIOMessageSystemWillSleep, I want to send a message to another computer. But I am finding it does not always make it to the other end. Sometimes it only get sent when the computer wakes back up.
3
0
800
Jan ’22
Sample Partition Scheme driver kext can't load at boot time.
We are implementing a Sample Partition Scheme driver. this is the info.plist <key>IOKitPersonalities</key> <dict> <key>SamplePartitionScheme</key> <dict> <key>IOKitDebug</key> <integer>0</integer> <key>IOProbeScore</key> <integer>80000</integer> .... <key>IOProviderClass</key> <string>IOMedia</string> <key>IOPropertyMatch</key> <dict> <key>Whole</key> <true/> </dict> </dict> </dict> our driver match a whole disk IOMedia, If it's our disk, perform read/write on this disk. When we test our driver in macOS12. if the IOMedia is a blank RAW disk, our driver will be loaded at boot time. if the IOMedia has partitions, system partition scheme driver will be loaded at boot time. Pluging in a GUID partition disk on a booted Mac always load our kext. how can our driver match GUID partition disks and load at boot time?
1
0
859
Jan ’22
IOServiceGetMatchingServices returning empty iterator
The following code sequence works on Catalina and on Intel Big Sur devices, it does not work on the new Apple M1 devices running Big Sur. CFMutableDictionaryRef matching = IOServiceMatching("IODisplayConnect"); io_iterator_t iter = 99; kern_return_t err = IOServiceGetMatchingServices( kIOMasterPortDefault, matching, &iter ); The "matching" variable seems valid: matching CFMutableDictionaryRef 1 key/value pair [0] "IOProviderClass" : "IODisplayConnect" &#9;&#9;key __NSCFConstantString * "IOProviderClass" &#9;&#9;value __NSCFString * "IODisplayConnect" The call to "IOServiceGetMatchingServices" sets the "iter" value to 0. If I use another class name in the "IOServiceMatching" call, say "IOMediaBSDClient", "IOServiceGetMatchingServices" returns a valid iterator. Would Big Sur on Apple M1 devices need additional calls, or has this service class been deprecated? Using "IODisplayConnect" allows me to get display information via "IODisplayCreateInfoDictionary". Suggestions...
10
1
6.1k
Jan ’22
Disk IOMedia filter driver fails to detect formatted disk (HFS+ Filesystem)
I have implmented the IOMedia Filter driver without content hint for MAC OS Mojave. The driver gets loaded successfully for the IOMedia objects with IOPropertyMatch as "Whole". I could filter the IO requests at the disk layer successfully. This works very well for RAW and formatted disk. The disk I am using here is external SSD device attached to MAC laptop using Thunderbolt-3 interface. I see the driver is getting loaded when I plug-in the TB3 cable. In this case the driver is able to filter the IO requests. If the disk is formatted with the HFS+ Filesystem then I see the filesystem content too. I am facing an issue when I keep plug-in the TB3 cable and reboot the laptop. I have kept the kext files in "/System/Library/Extensions" directory. There are two scenarios to consider, either disk is RAW or Formatted with the HFS+ Filesystem. The scenario 1 is working as expected, but in second scenario the driver is not able to detect the disk. Scenario 1: RAW Disk (Working well) Attached RAW disk through TB3 cable to laptop Reboot the laptop I see the driver is loaded and filter the IO requests successfully. Scenario 2: Disk formatted with HFS+ Filesystem (Failed to load driver) Attached HFS+ Filesystem disk through TB3 cable to laptop Reboot the laptop I see the driver failed to detect the disk &lt;&lt;&lt;=== FAILED But MAC OS detected the HFS+ filesystem on the disk In Scenario 2, after reboot the filter driver seems to be getting loaded, but not able to detect the disk. It seems the MAC OS FS driver is detecting formatted disk before the filter driver. But if I plug-out the disk and plug-in again, I see the filter driver detects disk and start filtering IO requests. I think this could be because of driver loading order during boot time, but I am not sure. The filter driver should detect the disk before MAC OS FS driver detect the formatted disk. Thats the reason may be the filter driver failed to detect the disk after reboot. I am out of ideas what can be done to resolve this issue. Do you think it is driver load order issue? How can we manage the driver load order in MAC OS? Can anybody please help me to resolve this issue? Thanks in advance.
1
0
882
Jan ’22
Can Customize Bluetooth HID usage page/usage be accessed by application on macOS?
We developed a bluetooth keyboard with classical bluetooth, and used usage page 0x01 and usage 0x03 for OTA firmware update, and I wrote an appliction on Windows 10 and everything works as expect. I am trying to wrote same application on macOS Big Sur 11.6.1 with XCode 13.2.1, but I found that DeviceMatchingCallback was triggered only once with usage page 0x01 and usage 0x06, which is keyboard usage page/usage pairs, any other usage page/usage pairs such as 0x01/0x03, 0x0C/0x01 didn't trigger DeviceMatchingCallback. So my question is: can customize usage page/usage of bluetooth hid be accessed by application?
0
0
840
Jan ’22
Embedded scanner Airscan compatible
I need to try to make an embedded scanner AirScan/eSCL compatible. This is a tiny sheetfeed scanner. I have most of the work done, but I am havng issues with the final message exchanges just before the client GETs the scanned image.I can easily enough initiate the scan up to the point of sending 201 Created location URI from there it gets foggy as I have seen AirScan/eSCL Clients that all seem to behave differently. I can make it work in Vuescan but Vuescan does not come back to check ScannerStatus again , it just initiates the download based on header information froj 201 Created and Location: URI.It is specifically this point after sending 201 Created and location URI headers where things are falling apart for me on OSX Mojave.I have seen that OSX mojave requests ScannerStatus again before download but have no idea whet it is looking forI have identified several status messages but not sure even which one applies when the scan is actually ready for download or already downloaded.No matter what I can not seem to make OSX Mojave happy. I figure if I can make it work on Mojave it will probably work on iOS .If anyone has any wireshark traces from a successful scan that may be helpful too. I have a scanner in another city that I was remotely working with but problems with WiFi card not allowing me to see all the traffic on the network so I can see messages to/from real AirScan compatible HP multi function device.Also looking for info on how to identify correctly a SINGLE sheet feeder scanner to OSX, not a flatbed with ADF option .ThanksMark
1
0
2.3k
Jan ’22
SCSI write(10) command over USB
I'm developing an application in Objective C that works on vendor specific commands of SD cards using IOUSBHostPipe. These vendor SCSI passthrough commands are working fine. But when I try to issue a SCSI write(10) command, it seems to hang. The same implementation when done on Windows seems to be working fine. Is there a limitation to issuing a SCSI write(10) command in macOS? I'm a bit new to the macOS environment and would really appreciate some pointers to references that I can look into or any alternatives to this problem. Thanks in advance. Much appreciated :)
0
0
1.1k
Dec ’21
IOUSBHostDevice fails and throws error in sandboxed app
I get the following errors when running the code below in a sandboxed app (it works when not sandboxed) and I have the com.apple.security.device.usb entitlement enabled. Error:Unable to open io_service_t object and create user client. with reason: IOServiceOpen failed. Error Domain=IOUSBHostErrorDomain Code=-536870174 "Failed to create IOUSBHostObject." UserInfo={NSLocalizedRecoverySuggestion=, NSLocalizedDescription=Failed to create IOUSBHostObject., NSLocalizedFailureReason=IOServiceOpen failed.} import Foundation import IOKit import IOKit.usb import IOKit.usb.IOUSBLib import IOKit.serial import IOUSBHost import IOUSBHost.IOUSBHostInterface class USBService {     enum UsbError: Error {         case noDeviceMatched         case deviceCriteriaNotUnique     }          init() {              }          func getDevice(idVendor: Int?, idProduct: Int?) throws {         let deviceSearchPattern: [IOUSBHostMatchingPropertyKey : Int] = [                    .vendorID : idVendor!,                    .productID : idProduct!,                ]                let deviceDomain = [ "IOProviderClass": "IOUSBHostDevice" ]                let searchRequest = (deviceSearchPattern as NSDictionary).mutableCopy() as! NSMutableDictionary                searchRequest.addEntries(from: deviceDomain)         let service = IOServiceGetMatchingService(kIOMasterPortDefault, searchRequest)         guard service != 0 else {                    throw UsbError.noDeviceMatched         }                       let device = try IOUSBHostDevice.init(__ioService: service, options: [], queue: nil, interestHandler: nil)                  print(device.deviceDescriptor?.pointee.idProduct)     } }
Replies
3
Boosts
0
Views
2.7k
Activity
May ’22
How to install DriverKit dext by script
I read the doc of installing system extensions https://developer.apple.com/documentation/systemextensions/installing_system_extensions_and_drivers?language=objc , but actually our product is a framework and installed by .pkg. I/O Kit kext is installed by script in .pkg. So I meet a problem :how to install DriverKit dext by script?
Replies
1
Boosts
0
Views
2.2k
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
2.2k
Activity
Apr ’22
designing this gadget for iOS Lightning
Hey there, I'm freelancer on electronic circuits designer, and on my current project I want to design a hub that connects to iPhone and works as: 1. lightning to 3.5mm headphone jack, 2. a button to send a simple data as HID to iPhone and 3. has a lightning female port that enables to connection to charger to charge iPhone. The company needs just a few of this device (actually 50) just for they're and they're few VIP costumers use. I'm designing this gadget for iOS and Android devices. I don't have problem with USB and USB-c, but I there is some ambiguity. I searched web and Also Apple MFi program FAQ, I have some questions: What kind of hardware-based considerations I should have in comparison to USB-c? What is standards and protocols of data transfer of lightning port? Is it similar to USB interface? Is USB hub controller ICs work on lightning as well as USB-c? What is accessory identification chip? What is it's datasheet? Were and how to buy it? For this amount of production (something about 50), is there necessary to get MFi certificate? Is there a datasheet of accessory identification chip for me to complete the design and then enrolling to MFi program? Thanks, Hamidreza Hassanvand
Replies
1
Boosts
0
Views
864
Activity
Apr ’22
modernizing legacy IOKit Driver code: IOKit/usb/IOUSBLib.h
Hi there forum, I picked up an old Opensource project from github which is a driver for the Xbox 360 controller. I was going through and hoping to update the repo/build for Apple Silicon and learn some macOS Kernel driver dev along the way. I have been scouring the Apple IOKit documentation archive making my 1/4 through the IOKit doc archive, but, currently, I have an issue with the header search paths. I need to import IOKit/usb/IOUSBLib.h as it contains the symbols utilised by the driver, and it appears that by default Xcode does not use the IOKit Frameworkheaders, but Kernel.framework headers (if I search for definition of symbols that can be found, Xcode opens the Kernel.Framework IOKit path.). Any idea how I can add the user-space IOKit to my driver? I saw that there's the kernel/kernlib, kernel/IOKit, and just IOKit. But a bit lost why this header file is not in the search path. Thanks in advance, If you're curious the code is here: https://github.com/VariableDeclared/360Controller/tree/pj/update-source-for-macos-12.0 Peter
Replies
2
Boosts
0
Views
1.4k
Activity
Mar ’22
IOHIDDeviceSetReport hangs application and causes HID device to become unresponsive
IOHIDDeviceSetReport blocks until the report is sent, and when you call it from the main thread in a situation where more than a couple bluetooth devices are connected (which is often, considering Apple's mice, keyboards and trackpads are all bluetooth) and the system can't keep up with the traffic the report rather frequently never makes it through, resulting in a hanged application and an unresponsive bluetooth HID device that will only respond after being disconnected and reconnected. Is there any way around this situation? Ideally IOHIDDeviceSetReport would timeout An output report failing to get through would not make the HID device unresponsive IOHIDDeviceSetReportWithCallback would work, but it seems under the hood it has simply never been implemented There would be a way to set reports asynchronously but it seems none of those are the case. Does anyone have any light to shed on this matter? macOS12 here.
Replies
0
Boosts
1
Views
811
Activity
Feb ’22
IOI2CSendRequest missing features
I am playing with IOI2CSendRequest and found a couple things I cannot do with it: E-DDC read of EDIDs that are longer than 256 bytes. This requires a transaction with two sends (one for the segment pointer and one for the offset) with a start bit before each and then the reply preceded by a start bit and ended by a stop bit. IOI2CSendRequest can only do one send and one reply in a single transaction. The E-DDC transaction cannot be split because a second transaction would add an extra stop bit which would reset the segment pointer. A transaction without the offset part works with the GTX 680 or Intel UHD 630 but not with the AMD W5700. DisplayPort DPCD read from DisplayPort device connected to a DisplayPort branch device. This requires a send to the sideband message down request buffer and a reply from the sideband message down reply buffer. This cannot be done with a single IOI2CSendRequest send and reply because the reply is not immediate. I don't think the reply can be polled because I think that is handled by a DisplayPort interrupt and the reply is probably read by the GPU driver and not passed to the user client. Is there a special way to setup the IOI2CRequest to do the above? In the E-DDC case, the i2c handler could maybe suppress the stop bit of the first send after it recognizes that the send is for the segment pointer. In the DisplayPort sideband case, the i2c handler could recognize that the user client wants to get a reply from a sideband message by examining the request sent in the contents of the DisplayPort send buffer, and should therefore queue up the request and wait for the reply. What about M1 Macs? I understand there are some undocumented APIs that people are using to do DDC/CI (MCCS) or to read the EDID but I don't know if they can get more than 256 bytes of the EDID.
Replies
0
Boosts
0
Views
883
Activity
Feb ’22
Verbose logging of AppleUSBAudio driver
Hi, I'm developing firmware for a USB audio device for which audio playback currently cuts off after about a second. The normal system logs via Console do not seem to throw any error related to USB audio (and nor do kernel-only logs via log stream --process 0). Is there a good way to dive deeper into what might be happening? Looking into the AppleUSBAudio driver, it contains a bunch of verbose "USB Sound assertion (%s) in %s at line %d\n" logs via IOLog(). Are they supposed to end up in the system logs under normal conditions, or does this require setting IOKit debug verbosity in boot-args? New to debugging Mac OS kernel things.. thanks for helping!
Replies
1
Boosts
0
Views
831
Activity
Feb ’22
When OS Sleep disabling network access
Hi, I am finding that network access is lost from my application when the computer goes to sleep. When I receive kIOMessageSystemWillSleep, I want to send a message to another computer. But I am finding it does not always make it to the other end. Sometimes it only get sent when the computer wakes back up.
Replies
3
Boosts
0
Views
800
Activity
Jan ’22
Sample Partition Scheme driver kext can't load at boot time.
We are implementing a Sample Partition Scheme driver. this is the info.plist <key>IOKitPersonalities</key> <dict> <key>SamplePartitionScheme</key> <dict> <key>IOKitDebug</key> <integer>0</integer> <key>IOProbeScore</key> <integer>80000</integer> .... <key>IOProviderClass</key> <string>IOMedia</string> <key>IOPropertyMatch</key> <dict> <key>Whole</key> <true/> </dict> </dict> </dict> our driver match a whole disk IOMedia, If it's our disk, perform read/write on this disk. When we test our driver in macOS12. if the IOMedia is a blank RAW disk, our driver will be loaded at boot time. if the IOMedia has partitions, system partition scheme driver will be loaded at boot time. Pluging in a GUID partition disk on a booted Mac always load our kext. how can our driver match GUID partition disks and load at boot time?
Replies
1
Boosts
0
Views
859
Activity
Jan ’22
IOServiceGetMatchingServices returning empty iterator
The following code sequence works on Catalina and on Intel Big Sur devices, it does not work on the new Apple M1 devices running Big Sur. CFMutableDictionaryRef matching = IOServiceMatching("IODisplayConnect"); io_iterator_t iter = 99; kern_return_t err = IOServiceGetMatchingServices( kIOMasterPortDefault, matching, &iter ); The "matching" variable seems valid: matching CFMutableDictionaryRef 1 key/value pair [0] "IOProviderClass" : "IODisplayConnect" &#9;&#9;key __NSCFConstantString * "IOProviderClass" &#9;&#9;value __NSCFString * "IODisplayConnect" The call to "IOServiceGetMatchingServices" sets the "iter" value to 0. If I use another class name in the "IOServiceMatching" call, say "IOMediaBSDClient", "IOServiceGetMatchingServices" returns a valid iterator. Would Big Sur on Apple M1 devices need additional calls, or has this service class been deprecated? Using "IODisplayConnect" allows me to get display information via "IODisplayCreateInfoDictionary". Suggestions...
Replies
10
Boosts
1
Views
6.1k
Activity
Jan ’22
Disk IOMedia filter driver fails to detect formatted disk (HFS+ Filesystem)
I have implmented the IOMedia Filter driver without content hint for MAC OS Mojave. The driver gets loaded successfully for the IOMedia objects with IOPropertyMatch as "Whole". I could filter the IO requests at the disk layer successfully. This works very well for RAW and formatted disk. The disk I am using here is external SSD device attached to MAC laptop using Thunderbolt-3 interface. I see the driver is getting loaded when I plug-in the TB3 cable. In this case the driver is able to filter the IO requests. If the disk is formatted with the HFS+ Filesystem then I see the filesystem content too. I am facing an issue when I keep plug-in the TB3 cable and reboot the laptop. I have kept the kext files in "/System/Library/Extensions" directory. There are two scenarios to consider, either disk is RAW or Formatted with the HFS+ Filesystem. The scenario 1 is working as expected, but in second scenario the driver is not able to detect the disk. Scenario 1: RAW Disk (Working well) Attached RAW disk through TB3 cable to laptop Reboot the laptop I see the driver is loaded and filter the IO requests successfully. Scenario 2: Disk formatted with HFS+ Filesystem (Failed to load driver) Attached HFS+ Filesystem disk through TB3 cable to laptop Reboot the laptop I see the driver failed to detect the disk &lt;&lt;&lt;=== FAILED But MAC OS detected the HFS+ filesystem on the disk In Scenario 2, after reboot the filter driver seems to be getting loaded, but not able to detect the disk. It seems the MAC OS FS driver is detecting formatted disk before the filter driver. But if I plug-out the disk and plug-in again, I see the filter driver detects disk and start filtering IO requests. I think this could be because of driver loading order during boot time, but I am not sure. The filter driver should detect the disk before MAC OS FS driver detect the formatted disk. Thats the reason may be the filter driver failed to detect the disk after reboot. I am out of ideas what can be done to resolve this issue. Do you think it is driver load order issue? How can we manage the driver load order in MAC OS? Can anybody please help me to resolve this issue? Thanks in advance.
Replies
1
Boosts
0
Views
882
Activity
Jan ’22
Can Customize Bluetooth HID usage page/usage be accessed by application on macOS?
We developed a bluetooth keyboard with classical bluetooth, and used usage page 0x01 and usage 0x03 for OTA firmware update, and I wrote an appliction on Windows 10 and everything works as expect. I am trying to wrote same application on macOS Big Sur 11.6.1 with XCode 13.2.1, but I found that DeviceMatchingCallback was triggered only once with usage page 0x01 and usage 0x06, which is keyboard usage page/usage pairs, any other usage page/usage pairs such as 0x01/0x03, 0x0C/0x01 didn't trigger DeviceMatchingCallback. So my question is: can customize usage page/usage of bluetooth hid be accessed by application?
Replies
0
Boosts
0
Views
840
Activity
Jan ’22
Embedded scanner Airscan compatible
I need to try to make an embedded scanner AirScan/eSCL compatible. This is a tiny sheetfeed scanner. I have most of the work done, but I am havng issues with the final message exchanges just before the client GETs the scanned image.I can easily enough initiate the scan up to the point of sending 201 Created location URI from there it gets foggy as I have seen AirScan/eSCL Clients that all seem to behave differently. I can make it work in Vuescan but Vuescan does not come back to check ScannerStatus again , it just initiates the download based on header information froj 201 Created and Location: URI.It is specifically this point after sending 201 Created and location URI headers where things are falling apart for me on OSX Mojave.I have seen that OSX mojave requests ScannerStatus again before download but have no idea whet it is looking forI have identified several status messages but not sure even which one applies when the scan is actually ready for download or already downloaded.No matter what I can not seem to make OSX Mojave happy. I figure if I can make it work on Mojave it will probably work on iOS .If anyone has any wireshark traces from a successful scan that may be helpful too. I have a scanner in another city that I was remotely working with but problems with WiFi card not allowing me to see all the traffic on the network so I can see messages to/from real AirScan compatible HP multi function device.Also looking for info on how to identify correctly a SINGLE sheet feeder scanner to OSX, not a flatbed with ADF option .ThanksMark
Replies
1
Boosts
0
Views
2.3k
Activity
Jan ’22
SCSI write(10) command over USB
I'm developing an application in Objective C that works on vendor specific commands of SD cards using IOUSBHostPipe. These vendor SCSI passthrough commands are working fine. But when I try to issue a SCSI write(10) command, it seems to hang. The same implementation when done on Windows seems to be working fine. Is there a limitation to issuing a SCSI write(10) command in macOS? I'm a bit new to the macOS environment and would really appreciate some pointers to references that I can look into or any alternatives to this problem. Thanks in advance. Much appreciated :)
Replies
0
Boosts
0
Views
1.1k
Activity
Dec ’21