IOUSBHost

RSS for tag

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

IOUSBHost Documentation

Posts under IOUSBHost tag

24 Posts
Sort by:
Post not yet marked as solved
0 Replies
18 Views
Hi . All We try to connect the USB UAC1.0 device to computer or andriod phone , is work well . the we try to connect to iphone or ipad use "Lightning to USB adapter “,it can find device then play the audio but the audio stream is not continuous. can you tell my iphone or ipad support usb uac1.0 or uac2.0 device ? Thank you! Isaac
Posted
by maggie68.
Last updated
.
Post not yet marked as solved
3 Replies
413 Views
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)     } }
Posted Last updated
.
Post not yet marked as solved
3 Replies
856 Views
I have a command line tool and am trying to connect to a USB device using:    _device = [[IOUSBHostDevice alloc] initWithIOService:_service    options:IOUSBHostObjectInitOptionsDeviceCapture    queue:_queue    error:&error    interestHandler:^(IOUSBHostObject * _Nonnull hostObject, uint32_t messageType, void * _Nullable messageArgument) {     NSLog(@"Interest handler...");    }]; However, when I run this tool (even under sudo), I'm hitting the error: Error:Unable to open io\_service\_t object and create user client. with reason: Exclusive open of usb object failed. The documentation for IOUSBHostObjectInitOptionsDeviceCapture implies that using this option and having root privilege should gain exclusive access to the device. The alternative is to use an entitlement, but the executable is terminated immediately in that case probably due to code signing. I would have expected that running the tool under sudo would have been sufficient to avoid this issue. I just want to first get things working locally on my Mac for a proof of concept, so I don't really want to deal with code signing up front unless that is absolutely necessary. What do I need to do to get exclusive access to the USB device? Thanks in advance.
Posted
by tompmtv.
Last updated
.
Post not yet marked as solved
1 Replies
215 Views
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; }
Posted Last updated
.
Post not yet marked as solved
0 Replies
667 Views
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?
Posted
by Akshit04.
Last updated
.
Post not yet marked as solved
0 Replies
189 Views
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!
Posted
by set23.
Last updated
.
Post not yet marked as solved
0 Replies
270 Views
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?
Posted
by keithz.
Last updated
.
Post not yet marked as solved
0 Replies
346 Views
Hello We have a USB camera. My Mac can recognize it and we can get frames with any software. There is a physical button on it and the vendor says the camera is UVC-compliant. But button doesn't work anyway. I captured some USB traffic data and saw that it has two interfaces. One for streaming and other one for interrupting (like button click). I read UVC 1.5 standards to understand it and it is working like written in UVC 1.5. So, I can get a data with an interrupt transfer when clicking the button. I checked these two interfaces, they use UVCAssistant for driver(System Extension). I tried to use libusb, I can get data from button click. But for frames I had to use libuvc, but it wasn't work for my camera (I think it is related with USB descriptor parsing in libuvc). I thought that I should write a driver for single interface and so second interface will use same UVC assistant driver and first interface will use my driver. I wrote a driver and it matches with first interface. But second interface is empty (unhandled by any driver). I want to load UVCAssistant for second interface of USB port. How can I do this? Output before loading my driver After loading: IOKitPersonalities that I used:
Posted Last updated
.
Post not yet marked as solved
79 Replies
38k Views
For whatever reason, my Razer Huntsman keyboard does work for the most part but none of the audio controls do anything on the keyboard. In addition, I've tried two different razer mice and neither work at all. Everything worked perfectly before the beta.
Posted
by Sashimi.
Last updated
.
Post not yet marked as solved
0 Replies
676 Views
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.
Posted
by JoyBig.
Last updated
.
Post not yet marked as solved
0 Replies
283 Views
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.
Posted
by realrk95.
Last updated
.
Post not yet marked as solved
1 Replies
520 Views
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!
Posted
by GolfyX.
Last updated
.
Post not yet marked as solved
0 Replies
340 Views
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 :)
Posted Last updated
.
Post not yet marked as solved
1 Replies
621 Views
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
Posted Last updated
.
Post not yet marked as solved
0 Replies
281 Views
Добрый день, после перехода на MacOS Montaray, при подключении хаба Canyon, (сам он при этом работает, индикатор подсвечивается, зарядку через него идет) перестали работать USB 2.0 , 3.0 и MicroSD. Ранее на BigSur все было корректно, как теперь работать за ПК? Нужно перекидывать фото с MicroSD, пользоваться флешками и внешними накопителями
Posted
by barik.
Last updated
.
Post not yet marked as solved
0 Replies
345 Views
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.
Posted
by isalin.
Last updated
.
Post marked as solved
1 Replies
354 Views
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.
Posted
by berkbb.
Last updated
.
Post not yet marked as solved
1 Replies
414 Views
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?
Posted
by michen.
Last updated
.
Post not yet marked as solved
0 Replies
320 Views
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!
Posted
by tzdevguy.
Last updated
.
Post not yet marked as solved
0 Replies
289 Views
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.
Posted
by brtrd.
Last updated
.