Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collect info needs unbind it #178

Open
albfan opened this issue Nov 12, 2023 · 0 comments
Open

Collect info needs unbind it #178

albfan opened this issue Nov 12, 2023 · 0 comments

Comments

@albfan
Copy link

albfan commented Nov 12, 2023

Following gregkh/usbview#25

I'm checking if there's any way to allow root to read those without unbind.

Example with a drive I maintain: hid-t150 https://github.com/scarburato/t150_driver

$ sudo lsusb -d 044f:b677
Bus 001 Device 014: ID 044f:b677 ThrustMaster, Inc. T150 Racing Wheel

First, I'm not sure how to find the path for my usb (without look into dmesg) I did this:

$ grep b677 /sys/bus/usb/devices/*/idProduct
/sys/bus/usb/devices/1-6/idProduct:b677

From that:

$ ls -d /sys/bus/usb/devices/1-6/1-6*
/sys/bus/usb/devices/1-6/1-6:1.0

I think that's the path I need:

sudo bash -c "echo -n 1-6:1.0 >/sys/bus/usb/drivers/usbhid/unbind"

Then I can see:

$ sudo lsusb -vd 044f:b677

Bus 001 Device 014: ID 044f:b677 ThrustMaster, Inc. T150 Racing Wheel
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x044f ThrustMaster, Inc.
  idProduct          0xb677 T150 Racing Wheel
  bcdDevice            1.00
  iManufacturer           1 Thrustmaster
  iProduct                2 Thrustmaster T150RS
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0029
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              200mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     130
          Report Descriptor: (length is 130)
            Item(Global): Usage Page, data= [ 0x01 ] 1
                            Generic Desktop Controls
            Item(Local ): Usage, data= [ 0x04 ] 4
                            Joystick
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x01 ] 1
                            Pointer
            Item(Main  ): Collection, data= [ 0x00 ] 0
                            Physical
            Item(Global): Report ID, data= [ 0x07 ] 7
            Item(Local ): Usage, data= [ 0x30 ] 48
                            Direction-X
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0xff 0x00 0x00 ] 65535
            Item(Global): Physical Minimum, data= [ 0x00 ] 0
            Item(Global): Physical Maximum, data= [ 0xff 0xff 0x00 0x00 ] 65535
            Item(Global): Report Size, data= [ 0x10 ] 16
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x31 ] 49
                            Direction-Y
            Item(Global): Logical Maximum, data= [ 0xff 0x03 ] 1023
            Item(Global): Physical Maximum, data= [ 0xff 0x03 ] 1023
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x35 ] 53
                            Rotate-Z
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x36 ] 54
                            Slider
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): Input, data= [ 0x03 ] 3
                            Constant Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Usage Page, data= [ 0x09 ] 9
                            Buttons
            Item(Local ): Usage Minimum, data= [ 0x01 ] 1
                            Button 1 (Primary)
            Item(Local ): Usage Maximum, data= [ 0x0d ] 13
                            (null)
            Item(Global): Logical Maximum, data= [ 0x01 ] 1
            Item(Global): Physical Maximum, data= [ 0x01 ] 1
            Item(Global): Report Size, data= [ 0x01 ] 1
            Item(Global): Report Count, data= [ 0x0d ] 13
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report Size, data= [ 0x0b ] 11
            Item(Global): Report Count, data= [ 0x01 ] 1
            Item(Main  ): Input, data= [ 0x03 ] 3
                            Constant Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Usage Page, data= [ 0x01 ] 1
                            Generic Desktop Controls
            Item(Local ): Usage, data= [ 0x39 ] 57
                            Hat Switch
            Item(Global): Logical Maximum, data= [ 0x07 ] 7
            Item(Global): Physical Maximum, data= [ 0x3b 0x01 ] 315
            Item(Global): Unit Exponent, data= [ 0x00 ] 0
                            Unit Exponent: 0
            Item(Global): Unit, data= [ 0x14 ] 20
                            System: English Rotation, Unit: Degrees
            Item(Global): Report Size, data= [ 0x04 ] 4
            Item(Main  ): Input, data= [ 0x42 ] 66
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State Null_State Non_Volatile Bitfield
            Item(Global): Unit, data= [ 0x00 ] 0
                            System: None, Unit: (None)
            Item(Main  ): Input, data= [ 0x03 ] 3
                            Constant Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x0a ] 10
            Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
                            (null)
            Item(Local ): Usage, data= [ 0x0a ] 10
                            (null)
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x0e ] 14
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Physical Maximum, data= [ 0xff 0x00 ] 255
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Global): Report ID, data= [ 0x02 ] 2
            Item(Local ): Usage, data= [ 0x02 ] 2
                            (null)
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x14 ] 20
                            (null)
            Item(Global): Report ID, data= [ 0x14 ] 20
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               2
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0020  1x 32 bytes
        bInterval               4
Device Status:     0x0000
  (Bus Powered)

Is there a way to see this info without unbind device? I think usbhid-dump shows basically same info

$ sudo usbhid-dump | grep -v : | xxd -r -p | hidrd-convert -o spec
Usage Page (Desktop),                   ; Generic desktop controls (01h)
Usage (Joystick),                       ; Joystick (04h, application collection)
Collection (Application),
    Usage (Pointer),                    ; Pointer (01h, physical collection)
    Collection (Physical),
        Report ID (7),
        Usage (X),                      ; X (30h, dynamic value)
        Logical Minimum (0),
        Logical Maximum (65535),
        Physical Minimum (0),
        Physical Maximum (65535),
        Report Size (16),
        Report Count (1),
        Input (Variable),
        Usage (Y),                      ; Y (31h, dynamic value)
        Logical Maximum (1023),
        Physical Maximum (1023),
        Input (Variable),
        Usage (Rz),                     ; Rz (35h, dynamic value)
        Input (Variable),
        Usage (Slider),                 ; Slider (36h, dynamic value)
        Input (Variable),
        Input (Constant, Variable),
        Usage Page (Button),            ; Button (09h)
        Usage Minimum (01h),
        Usage Maximum (0Dh),
        Logical Maximum (1),
        Physical Maximum (1),
        Report Size (1),
        Report Count (13),
        Input (Variable),
        Report Size (11),
        Report Count (1),
        Input (Constant, Variable),
        Usage Page (Desktop),           ; Generic desktop controls (01h)
        Usage (Hat Switch),             ; Hat switch (39h, dynamic value)
        Logical Maximum (7),
        Physical Maximum (315),
        Unit Exponent (0),
        Unit (Degrees),
        Report Size (4),
        Input (Variable, Null State),
        Unit,
        Input (Constant, Variable),
        Report ID (10),
        Usage Page (FF00h),             ; FF00h, vendor-defined
        Usage (0Ah),
        Report Size (8),
        Report Count (14),
        Logical Maximum (255),
        Physical Maximum (255),
        Output (Variable),
        Report ID (2),
        Usage (02h),
        Input (Variable),
        Usage (14h),
        Report ID (20),
        Input (Variable),
    End Collection,
End Collection

Not sure if makes sense to read that info directly on lsusb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant