IOUSBHost

RSS for tag

Create host-mode user space drivers for USB devices using IOUSBHost.

Posts under IOUSBHost tag

79 Posts

Post

Replies

Boosts

Views

Activity

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
USB Live Stream not working in osx 12
Dear Apple Expert, Our project uses libUSB library to interact with a USB based camera device. Our application is working fine in macOS Mojave (10.14.6 ). When the new MacOS 12 beta version was made available, we tested our code. But when we try to claim the interface via "CreateInterfaceIterator" API, we are getting "kIOReturnExclusiveAccess" error code and ultimately our application fails. The failure is observed in both libUSB versions 1.0.23 and 1.0.24. Could you help us by explaining if there is change in the new OS with respect to access to USB devices?
1
0
1.8k
Mar ’22
USB Hub
Good day! Why is it my USB Hub is not working since I upgraded to newer OS? I am using MBA M1. And I just used again just now my USB Hub since I purchased my MBA. Please Apple fix this, because my hub is useless. And I need to use it now because I need usb port. Thanks and have a great day ahead!
0
0
852
Mar ’22
AVCapture with IOKit in macos 12 access fail
I am using AVCatureSession to display the usb camera video. Also using IOUSBInterfaceOpen to open one of the usb interface for access the button interrupt signal. But it return "kIOReturnExclusiveAccess" error in macos 12. I have also tried to use "IOUSBDevice::ReEnumerateDevice" to detach the kernel driver for interface open. But the AVCatureSession will not show the image. Anyway to support both AVCatureSession and IOUSBInterfaceOpen in macos 12?
0
1
851
Mar ’22
USB Audio Mixer Keeps Disappearing
I have connected a USB audio mixer to my iMac, but the machine keeps losing the connection. Specifically, when I look in Sound Preferences. For a solid week, I could hear and use the mic through the mixer without an issue. The mixer showed up as IOUSBHOST. However, this morning the mixer is now showing up in Sound Preferences as JieLi BR17 and it keeps bugging out, i.e., it will show up on the list and then disappear taking my audio I/O for a ride in the process. A major problem when I'm delivering virtual workshops and classes. How do I get my iMac to recognize the mixer using the IOUSBHOST protocol? Frankly, how do I fix this problem. Thanks for any insight and help on this. Fair warning: not a developer but willing to do the learning to get my set up working.
4
0
1.8k
Feb ’22
Hardware developer shenanigans
Hi there, I develop apps for healthcare devices that operate on USB or Bluetooth. Our use cases involve non-invasive glucose monitoring. Since our goal is to reach a massive audience including iOS, Android and Web, we are trying to use a cross platform framework called Flutter. The problem: iOS. Mac supports both web bluetooth and web usb since Chrome is based on Chromium but on iOS chrome is based on WebKit. iOS is the only platform causing an issue, otherwise we're able to target Windows, Linux, Android and Mac perfectly with our tools. Since we are a small team, we cannot afford to hire separate people for developing and maintaining different apps. Some advice or tips of where to take this would be much appreciated.
0
0
1k
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 :)
0
0
898
Dec ’21
USB 2.0 disconnections
iMAC 27 - Big Sur latest Beta Using BT600 ( USB bluetooth dongle of Plantronics). to connect Plantronics 5200 and Plantronics or Voyeger 4220 . Connection between BT600 and Bluetooth headset is frequently getting disconnected. This is not happening with my other laptops. This is also not hardware problem of BT600 as I have tested with two different dongles. The disconnection is less call when BT600 is connected with USB 3.0 port of MAC
1
0
1k
Nov ’21
Перестали обнаруживаться USB и MicroSD
Добрый день, после перехода на MacOS Montaray, при подключении хаба Canyon, (сам он при этом работает, индикатор подсвечивается, зарядку через него идет) перестали работать USB 2.0 , 3.0 и MicroSD. Ранее на BigSur все было корректно, как теперь работать за ПК? Нужно перекидывать фото с MicroSD, пользоваться флешками и внешними накопителями
0
0
551
Nov ’21
app can not be minimized or full screen when running as root user
app can not be minimized or full screen when running as root user, due to macOS12 requests running as root user when an app trying to control usb device, such as the uvc camera controlled through uvc protocol, this is unnecessary before 12. how can i solve this issue, either control the uvc camera through uvc protocol without elevating the app's privilege, or app can be minimized when running as root user.
0
0
764
Nov ’21
Do not Apple Silicon USB-C Port Support Data Transfer via Hub?
I bought Hama USB-C Hub, Multiport, 5 Ports, 2 x USB-A, USB-C, HDMI™, LAN/Ethernet (GTIN: 4047443436818) from Turkey at last month. As I read on both technical specifications and user manual, the USB-C port on device is bi- directional; it both supports PD and data transfer. I tested this functionality both Windows 10 & 11 and macOS with M1 (Apple Silicon) chip. On Windows , the port works bi-directional perfectly. However, Apple Silicon device not support data transfer from port, supports only power delivery. It is a behavior of Apple silicon port management or caused from broken hub ? If I connect a USB-C device from mac port directly, it runs perfectly.
1
0
943
Nov ’21
M1-Macbook needs to restart to recognize USB-HID device.
We developed a C++ application to control our HID USB device, and it seems that the first time we connect our HID USB device to a brand new M1 Macbook, our application cannot detect this device, and we need to restart Macbook to recognize the device. After then, everything is working fine, we can unplug and plug the USB device without restarting Macbook for our application to detect this device. Here is our theory on why a restart is needed to "bootstrap" the device detection: M1 Macbook doesn't come with HID driver included, so the first time a HID device is connected, M1 Macbook need to install HID driver in the background to make it work. -- Can someone confirm this? Or maybe there are other reasons for the need to restart? We are using IOHIDManager from IOKit for the HID operations. Thanks!
0
0
875
Oct ’21
Default USB-C current without USB power delivery negotiation
Hi, We developed a Usb device, and we experience an issue when we tried to use it on a MacBook M1 (Apple Silicon). It seems that the MacBook M1 (and probably other models) advertise a default USB Current mode of 7.5Watt (1.5A@5V). When it also exists a 15 Watt mode (3A@5V). Can someone confirm that we understood correctly ? and is there a way to change the default USB Current to 15 Watt without USB-PD negotiation (we don't have it on our device). Thanks.
0
0
588
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.
4
0
3.9k
Oct ’21
External Accessory: USB endpoints Configuration in iOS
Hi I want to develop an iOS application running on iPAD Pro, which communicates to the custom external accessory which is connected to iPAD over USB interface. The accessory is MFI Compatible. The accessory supports multiple end points "Control, Interrupt, 4 Bulk In & 4 Bulk Out". I need help to understand what are the options in iOS to add support for USB accessory with multiple endpoints.
0
0
756
Sep ’21
Prevent HID Manager from Loading a USB Device
I've done extensive reading on this, but I'm still stumped. I'm trying to call USBInterfaceOpen for a USB Device that I need direct read/write access to, but I get an exclusive access error. There seem to be 2 possibilities here: 1) use the HID interface or 2) do a codeless kext to get to the device before OS X's HID Manager does. So possibility 1 is not going to work, it's not recognized as a storage or network device and nothing is created in the /dev tree that would allow standard POSIX calls. And possibility 2 is not going well. Apple seems to have really locked things down, and I get "Bad code signature" errors when loading trying to load my codeless kext (with just a .plist): Authenticating extension failed: Bad code signature" UserInfo={NSLocalizedDescription=Authenticating extension failed: Kext com.blackrock.cerestim v1.0.0 in codeless kext bundle com.blackrock.cerestim at /private/var/db/KernelExtensionManagement/Staging/com.blackrock.cerestim.ohqHdy/Cerestim.kext: I am really stuck. Is there any simple way of preventing an HID takeover of this device?
0
0
901
Aug ’21
2/@ not working in apple keyboard after updating to big sur
I've recently updated my mac mini 2018 to big sur and I use wired apple keyboard with it but after updating to big sur my keyboard 2 key and the at sign key stopped working now I know my keyboard is fine because I tested it over my older mac mini late 2012 but its not working in big sur. My keyboard input source is U.S and language of mac mini is also U.S still the issue is coming.
0
0
593
Aug ’21
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
USB Live Stream not working in osx 12
Dear Apple Expert, Our project uses libUSB library to interact with a USB based camera device. Our application is working fine in macOS Mojave (10.14.6 ). When the new MacOS 12 beta version was made available, we tested our code. But when we try to claim the interface via "CreateInterfaceIterator" API, we are getting "kIOReturnExclusiveAccess" error code and ultimately our application fails. The failure is observed in both libUSB versions 1.0.23 and 1.0.24. Could you help us by explaining if there is change in the new OS with respect to access to USB devices?
Replies
1
Boosts
0
Views
1.8k
Activity
Mar ’22
USB Hub
Good day! Why is it my USB Hub is not working since I upgraded to newer OS? I am using MBA M1. And I just used again just now my USB Hub since I purchased my MBA. Please Apple fix this, because my hub is useless. And I need to use it now because I need usb port. Thanks and have a great day ahead!
Replies
0
Boosts
0
Views
852
Activity
Mar ’22
AVCapture with IOKit in macos 12 access fail
I am using AVCatureSession to display the usb camera video. Also using IOUSBInterfaceOpen to open one of the usb interface for access the button interrupt signal. But it return "kIOReturnExclusiveAccess" error in macos 12. I have also tried to use "IOUSBDevice::ReEnumerateDevice" to detach the kernel driver for interface open. But the AVCatureSession will not show the image. Anyway to support both AVCatureSession and IOUSBInterfaceOpen in macos 12?
Replies
0
Boosts
1
Views
851
Activity
Mar ’22
USB Audio Mixer Keeps Disappearing
I have connected a USB audio mixer to my iMac, but the machine keeps losing the connection. Specifically, when I look in Sound Preferences. For a solid week, I could hear and use the mic through the mixer without an issue. The mixer showed up as IOUSBHOST. However, this morning the mixer is now showing up in Sound Preferences as JieLi BR17 and it keeps bugging out, i.e., it will show up on the list and then disappear taking my audio I/O for a ride in the process. A major problem when I'm delivering virtual workshops and classes. How do I get my iMac to recognize the mixer using the IOUSBHOST protocol? Frankly, how do I fix this problem. Thanks for any insight and help on this. Fair warning: not a developer but willing to do the learning to get my set up working.
Replies
4
Boosts
0
Views
1.8k
Activity
Feb ’22
Hardware developer shenanigans
Hi there, I develop apps for healthcare devices that operate on USB or Bluetooth. Our use cases involve non-invasive glucose monitoring. Since our goal is to reach a massive audience including iOS, Android and Web, we are trying to use a cross platform framework called Flutter. The problem: iOS. Mac supports both web bluetooth and web usb since Chrome is based on Chromium but on iOS chrome is based on WebKit. iOS is the only platform causing an issue, otherwise we're able to target Windows, Linux, Android and Mac perfectly with our tools. Since we are a small team, we cannot afford to hire separate people for developing and maintaining different apps. Some advice or tips of where to take this would be much appreciated.
Replies
0
Boosts
0
Views
1k
Activity
Dec ’21
iOS APP USB OTG hardware devices communicate
I want to develop an iOS APP that can interact with the hardware of USB OTG, such as sending data to and receiving data from the hardware. The peripheral type is BULK!   I did not find the relevant information on the Internet. Can anyone give me some guidance? thank you very much!
Replies
1
Boosts
0
Views
1.6k
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
898
Activity
Dec ’21
USB 2.0 disconnections
iMAC 27 - Big Sur latest Beta Using BT600 ( USB bluetooth dongle of Plantronics). to connect Plantronics 5200 and Plantronics or Voyeger 4220 . Connection between BT600 and Bluetooth headset is frequently getting disconnected. This is not happening with my other laptops. This is also not hardware problem of BT600 as I have tested with two different dongles. The disconnection is less call when BT600 is connected with USB 3.0 port of MAC
Replies
1
Boosts
0
Views
1k
Activity
Nov ’21
Перестали обнаруживаться USB и MicroSD
Добрый день, после перехода на MacOS Montaray, при подключении хаба Canyon, (сам он при этом работает, индикатор подсвечивается, зарядку через него идет) перестали работать USB 2.0 , 3.0 и MicroSD. Ранее на BigSur все было корректно, как теперь работать за ПК? Нужно перекидывать фото с MicroSD, пользоваться флешками и внешними накопителями
Replies
0
Boosts
0
Views
551
Activity
Nov ’21
app can not be minimized or full screen when running as root user
app can not be minimized or full screen when running as root user, due to macOS12 requests running as root user when an app trying to control usb device, such as the uvc camera controlled through uvc protocol, this is unnecessary before 12. how can i solve this issue, either control the uvc camera through uvc protocol without elevating the app's privilege, or app can be minimized when running as root user.
Replies
0
Boosts
0
Views
764
Activity
Nov ’21
Do not Apple Silicon USB-C Port Support Data Transfer via Hub?
I bought Hama USB-C Hub, Multiport, 5 Ports, 2 x USB-A, USB-C, HDMI™, LAN/Ethernet (GTIN: 4047443436818) from Turkey at last month. As I read on both technical specifications and user manual, the USB-C port on device is bi- directional; it both supports PD and data transfer. I tested this functionality both Windows 10 & 11 and macOS with M1 (Apple Silicon) chip. On Windows , the port works bi-directional perfectly. However, Apple Silicon device not support data transfer from port, supports only power delivery. It is a behavior of Apple silicon port management or caused from broken hub ? If I connect a USB-C device from mac port directly, it runs perfectly.
Replies
1
Boosts
0
Views
943
Activity
Nov ’21
How do I obtain the com.apple.vm.device-access permission
How do I obtain the com.apple.vm.device-access permission。 Error "add com.apple.vm. Device-access" at Entitlement Showing Recent Messages "XXXXX" requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor. ", where to apply?
Replies
1
Boosts
0
Views
1.4k
Activity
Nov ’21
M1-Macbook needs to restart to recognize USB-HID device.
We developed a C++ application to control our HID USB device, and it seems that the first time we connect our HID USB device to a brand new M1 Macbook, our application cannot detect this device, and we need to restart Macbook to recognize the device. After then, everything is working fine, we can unplug and plug the USB device without restarting Macbook for our application to detect this device. Here is our theory on why a restart is needed to "bootstrap" the device detection: M1 Macbook doesn't come with HID driver included, so the first time a HID device is connected, M1 Macbook need to install HID driver in the background to make it work. -- Can someone confirm this? Or maybe there are other reasons for the need to restart? We are using IOHIDManager from IOKit for the HID operations. Thanks!
Replies
0
Boosts
0
Views
875
Activity
Oct ’21
Default USB-C current without USB power delivery negotiation
Hi, We developed a Usb device, and we experience an issue when we tried to use it on a MacBook M1 (Apple Silicon). It seems that the MacBook M1 (and probably other models) advertise a default USB Current mode of 7.5Watt (1.5A@5V). When it also exists a 15 Watt mode (3A@5V). Can someone confirm that we understood correctly ? and is there a way to change the default USB Current to 15 Watt without USB-PD negotiation (we don't have it on our device). Thanks.
Replies
0
Boosts
0
Views
588
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
3.9k
Activity
Oct ’21
External Accessory: USB endpoints Configuration in iOS
Hi I want to develop an iOS application running on iPAD Pro, which communicates to the custom external accessory which is connected to iPAD over USB interface. The accessory is MFI Compatible. The accessory supports multiple end points "Control, Interrupt, 4 Bulk In & 4 Bulk Out". I need help to understand what are the options in iOS to add support for USB accessory with multiple endpoints.
Replies
0
Boosts
0
Views
756
Activity
Sep ’21
Prevent HID Manager from Loading a USB Device
I've done extensive reading on this, but I'm still stumped. I'm trying to call USBInterfaceOpen for a USB Device that I need direct read/write access to, but I get an exclusive access error. There seem to be 2 possibilities here: 1) use the HID interface or 2) do a codeless kext to get to the device before OS X's HID Manager does. So possibility 1 is not going to work, it's not recognized as a storage or network device and nothing is created in the /dev tree that would allow standard POSIX calls. And possibility 2 is not going well. Apple seems to have really locked things down, and I get "Bad code signature" errors when loading trying to load my codeless kext (with just a .plist): Authenticating extension failed: Bad code signature" UserInfo={NSLocalizedDescription=Authenticating extension failed: Kext com.blackrock.cerestim v1.0.0 in codeless kext bundle com.blackrock.cerestim at /private/var/db/KernelExtensionManagement/Staging/com.blackrock.cerestim.ohqHdy/Cerestim.kext: I am really stuck. Is there any simple way of preventing an HID takeover of this device?
Replies
0
Boosts
0
Views
901
Activity
Aug ’21
2/@ not working in apple keyboard after updating to big sur
I've recently updated my mac mini 2018 to big sur and I use wired apple keyboard with it but after updating to big sur my keyboard 2 key and the at sign key stopped working now I know my keyboard is fine because I tested it over my older mac mini late 2012 but its not working in big sur. My keyboard input source is U.S and language of mac mini is also U.S still the issue is coming.
Replies
0
Boosts
0
Views
593
Activity
Aug ’21