denilsonsa / udev-joystick-blacklist

Fix for keyboard/mouse/tablet being detected as joystick in Linux
118 stars 27 forks source link

Extra keyboard plus question about removal #40

Closed parkerlreed closed 1 year ago

parkerlreed commented 6 years ago

I have a Lenovo keyboard that I had to add manually

SUBSYSTEM=="input", ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="608c", ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ID_INPUT_JOYSTICK}=""
SUBSYSTEM=="input", ATTRS{idVendor}=="17ef", ATTRS{idProduct}=="608c", KERNEL=="js[0-9]*", RUN+="/bin/rm %E{DEVNAME}", ENV{ID_INPUT_JOYSTICK}=""
Bus 001 Device 002: ID 17ef:608c Lenovo 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x17ef Lenovo
  idProduct          0x608c 
  bcdDevice            1.12
  iManufacturer           1 LiteOn
  iProduct                2 Lenovo Calliope USB Keyboard
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           59
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      65
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              24
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      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     104
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              48
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0000
  (Bus Powered)

Also, it removed js0 correctly but I've noticed that new gamepads that are connected start at js1. Is this intended? I would assume if the device node is removed then it could be used later by something else.

denilsonsa commented 1 year ago

Sorry for the long delay, thank you for the contribution.

Regarding the question about js0 or js1… Well, in practice it doesn't matter. First, because although the device file is being removed from the /dev/, the kernel (and maybe udev?) still knows the device, so certainly the the device is still being counted somewhere. And secondly, imagine you plug two gamepads, and then unplug the first one. Now you have only one plugged, and its number is 1 instead of 0. This is perfectly normal.

denilsonsa commented 1 year ago

Also, thank you very much for providing enough information with your report. That is really appreciated and it really helps.