未正确检测到游戏手柄

未正确检测到游戏手柄

我在 Ubuntu 18.04 中使用无线游戏手柄时遇到了一些问题。直到最近它都运行良好。jstest 和 evtest 似乎都检测到了来自它的输入,但按钮映射不正确,游戏/模拟器似乎无法识别它。

lsusb 返回此内容:

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 008: ID 17e9:436e DisplayLink 
Bus 001 Device 011: ID 0b0e:0301 GN Netcom 
Bus 001 Device 010: ID 413c:2107 Dell Computer Corp. 
Bus 001 Device 009: ID 0461:4d22 Primax Electronics, Ltd 
Bus 001 Device 007: ID 2109:2813 VIA Labs, Inc. 
Bus 001 Device 006: ID 17e9:436e DisplayLink 
Bus 001 Device 004: ID 2109:2813 VIA Labs, Inc. 
Bus 001 Device 003: ID 048d:8297 Integrated Technology Express, Inc. 
Bus 001 Device 002: ID 8087:0aa7 Intel Corp. 
Bus 001 Device 013: ID 11c1:9101  
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

我注意到有一个没有描述符/名称的设备(11c1:9101),结果是游戏手柄。

运行“lsusb -d 11c1:9101 -v”获得的设备详细信息:

Bus 001 Device 013: ID 11c1:9101  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x11c1
  idProduct          0x9101
  bcdDevice            1.00
  iManufacturer           1  
  iProduct                2 ESM-9013
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     137
         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     0x0040  1x 64 bytes
        bInterval               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               4
Device Status:     0x0000
  (Bus Powered)

游戏手柄似乎被识别为 HID 设备,这可能是问题的一部分,但不确定如何解决。运行“dmesg | grep hid”的结果证实了这一点:

[    4.860713] hidraw: raw HID events driver (C) Jiri Kosina
[    4.873302] usbcore: registered new interface driver usbhid
[    4.873302] usbhid: USB HID core driver
[    4.874614] hid-generic 0003:048D:8297.0001: hiddev0,hidraw0: USB HID v1.10 Device [ITE Tech. Inc. ITE Device(8595)] on usb-0000:01:00.0-8/input0
[    4.874749] hid-generic 0003:11C1:9101.0002: input,hidraw1: USB HID v1.11 Gamepad [   ESM-9013] on usb-0000:01:00.0-10/input0
[    5.805426] hid-generic 0003:0461:4D22.0003: input,hidraw2: USB HID v1.11 Mouse [USB Optical Mouse] on usb-0000:01:00.0-9.2.1/input0
[    6.360241] hid-generic 0003:413C:2107.0004: input,hidraw3: USB HID v1.10 Keyboard [Dell Dell USB Entry Keyboard] on usb-0000:01:00.0-9.2.2/input0
[   14.272182] jabra 0003:0B0E:0301.0005: input,hiddev1,hidraw4: USB HID v1.00 Device [GN Netcom A/S Jabra EVOLVE 20] on usb-0000:01:00.0-9.2.3/input3
[ 1094.275956] hid-generic 0003:057E:2009.0006: input,hidraw1: USB HID v1.11 Joystick [  PC USB CONTROLLER 1.06] on usb-0000:01:00.0-10/input0
[ 1095.247965] hid-generic 0003:11C1:9101.0007: input,hidraw1: USB HID v1.11 Gamepad [   ESM-9013] on usb-0000:01:00.0-10/input0

看起来游戏手柄有三个不同的条目,但我只连接了一个。

它也可能与 steamos-xpad-dkms 存在某种冲突,我记得我在 Steam 游戏中使用过它,之后当我下次尝试使用它时,游戏就无法检测到它了。

更新日期 2020-06-01

以下是我在系统日志中注意到的一些异常活动:

