0

I am trying to control a USB HID device (RF transceiver dongle for a weather station) using python and the hidapi module, but I am not able to open the device nor does it show up when using hid.enumerate.

I am able to find and connect to the device using pyusb and looking at the descriptors I noticed that the interface class is 0x03 (HID), but the device class is also 0x03 and not 0x00 (Specified at interface) as I have read it should be.

Is this device not conforming with the HID spec. and could this alone be the reason hidapi can't find the device? Otherwise, from what I can tell, the device seems to behave like a normal HID device and I was able to read the HID descriptor from the interface using pyusb and a control transfer.

Is there a way I can get hidapi to connect to the device and ignore the wrong device class (if that is the issue)? If possible, I would prefer to use the more specialised hidapi instead of using pyusb.

DEVICE ID 6666:5555 on Bus 001 Address 001 =================
 bLength                :   0x12 (18 bytes)
 bDescriptorType        :    0x1 Device
 bcdUSB                 :  0x200 USB 2.0
 bDeviceClass           :    0x3 
 bDeviceSubClass        :    0x0
 bDeviceProtocol        :   0xff
 bMaxPacketSize0        :   0x40 (64 bytes)
 idVendor               : 0x6666
 idProduct              : 0x5555
 bcdDevice              :  0x100 Device 1.0
 iManufacturer          :    0x1 LA CROSSE TECHNOLOGY
 iProduct               :    0x2 Weather Direct Light Wireless Device
 iSerialNumber          :    0x3 0123456
 bNumConfigurations     :    0x1
  CONFIGURATION 1: 30 mA ===================================
   bLength              :    0x9 (9 bytes)
   bDescriptorType      :    0x2 Configuration
   wTotalLength         :   0x22 (34 bytes)
   bNumInterfaces       :    0x1
   bConfigurationValue  :    0x1
   iConfiguration       :    0x0 
   bmAttributes         :   0x80 Bus Powered
   bMaxPower            :    0xf (30 mA)
    INTERFACE 0: Human Interface Device ====================
     bLength            :    0x9 (9 bytes)
     bDescriptorType    :    0x4 Interface
     bInterfaceNumber   :    0x0
     bAlternateSetting  :    0x0
     bNumEndpoints      :    0x1
     bInterfaceClass    :    0x3 Human Interface Device
     bInterfaceSubClass :    0x0
     bInterfaceProtocol :    0x0
     iInterface         :    0x0 
      ENDPOINT 0x81: Interrupt IN ==========================
       bLength          :    0x7 (7 bytes)
       bDescriptorType  :    0x5 Endpoint
       bEndpointAddress :   0x81 IN
       bmAttributes     :    0x3 Interrupt
       wMaxPacketSize   :   0x40 (64 bytes)
       bInterval        :   0x20
gugelhüpf
  • 85
  • 2
  • 10

1 Answers1

0

According to the HID spec and USB Defined Class Codes list - bDeviceClass indeed shouldn't be 0x3:

Note The bDeviceClass and bDeviceSubClass fields in the Device Descriptor should not be used to identify a device as belonging to the HID class. Instead use the bInterfaceClass and bInterfaceSubClass fields in the Interface descriptor.

This indeed can lead to wrong interpretation of this device by OS. The only workaround I can assume is custom driver that will wrap this device and patch its USB Device Descriptor. Here is example of such driver: https://github.com/microsoft/Windows-driver-samples/tree/main/hid/hidusbfx2

DJm00n
  • 1,083
  • 5
  • 18