|
From: RisingEdgeIndustries <su...@ri...> - 2023-07-13 02:03:29
|
So I'm taking the same approach I take when I had these interfaces running as stand alone devices. My process is below. Call get_device_list() Loop through device list to find VID/PID Once found open_device() with my VID/PID [at this point I get string descriptors and max_packet_size() which works fin] I then execute claim_interface() for my device I can claim interface 0, but when I try interface 1 I get the following error: ERROR: failed to claim interface, ret val = -12 ERROR: code - b'Operation not supported or unimplemented on this platform' I know from the descriptors during enumeration my second interface is my bulk interface with bInterfaceNumber "1". I see both interfaces with correct VID/PID in device manager with correct drivers and no icons indicating a problem. Is there something obvious I'm missing in this process? This process works fine for non-composite HID only or bulk only. *Descriptor data:* ----- Device Descriptor ----- 12 bLength 01 bDesc Type 00 02 bcdUSB (LSB, MSB) 00 bDeviceClass 00 bDeviceSubClass 00 bDeviceProtocol 40 bMaxPacketSize0 - Maximum packet size for Endpoint zero (only 8, 16, 32, or 64 are valid). BF 1C idVendor (LSB, MSB) 07 00 idProduct (LSB, MSB) 00 01 bcdDevice (BCD) (LSB, MSB) 01 iManufacturer (string index) 02 iProduct (string index) 03 iSerialNumber (string index) 01 bNumConfigurations (string index) ----- Configuration Descriptor ----- 09 bLength 02 bDesc Type 40 00 wTotalLen (LSB, MSB) 02 bNumInterfaces 01 bConfigurationValue 00 iConfiguration 80 bmAttributes 7D bmAttributes ----- Interface Descriptor ----- 09 bLength 04 bDesc Type 00 bInterfaceNumber 00 bAlternateSetting 02 bNumEndpoints 03 bInterfaceClass 00 bInterfaceClass 00 bInterfaceProtocol 00 iInterface ----- HID Class Descriptor ----- 09 bLength 21 bDesc Type 00 02 bcdHID (Hid Spec Release Number) (LSB, MSB) 00 bCountryCode (Country code (0x00 for not supported)) 01 bNumDescriptors (Number of class descriptors) 22 bDescriptorType (Report descriptor type) 20 00 bDescriptorLength (Report descriptor type) (LSB, MSB) ----- Endpoint Descriptor ----- 07 bLength 05 bDesc Type 81 bEndpointAddress 03 bmAttributes 40 00 wMaxPacketSize (LSB, MSB) 01 bInterval ----- Endpoint Descriptor ----- 07 bLength 05 bDesc Type 01 bEndpointAddress 03 bmAttributes 40 00 wMaxPacketSize (LSB, MSB) 01 bInterval ----- Interface Descriptor ----- 09 bLength 04 bDesc Type 01 bInterfaceNumber 00 bAlternateSetting 02 bNumEndpoints FF bInterfaceClass 00 bInterfaceClass 00 bInterfaceProtocol 00 iInterface ----- Endpoint Descriptor ----- 07 bLength 05 bDesc Type 82 bEndpointAddress 02 bmAttributes 40 00 wMaxPacketSize (LSB, MSB) 00 bInterval ----- Endpoint Descriptor ----- 07 bLength 05 bDesc Type 02 bEndpointAddress 02 bmAttributes 40 00 wMaxPacketSize (LSB, MSB) 00 bInterval On Wed, Jul 12, 2023 at 8:35 PM Xiaofan Chen <xia...@gm...> wrote: > There is no limitation for your use case. Open the device normally and > claim the > correct interface (interface 1 in your case). > > libusb_detach_kernel_driver() is not supported under Windows so it is > not relevant. > > The limitations are mainly with things like IAD and CDC-ACM, not your use > case. > 1) https://github.com/libusb/libusb/pull/965 (PR merged, it will be in > future 1.0.27 release) > 2) https://github.com/libusb/libusb/issues/1238 > > Best regards, > Xiaofan > > > On Thu, Jul 13, 2023 at 9:16 AM RisingEdgeIndustries > <su...@ri...> wrote: > > > > Hello, > > > > I've been reading quite a bit of posts online about libusb and composite > devices and the challenge due to windows assigning usbccgp.sys which acts > as a "parent" driver with the individual interfaces appearing as separate > devices. I have a basic example to better understand libusb1.0 consisting > of the following: > > > > USB Composite device -- default windows usbccgp.sys driver > > Interface 0 - HID interface with Windows HID driver auto loaded > > Interface 1 - custom bulk interface with WINUSB driver > > > > I've managed to get my descriptors straightened out to auto load the > drivers I need and I assumed I could just use libusb's claim_interface() > call to choose between my HID or bulk interface. I now see that (I think) > this is not the intended use because the parent driver seems to cause > problems. So I'm wondering if someone could clarify the correct approach > to connect and transfer data for a composite device on Windows 10 in this > situation with two interfaces. > > > > 1. What is the intended implementation in a situation like this? > > 2. Since both the HID and bulk interfaces show up as devices (in > windows) with the same VID/PID how should one connect to a specific one? > Is claim_interface() the correct approach? > > 3. I read that some people use libusb_detach_kernel_driver() but that is > only for linux from what I see in the documentation - is that correct > currently? Just ask because I saw quite a few posts about this. > > > > I have both interfaces working as standalone projects so I think I'm > pretty close, but the composite case isn't as straightforward as I thought. > > > > Thank you for the support and libusb! > > > > _______________________________________________ > > libusb-devel mailing list > > lib...@li... > > https://lists.sourceforge.net/lists/listinfo/libusb-devel > |