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
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
by
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
by
Post not yet marked as solved
0 Replies
188 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
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
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
by
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
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
by
Post not yet marked as solved
0 Replies
281 Views
Добрый день, после перехода на MacOS Montaray, при подключении хаба Canyon, (сам он при этом работает, индикатор подсвечивается, зарядку через него идет) перестали работать USB 2.0 , 3.0 и MicroSD. Ранее на BigSur все было корректно, как теперь работать за ПК? Нужно перекидывать фото с MicroSD, пользоваться флешками и внешними накопителями
Posted
by
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
Post not yet marked as solved
1 Replies
519 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
Post marked as solved
1 Replies
353 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
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
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
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
Post not yet marked as solved
4 Replies
748 Views
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.
Posted
by
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
Post not yet marked as solved
0 Replies
433 Views
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.
Posted
by
Post not yet marked as solved
0 Replies
501 Views
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?
Posted
by
Post not yet marked as solved
0 Replies
397 Views
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.
Posted
by