Jun  1 00:50:04 viru-b450 kernel: [26378.903526] hid-generic 0003:057E:2009.0025: input,hidraw4: USB HID v1.11 Joystick [  PC USB CONTROLLER 1.06] on usb-0000:01:00.0-10/input0
Jun  1 00:50:04 viru-b450 systemd-udevd[1211]: Process '/usr/bin/jscal-restore /dev/input/js0' failed with exit code 1.
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) config/udev: Adding input device   PC USB CONTROLLER 1.06 (/dev/input/js0)
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) No input driver specified, ignoring this device.
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) This device may have been added with another device file.
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) config/udev: Adding input device   PC USB CONTROLLER 1.06 (/dev/input/js0)
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) No input driver specified, ignoring this device.
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) This device may have been added with another device file.
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) config/udev: Adding input device   PC USB CONTROLLER 1.06 (/dev/input/event16)
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) No input driver specified, ignoring this device.
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) This device may have been added with another device file.
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) config/udev: Adding input device   PC USB CONTROLLER 1.06 (/dev/input/event16)
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) No input driver specified, ignoring this device.
Jun  1 00:50:04 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) This device may have been added with another device file.
Jun  1 00:50:04 viru-b450 upowerd[2639]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-10/1-10:1.0/0003:057E:2009.0025
Jun  1 00:50:04 viru-b450 upowerd[2639]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-10/1-10:1.0
Jun  1 00:50:04 viru-b450 upowerd[2639]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-10
Jun  1 00:50:04 viru-b450 kernel: [26379.152145] usb 1-10: USB disconnect, device number 38
Jun  1 00:50:04 viru-b450 upowerd[2639]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-10/1-10:1.0/0003:057E:2009.0025
Jun  1 00:50:04 viru-b450 upowerd[2639]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-10/1-10:1.0
Jun  1 00:50:04 viru-b450 upowerd[2639]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-10
Jun  1 00:50:05 viru-b450 kernel: [26379.503364] usb 1-10: new full-speed USB device number 39 using xhci_hcd
Jun  1 00:50:05 viru-b450 kernel: [26379.835592] usb 1-10: New USB device found, idVendor=11c1, idProduct=9101, bcdDevice= 1.00
Jun  1 00:50:05 viru-b450 kernel: [26379.835595] usb 1-10: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Jun  1 00:50:05 viru-b450 kernel: [26379.835596] usb 1-10: Product: ESM-9013
Jun  1 00:50:05 viru-b450 kernel: [26379.835597] usb 1-10: Manufacturer:  
Jun  1 00:50:05 viru-b450 kernel: [26379.861838] input:    ESM-9013 as /devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-10/1-10:1.0/0003:11C1:9101.0026/input/input48
Jun  1 00:50:05 viru-b450 mtp-probe: checking bus 1, device 39: "/sys/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-10"
Jun  1 00:50:05 viru-b450 mtp-probe: bus: 1, device: 39 was not an MTP device
Jun  1 00:50:05 viru-b450 kernel: [26379.919868] hid-generic 0003:11C1:9101.0026: input,hidraw4: USB HID v1.11 Gamepad [   ESM-9013] on usb-0000:01:00.0-10/input0
Jun  1 00:50:05 viru-b450 systemd-udevd[1229]: Process '/usr/bin/jscal-restore /dev/input/js0' failed with exit code 1.
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) config/udev: Adding input device    ESM-9013 (/dev/input/js0)
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) No input driver specified, ignoring this device.
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) This device may have been added with another device file.
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) config/udev: Adding input device    ESM-9013 (/dev/input/js0)
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) No input driver specified, ignoring this device.
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) This device may have been added with another device file.
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) config/udev: Adding input device    ESM-9013 (/dev/input/event16)
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) No input driver specified, ignoring this device.
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[2430]: (II) This device may have been added with another device file.
Jun  1 00:50:05 viru-b450 upowerd[2639]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-10/1-10:1.0/0003:11C1:9101.0026
Jun  1 00:50:05 viru-b450 upowerd[2639]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-10/1-10:1.0
Jun  1 00:50:05 viru-b450 upowerd[2639]: unhandled action 'bind' on /sys/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-10
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) config/udev: Adding input device    ESM-9013 (/dev/input/event16)
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) No input driver specified, ignoring this device.
Jun  1 00:50:05 viru-b450 /usr/lib/gdm3/gdm-x-session[11095]: (II) This device may have been added with another device file.

evtest 结果:

