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

Posts under IOKit tag

200 Posts

Post

Replies

Boosts

Views

Activity

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
795
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
841
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
6k
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
877
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
741
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
944
Dec ’21
ProductID and VendorID (ICCD)
We are a company that produces SmartCard readers and cryptographic tokens. When we started testing our devices on macOS, we realized that it is necessary to add our products to the macOS ICCD driver, so that the operating system will recognize our devices natively. We believe there is a list with information about manufacturers (name, VendorID, ProductID) and we would like to add data from our company so that our devices are recognized as trusted by the macOS operating system. If anyone knows the correct process for this, please let us know.
1
0
931
Nov ’21
Getting USB device properties on iOS
Hi,I'm working with USB Midi devices on iOS apps, and I'm currently looking for a way to identifiy them.I know for a fact that getting the different MIDI properties with CoreMIDI API is not sufficiently reliable, as some devices return only generic information like "USB MIDI DEVICE" but are nonetheless recognized by other apps.After some research, it appears that the the best solution is to get the USB-ID of the device (VID-PID : vendor ID and product ID). My question is the following : How can I get the USBID of a USB MIDI device on iOS? The IOKit API is not available on iOS, so what is the solution to access USB devices on iOS?Thank you all for the attention,Best,Thomas
2
0
3.1k
Nov ’21
Unable to get USB bsdname from macOS Monterey 12 Bate4 of Intel processor
I can’t get USB bsdname from macOS Monterey 12 Bate4 of Intel processor: I have use the "IORegistryEntrySearchCFProperty" function to get the bsdName of the io_service_t, It worked fine on macOS Big Sur's M1 and Intel MBP. Also it worked fine on macOS Monterey App M1. But it always returned nil on macOS Monterey Intel MBP. It involves the following code: void getBsdName(io_service_t usbDevice) { CFStringRef bsdName = NULL;         for(int i = 0; i &lt; 500; i++)         {             bsdName = (CFStringRef)IORegistryEntrySearchCFProperty(usbDevice,                                                                    kIOServicePlane,                                                                    CFSTR( kIOBSDNameKey ),                                                                    kCFAllocatorDefault,                                                                    kIORegistryIterateRecursively );             if(!bsdName) {                 // If don't get a bsd name, keep waiting in 5s.                 usleep(10000);                 continue;             }                          printf("[%s]: Found bsd name for device %d.\n”, __func__, usbDevice);             break;         } } Why it happened? Or is there another way to get it?
5
0
2.2k
Nov ’21
How to send SCSI commands to the Usb mass storage device?
I need your help. Now I need to send SCSI commands to the Usb mass storage device, I referred to https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/WorkingWithSAM/WWS_SAMDevInt/WWS_SAM_DevInt.html url, but it didn't work. I can't get scsitaskdeviceinterface       I think my device type is $00, do we need to develop and provide a custom kernel driver? If needn't, why can't I access the device through the scsitaskdevice interface?          I am using macOS Big Sur 11.2.3 and Xcode 12.5.
1
0
1.2k
Nov ’21
Fetch device and baterry information from device?
I'm working on ios app with iot, i have following questions regarding: I want to fetch "Battery Temp, Voltage, Current, Percentage, Charging State, Battery Capacity, Charging count, Incoming Calls, UUID, Phone Model, Phone Manufacture in Swift? We have class in objective c - UIDeviceListener, But its comes under IOKit framwork - if you want to submit an app using IOKit framework is risky because I red Apple may not allow that, Then Swift has UIDevice, but its providing limited information, what is alternate solution or workaround for this?
2
0
908
Nov ’21
IOKit: Retrieving USB Name, Vendor ID and Product ID after Serial Connection.
Firstly let me start by saying I'm totally new to using IOKit and fairly new to Swift. That said, I've successfully managed to detect the insertion and removal of my USB serial device in my Swift, MacOS app. Therefore calling ls /dev/tty.* lists the same devices as via the IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, IOServiceMatching("IOSerialBSDClient"), matchingCallback, selfPtr, &matchedIterator) call inside the resulting callback. This is a great start. As you can imagine telling the user you've found "/dev/tty.usbmodem[some number]" isn't particularly user friendly. So once I retrieve the IODialinDevice property from the aforementioned callback is there a way for me to lookup the USB device's Vendor ID and Product ID and ideally retrieve the human readable name for said USB device, so I can then expose that to the User? Thanks.
4
0
4.0k
Oct ’21
IOKit is marked as Mac Catalyst 13.0+ compatible yet I'm unable to import it into my Swift iOS app
I'm currently working with IOKit on Mac (I'm new to it, but managed to get a Serial USB demo working) and noticed that it says that IOKit is Mac Catalyst 13.0+ compatible. But when I import IOKit into my iOS Swift project. I'm getting a No such module 'IOKit' error. Do I have to manually add this framework? I read somewhere that IOKit access may not be possible on iOS/iPad devices, if I released my app on the App Store, but what about internal home or company iOS devices, that won't ever be released on the App Store?? Thanks.
3
0
1.6k
Oct ’21
IOKIT Detecting BSD(unix) name for USB Serial Device with PID and VID
I am working with USB serial devices on macOS.How can I detect BSD(unix) name have for my USB Serial device on macOS using IOKit?I want to get device name like : "IODialinDevice" = "/dev/tty.usbmodemMyDeviceName"My USB device is USB serial COM port.Also I want to detect when device was attached to machine.I can detect when new USB device with my VID and PID was connected.This code allows me to do it CFMutableDictionaryRef keywordDict = IOServiceMatching(kIOSerialBSDServiceValue); kern_return_t result = IOServiceGetMatchingServices(kIOMasterPortDefault, keywordDict, &amp;iterator); while ((port = IOIteratorNext(iterator))) { io_object_t parent = 0; io_object_t current_device = port; while (KERN_SUCCESS == IORegistryEntryGetParentEntry(current_device, kIOServicePlane, &amp;parent)) { CFTypeRef vendor_Id = IORegistryEntryCreateCFProperty(parent, CFSTR(kUSBVendorID), kCFAllocatorDefault, 0); CFTypeRef pr_Id = IORegistryEntryCreateCFProperty(parent, CFSTR(kUSBProductID), kCFAllocatorDefault, 0); if((vendor_id==MY_VENDOR_ID) &amp;&amp; (pr_ID==MY_PRODUCT_ID)) { // MY SERIAL DEVICE DETECTED !! CFTypeRef deviceName = IORegistryEntryCreateCFProperty(device, key, CFSTR(kIOTTYDeviceKey), 0); CFTypeRef callOutDevice = IORegistryEntryCreateCFProperty(device, key, CFSTR(kIOCalloutDeviceKey), 0); CFTypeRef dialInDevice = IORegistryEntryCreateCFProperty(device, key, CFSTR(kIODialinDeviceKey), 0); } } }But the problem that this code not allows me to detect the new device.I just enumerate existing kIOSerialBSDServiceValue devices here and then I check parents VID and PIDIf parent have MY_VID and MY_PID I assume that I have found correct serial device.Another code allows me to detect new USB deviceThis is Apple example LUSBPrivateDataSample.cI can detect my device using VID and PID with the following code int main() { ... ... ... // Create a CFNumber for the idVendor and set the value in the dictionary numberRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &amp;usbVendor); CFDictionarySetValue(matchingDict, CFSTR(kUSBVendorID), numberRef); CFRelease(numberRef); // Create a CFNumber for the idProduct and set the value in the dictionary numberRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &amp;usbProduct); CFDictionarySetValue(matchingDict, CFSTR(kUSBProductID), numberRef); CFRelease(numberRef); ... ... ... // Now set up a notification to be called when a device is first matched by I/O Kit. kr = IOServiceAddMatchingNotification(gNotifyPort, // notifyPort kIOFirstMatchNotification, // notificationType matchingDict, // matching DeviceAdded, // callback NULL, // refCon &amp;gAddedIter // notification ); } void DeviceAdded(void *refCon, io_iterator_t iterator) { io_service_t usbDevice; while ((usbDevice = IOIteratorNext(iterator))) { // I have device here but I can't get IODialinDevice device name } }The problem with this code that I can't get IODialinDevice device nameI have also checked all child nodes for this usbDevice.None of them contain IODialinDevice property or none of them is kIOSerialBSDServiceValue device.Looks like I am doing it wrong.Looks like serial devices and USB live in different IOKit registry branches.The question is how can go from USB device identified by VID and PID to serial device (kIOSerialBSDServiceValue) with IODialinDevice ("/dev/tty.usbmodemMyDeviceName") property .This is part of my ioreg tree: I can detect CDC ACM Data device in my application. (top device in this tree)In ioreg I see this picture.So there are children, AppleUSBACMData and IOSerialBSDClient who has IODialinDevice property.But I can't detect AppleUSBACMData and IOSerialBSDClient in my application .Probably because AppleUSBACMData and IOSerialBSDClient are not devices, but USB Interfaces or USB Endpoints.So this is my problem. +-o CDC ACM Data@3 | { | "USBPortType" = 0 | "IOCFPlugInTypes" = {"2d9786c6-9ef3-11d4-ad51-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"} | "Product Name" = "DevName" | "bcdDevice" = 1044 | "USBSpeed" = 3 | "idProduct" = 260 | "bConfigurationValue" = 1 | "bInterfaceSubClass" = 0 | "locationID" = 338886656 | "IOGeneralInterest" = "IOCommand is not serializable" | "IOServiceLegacyMatchingRegistryID" = 4295561221 | "IOClassNameOverride" = "IOUSBInterface" | "AppleUSBAlternateServiceRegistryID" = 4295561221 | "idVendor" = 7777 | "bInterfaceProtocol" = 0 | "bAlternateSetting" = 0 | "bInterfaceNumber" = 3 | "bInterfaceClass" = 10 | } | +-o AppleUSBACMData | { | "IOClass" = "AppleUSBACMData" | "CFBundleIdentifier" = "com.apple.driver.usb.cdc.acm" | "IOProviderClass" = "IOUSBHostInterface" | "IOTTYBaseName" = "usbmodem" | "idProduct" = 260 | "IOProbeScore" = 49999 | "bInterfaceSubClass" = 0 | "HiddenPort" = Yes | "IOMatchCategory" = "IODefaultMatchCategory" | "idVendor" = 7777 | "IOTTYSuffix" = "DevName_B3" | "bInterfaceClass" = 10 | } | +-o IOSerialBSDClient { "IOClass" = "IOSerialBSDClient" "CFBundleIdentifier" = "com.apple.iokit.IOSerialFamily" "IOProviderClass" = "IOSerialStreamSync" "IOTTYBaseName" = "usbmodem" "IOSerialBSDClientType" = "IORS232SerialStream" "IOProbeScore" = 1000 "IOCalloutDevice" = "/dev/cu.usbmodemDevName_B3" "IODialinDevice" = "/dev/tty.usbmodemDevName_B3" "IOMatchCategory" = "IODefaultMatchCategory" "IOTTYDevice" = "usbmodemDevName_B3" "IOResourceMatch" = "IOBSD" "IOTTYSuffix" = "DevName_B3" }Any help appreciated!
3
0
3.9k
Oct ’21
IOKit hid input stopped working in Big Sur
I have a digital multimeter that logs data to computer through USB serial. After upgrade to Big Sur it suddenly stopped working. IOKit properly detects device connect/disconnect and HID reports are coming in, but with no data. HID report contains nothing but zeroes... I'm stuck and in need of help. Have anything changed in IOKit.hid interface between 10.15 and 11?
1
0
742
Oct ’21
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
795
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
841
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
6k
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
877
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
741
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
Detecting if Mac has a backlit keyboard
It’s quite easy to detect if Mac has an illuminated keyboard with ioreg at the command line… ioreg -c IOResources -d 3 | grep '"KeyboardBacklight" =' | sed 's/^.*= //g' …But how can I programmatically get this IOKit boolean property using the latest Swift? I’m looking for some sample code.
Replies
2
Boosts
0
Views
1.1k
Activity
Dec ’21
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
944
Activity
Dec ’21
Detecting the layout of an internal Apple hardware keyboard
Is there an API or a method for detecting which of the three main keyboard layouts – ANSI, ISO, or Japanese – a Mac notebook uses? After fairly extensive research, I could not find any information about this.
Replies
2
Boosts
0
Views
1.1k
Activity
Nov ’21
ProductID and VendorID (ICCD)
We are a company that produces SmartCard readers and cryptographic tokens. When we started testing our devices on macOS, we realized that it is necessary to add our products to the macOS ICCD driver, so that the operating system will recognize our devices natively. We believe there is a list with information about manufacturers (name, VendorID, ProductID) and we would like to add data from our company so that our devices are recognized as trusted by the macOS operating system. If anyone knows the correct process for this, please let us know.
Replies
1
Boosts
0
Views
931
Activity
Nov ’21
Getting USB device properties on iOS
Hi,I'm working with USB Midi devices on iOS apps, and I'm currently looking for a way to identifiy them.I know for a fact that getting the different MIDI properties with CoreMIDI API is not sufficiently reliable, as some devices return only generic information like "USB MIDI DEVICE" but are nonetheless recognized by other apps.After some research, it appears that the the best solution is to get the USB-ID of the device (VID-PID : vendor ID and product ID). My question is the following : How can I get the USBID of a USB MIDI device on iOS? The IOKit API is not available on iOS, so what is the solution to access USB devices on iOS?Thank you all for the attention,Best,Thomas
Replies
2
Boosts
0
Views
3.1k
Activity
Nov ’21
Unable to get USB bsdname from macOS Monterey 12 Bate4 of Intel processor
I can’t get USB bsdname from macOS Monterey 12 Bate4 of Intel processor: I have use the "IORegistryEntrySearchCFProperty" function to get the bsdName of the io_service_t, It worked fine on macOS Big Sur's M1 and Intel MBP. Also it worked fine on macOS Monterey App M1. But it always returned nil on macOS Monterey Intel MBP. It involves the following code: void getBsdName(io_service_t usbDevice) { CFStringRef bsdName = NULL;         for(int i = 0; i &lt; 500; i++)         {             bsdName = (CFStringRef)IORegistryEntrySearchCFProperty(usbDevice,                                                                    kIOServicePlane,                                                                    CFSTR( kIOBSDNameKey ),                                                                    kCFAllocatorDefault,                                                                    kIORegistryIterateRecursively );             if(!bsdName) {                 // If don't get a bsd name, keep waiting in 5s.                 usleep(10000);                 continue;             }                          printf("[%s]: Found bsd name for device %d.\n”, __func__, usbDevice);             break;         } } Why it happened? Or is there another way to get it?
Replies
5
Boosts
0
Views
2.2k
Activity
Nov ’21
How to send SCSI commands to the Usb mass storage device?
I need your help. Now I need to send SCSI commands to the Usb mass storage device, I referred to https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/WorkingWithSAM/WWS_SAMDevInt/WWS_SAM_DevInt.html url, but it didn't work. I can't get scsitaskdeviceinterface       I think my device type is $00, do we need to develop and provide a custom kernel driver? If needn't, why can't I access the device through the scsitaskdevice interface?          I am using macOS Big Sur 11.2.3 and Xcode 12.5.
Replies
1
Boosts
0
Views
1.2k
Activity
Nov ’21
Fetch device and baterry information from device?
I'm working on ios app with iot, i have following questions regarding: I want to fetch "Battery Temp, Voltage, Current, Percentage, Charging State, Battery Capacity, Charging count, Incoming Calls, UUID, Phone Model, Phone Manufacture in Swift? We have class in objective c - UIDeviceListener, But its comes under IOKit framwork - if you want to submit an app using IOKit framework is risky because I red Apple may not allow that, Then Swift has UIDevice, but its providing limited information, what is alternate solution or workaround for this?
Replies
2
Boosts
0
Views
908
Activity
Nov ’21
Tiled display topology support?
I would love the ability to enable Tiled display topology as shown in the latest Oct 20th event. 46min and 19sec in.
Replies
0
Boosts
0
Views
700
Activity
Oct ’21
IOKit: Retrieving USB Name, Vendor ID and Product ID after Serial Connection.
Firstly let me start by saying I'm totally new to using IOKit and fairly new to Swift. That said, I've successfully managed to detect the insertion and removal of my USB serial device in my Swift, MacOS app. Therefore calling ls /dev/tty.* lists the same devices as via the IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, IOServiceMatching("IOSerialBSDClient"), matchingCallback, selfPtr, &matchedIterator) call inside the resulting callback. This is a great start. As you can imagine telling the user you've found "/dev/tty.usbmodem[some number]" isn't particularly user friendly. So once I retrieve the IODialinDevice property from the aforementioned callback is there a way for me to lookup the USB device's Vendor ID and Product ID and ideally retrieve the human readable name for said USB device, so I can then expose that to the User? Thanks.
Replies
4
Boosts
0
Views
4.0k
Activity
Oct ’21
IOKit is marked as Mac Catalyst 13.0+ compatible yet I'm unable to import it into my Swift iOS app
I'm currently working with IOKit on Mac (I'm new to it, but managed to get a Serial USB demo working) and noticed that it says that IOKit is Mac Catalyst 13.0+ compatible. But when I import IOKit into my iOS Swift project. I'm getting a No such module 'IOKit' error. Do I have to manually add this framework? I read somewhere that IOKit access may not be possible on iOS/iPad devices, if I released my app on the App Store, but what about internal home or company iOS devices, that won't ever be released on the App Store?? Thanks.
Replies
3
Boosts
0
Views
1.6k
Activity
Oct ’21
IOKIT Detecting BSD(unix) name for USB Serial Device with PID and VID
I am working with USB serial devices on macOS.How can I detect BSD(unix) name have for my USB Serial device on macOS using IOKit?I want to get device name like : "IODialinDevice" = "/dev/tty.usbmodemMyDeviceName"My USB device is USB serial COM port.Also I want to detect when device was attached to machine.I can detect when new USB device with my VID and PID was connected.This code allows me to do it CFMutableDictionaryRef keywordDict = IOServiceMatching(kIOSerialBSDServiceValue); kern_return_t result = IOServiceGetMatchingServices(kIOMasterPortDefault, keywordDict, &amp;iterator); while ((port = IOIteratorNext(iterator))) { io_object_t parent = 0; io_object_t current_device = port; while (KERN_SUCCESS == IORegistryEntryGetParentEntry(current_device, kIOServicePlane, &amp;parent)) { CFTypeRef vendor_Id = IORegistryEntryCreateCFProperty(parent, CFSTR(kUSBVendorID), kCFAllocatorDefault, 0); CFTypeRef pr_Id = IORegistryEntryCreateCFProperty(parent, CFSTR(kUSBProductID), kCFAllocatorDefault, 0); if((vendor_id==MY_VENDOR_ID) &amp;&amp; (pr_ID==MY_PRODUCT_ID)) { // MY SERIAL DEVICE DETECTED !! CFTypeRef deviceName = IORegistryEntryCreateCFProperty(device, key, CFSTR(kIOTTYDeviceKey), 0); CFTypeRef callOutDevice = IORegistryEntryCreateCFProperty(device, key, CFSTR(kIOCalloutDeviceKey), 0); CFTypeRef dialInDevice = IORegistryEntryCreateCFProperty(device, key, CFSTR(kIODialinDeviceKey), 0); } } }But the problem that this code not allows me to detect the new device.I just enumerate existing kIOSerialBSDServiceValue devices here and then I check parents VID and PIDIf parent have MY_VID and MY_PID I assume that I have found correct serial device.Another code allows me to detect new USB deviceThis is Apple example LUSBPrivateDataSample.cI can detect my device using VID and PID with the following code int main() { ... ... ... // Create a CFNumber for the idVendor and set the value in the dictionary numberRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &amp;usbVendor); CFDictionarySetValue(matchingDict, CFSTR(kUSBVendorID), numberRef); CFRelease(numberRef); // Create a CFNumber for the idProduct and set the value in the dictionary numberRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &amp;usbProduct); CFDictionarySetValue(matchingDict, CFSTR(kUSBProductID), numberRef); CFRelease(numberRef); ... ... ... // Now set up a notification to be called when a device is first matched by I/O Kit. kr = IOServiceAddMatchingNotification(gNotifyPort, // notifyPort kIOFirstMatchNotification, // notificationType matchingDict, // matching DeviceAdded, // callback NULL, // refCon &amp;gAddedIter // notification ); } void DeviceAdded(void *refCon, io_iterator_t iterator) { io_service_t usbDevice; while ((usbDevice = IOIteratorNext(iterator))) { // I have device here but I can't get IODialinDevice device name } }The problem with this code that I can't get IODialinDevice device nameI have also checked all child nodes for this usbDevice.None of them contain IODialinDevice property or none of them is kIOSerialBSDServiceValue device.Looks like I am doing it wrong.Looks like serial devices and USB live in different IOKit registry branches.The question is how can go from USB device identified by VID and PID to serial device (kIOSerialBSDServiceValue) with IODialinDevice ("/dev/tty.usbmodemMyDeviceName") property .This is part of my ioreg tree: I can detect CDC ACM Data device in my application. (top device in this tree)In ioreg I see this picture.So there are children, AppleUSBACMData and IOSerialBSDClient who has IODialinDevice property.But I can't detect AppleUSBACMData and IOSerialBSDClient in my application .Probably because AppleUSBACMData and IOSerialBSDClient are not devices, but USB Interfaces or USB Endpoints.So this is my problem. +-o CDC ACM Data@3 | { | "USBPortType" = 0 | "IOCFPlugInTypes" = {"2d9786c6-9ef3-11d4-ad51-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"} | "Product Name" = "DevName" | "bcdDevice" = 1044 | "USBSpeed" = 3 | "idProduct" = 260 | "bConfigurationValue" = 1 | "bInterfaceSubClass" = 0 | "locationID" = 338886656 | "IOGeneralInterest" = "IOCommand is not serializable" | "IOServiceLegacyMatchingRegistryID" = 4295561221 | "IOClassNameOverride" = "IOUSBInterface" | "AppleUSBAlternateServiceRegistryID" = 4295561221 | "idVendor" = 7777 | "bInterfaceProtocol" = 0 | "bAlternateSetting" = 0 | "bInterfaceNumber" = 3 | "bInterfaceClass" = 10 | } | +-o AppleUSBACMData | { | "IOClass" = "AppleUSBACMData" | "CFBundleIdentifier" = "com.apple.driver.usb.cdc.acm" | "IOProviderClass" = "IOUSBHostInterface" | "IOTTYBaseName" = "usbmodem" | "idProduct" = 260 | "IOProbeScore" = 49999 | "bInterfaceSubClass" = 0 | "HiddenPort" = Yes | "IOMatchCategory" = "IODefaultMatchCategory" | "idVendor" = 7777 | "IOTTYSuffix" = "DevName_B3" | "bInterfaceClass" = 10 | } | +-o IOSerialBSDClient { "IOClass" = "IOSerialBSDClient" "CFBundleIdentifier" = "com.apple.iokit.IOSerialFamily" "IOProviderClass" = "IOSerialStreamSync" "IOTTYBaseName" = "usbmodem" "IOSerialBSDClientType" = "IORS232SerialStream" "IOProbeScore" = 1000 "IOCalloutDevice" = "/dev/cu.usbmodemDevName_B3" "IODialinDevice" = "/dev/tty.usbmodemDevName_B3" "IOMatchCategory" = "IODefaultMatchCategory" "IOTTYDevice" = "usbmodemDevName_B3" "IOResourceMatch" = "IOBSD" "IOTTYSuffix" = "DevName_B3" }Any help appreciated!
Replies
3
Boosts
0
Views
3.9k
Activity
Oct ’21
How to send the SCSI command to the USB Mass Storage Driver with IOKit?
Hi, I need help Now I need to send SCSI commands to Usb Mass Storage Driver, but i can't find a good solution. Does anyone have a solution?
Replies
1
Boosts
0
Views
1.1k
Activity
Oct ’21
IOKit hid input stopped working in Big Sur
I have a digital multimeter that logs data to computer through USB serial. After upgrade to Big Sur it suddenly stopped working. IOKit properly detects device connect/disconnect and HID reports are coming in, but with no data. HID report contains nothing but zeroes... I'm stuck and in need of help. Have anything changed in IOKit.hid interface between 10.15 and 11?
Replies
1
Boosts
0
Views
742
Activity
Oct ’21