Available devices:
/dev/input/event0:  Power Button
/dev/input/event1:  Power Button
/dev/input/event2:  USB Optical Mouse
/dev/input/event3:  Dell Dell USB Entry Keyboard
/dev/input/event4:  HDA ATI HDMI HDMI/DP,pcm=3
/dev/input/event5:  HDA ATI HDMI HDMI/DP,pcm=7
/dev/input/event6:  HDA ATI HDMI HDMI/DP,pcm=8
/dev/input/event7:  HDA ATI HDMI HDMI/DP,pcm=9
/dev/input/event8:  HDA ATI HDMI HDMI/DP,pcm=10
/dev/input/event9:  HDA ATI HDMI HDMI/DP,pcm=11
/dev/input/event10: HD-Audio Generic Front Mic
/dev/input/event11: HD-Audio Generic Rear Mic
/dev/input/event12: HD-Audio Generic Line
/dev/input/event13: HD-Audio Generic Line Out
/dev/input/event14: HD-Audio Generic Front Headphone
/dev/input/event15: GN Netcom A/S Jabra EVOLVE 20
/dev/input/event16:    ESM-9013
Select the device event number [0-16]: 16
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x11c1 product 0x9101 version 0x111
Input device name: "   ESM-9013"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 304 (BTN_SOUTH)
    Event code 305 (BTN_EAST)
    Event code 306 (BTN_C)
    Event code 307 (BTN_NORTH)
    Event code 308 (BTN_WEST)
    Event code 309 (BTN_Z)
    Event code 310 (BTN_TL)
    Event code 311 (BTN_TR)
    Event code 312 (BTN_TL2)
    Event code 313 (BTN_TR2)
    Event code 314 (BTN_SELECT)
    Event code 315 (BTN_START)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value    128
      Min        0
      Max      255
      Flat      15
    Event code 1 (ABS_Y)
      Value    128
      Min        0
      Max      255
      Flat      15
    Event code 2 (ABS_Z)
      Value    128
      Min        0
      Max      255
      Flat      15
    Event code 5 (ABS_RZ)
      Value    128
      Min        0
      Max      255
      Flat      15
    Event code 16 (ABS_HAT0X)
      Value      0
      Min       -1
      Max        1
    Event code 17 (ABS_HAT0Y)
      Value      0
      Min       -1
      Max        1
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1591054847.916049, type 3 (EV_ABS), code 0 (ABS_X), value 76
Event: time 1591054847.916049, -------------- SYN_REPORT ------------
Event: time 1591054847.924049, type 3 (EV_ABS), code 0 (ABS_X), value 0
Event: time 1591054847.924049, -------------- SYN_REPORT ------------
Event: time 1591054847.976047, type 3 (EV_ABS), code 1 (ABS_Y), value 106
Event: time 1591054847.976047, -------------- SYN_REPORT ------------
Event: time 1591054847.984044, type 3 (EV_ABS), code 1 (ABS_Y), value 66
Event: time 1591054847.984044, -------------- SYN_REPORT ------------
Event: time 1591054847.992050, type 3 (EV_ABS), code 1 (ABS_Y), value 17
Event: time 1591054847.992050, -------------- SYN_REPORT ------------
Event: time 1591054848.000040, type 3 (EV_ABS), code 0 (ABS_X), value 6
Event: time 1591054848.000040, type 3 (EV_ABS), code 1 (ABS_Y), value 0

udevadm 信息:

P: /devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-9/1-9.4/1-9.4:1.0/0003:11C1:9101.0006/input/input17/event16
N: input/event16
S: input/by-id/usb-_ESM-9013-event-joystick
S: input/by-path/pci-0000:01:00.0-usb-0:9.4:1.0-event-joystick
E: DEVLINKS=/dev/input/by-path/pci-0000:01:00.0-usb-0:9.4:1.0-event-joystick /dev/input/by-id/usb-_ESM-9013-event-joystick
E: DEVNAME=/dev/input/event16
E: DEVPATH=/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-9/1-9.4/1-9.4:1.0/0003:11C1:9101.0006/input/input17/event16
E: ID_BUS=usb
E: ID_FOR_SEAT=input-pci-0000_01_00_0-usb-0_9_4_1_0
E: ID_INPUT=1
E: ID_INPUT_JOYSTICK=1
E: ID_MODEL=ESM-9013
E: ID_MODEL_ENC=ESM-9013
E: ID_MODEL_ID=9101
E: ID_PATH=pci-0000:01:00.0-usb-0:9.4:1.0
E: ID_PATH_TAG=pci-0000_01_00_0-usb-0_9_4_1_0
E: ID_REVISION=0100
E: ID_SERIAL=_ESM-9013
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR_ENC=\x20\x20
E: ID_VENDOR_ID=11c1
E: LIBINPUT_DEVICE_GROUP=3/11c1/9101:usb-0000:01:00.0-9
E: MAJOR=13
E: MINOR=80
E: SUBSYSTEM=input
E: TAGS=:uaccess:seat:
E: USEC_INITIALIZED=75198405

Dolphin 模拟器在 evdev/0/ 上正确识别它,但其他模拟器(如 VBA-M 和 Snes9x)尽管之前工作正常,却无法正确识别它。

答案1

在我的案例中,同一品牌的控制器 (ESM-9101) 出于某种原因被检测为“switch pro 控制器”,并且它也弄乱了输入。最近发现,您可以在 modprobe 中将此“输入设备类型”列入黑名单,这样就可以将控制器最终检测为通用 xbox 控制器。

我找到解决方案的原始位置和代码

echo  'install hid_nintendo /bin/true' | sudo tee -a /etc/modprobe.d/blacklist.conf

或/和

echo 'blacklist hid_nintendo' | sudo tee -a /etc/modprobe.d/no-nintendo.conf

相关内容