隠しデバイスをマウスからジョイスティックに変更

隠しデバイスをマウスからジョイスティックに変更

Ubuntu 14.04ボックスにワイヤレスPS3コントローラアダプタが接続されています。これにはXInputとDInputの2つのモードがあります。私が知っている限り、USBを介して2つの異なるベンダー/製品IDを渡します(XInputにはMicrosoft XBOX IDがあり、もう1つは一般IDです)。 XInputモードはうまく機能します(xpadドライバがロードされます)、DInputモードでは、カーネルはデバイスをジョイスティックではなくマウスとして認識します。

関連質問:

ジョイスティックとして認識させるには、何を変更する必要がありますか?

usbhidドライバはどのように文字デバイスにマイナー番号を割り当てますか?

情報

[ 1692.151837] usb 3-1: new full-speed USB device number 8 using ohci-pci
[ 1692.325523] usb 3-1: New USB device found, idVendor=0079, idProduct=1801
[ 1692.325528] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1692.325530] usb 3-1: Product: Mayflash PS3 Game Controller Adapater
[ 1692.325531] usb 3-1: Manufacturer: HJZ
[ 1692.341586] input: HJZ Mayflash PS3 Game Controller Adapater as /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/input/input14
[ 1692.341854] hid-generic 0003:0079:1801.0006: input,hidraw3: USB HID v1.11 Joystick [HJZ Mayflash PS3 Game Controller Adapater] on usb-0000:00:12.0-1/input0

sudo udevadmについて --path=/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/input/input14

P: /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/input/input14
E: ABS=ffffff
E: DEVPATH=/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/input/input14
...
E: ID_INPUT_TABLET=1
E: ID_MODEL=Mayflash_PS3_Game_Controller_Adapater
...
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid

ll /dev/input/by-id/

lrwxrwxrwx 1 root root   9 May  8 16:18 usb-HJZ_Mayflash_PS3_Game_Controller_Adapater-event-mouse -> ../event4
lrwxrwxrwx 1 root root   9 May  8 16:18 usb-HJZ_Mayflash_PS3_Game_Controller_Adapater-mouse -> ../mouse1

sudo udevadm モニター --property --kernel --udev

...
KERNEL[1693.830143] add      /devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/input/input14/mouse1 (input)
ACTION=add
DEVNAME=/dev/input/mouse1
DEVPATH=/devices/pci0000:00/0000:00:12.0/usb3/3-1/3-1:1.0/input/input14/mouse1
MAJOR=13
MINOR=33
SEQNUM=2196
SUBSYSTEM=input
UDEV_LOG=7
...

修正する

知識を見つけるために、usbhidドライバのメジャー/マイナー番号が記載されたWebサイトを見つけました。以下に示すように、私のデバイスは13,32です。これはmouse0用のドライバによって予約されています。ドライバをだまして別のマイナー番号を割り当てる必要があると思いますか? …それとも私が間違った方向に行っているのでしょうか? (もちろん、私はLinuxよりもWindowsドライバの開発に慣れています。)

引用する

USB device number mappings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 13 char    Input drivers
      0 = /dev/input/js0    First joystick
      1 = /dev/input/js1    Second joystick 
        ...
     32 = /dev/input/mouse0 First mouse 
     33 = /dev/input/mouse1 Second mouse

ls -l /dev/入力/

crw-r-----   1 root root 13, 32 May  9 11:48 mouse0

lsusb -v

Bus 003 Device 003: ID 0079:1801 DragonRise Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x0079 DragonRise Inc.
  idProduct          0x1801
  bcdDevice            1.00
  iManufacturer           1 HJZ
  iProduct                2 Mayflash PS3 Game Controller Adapater
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      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     428
         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               1
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled

ベストアンサー1

HIDシステムは、ベンダーおよび製品IDと一致する特別なドライバがあることを確認し、そうでない場合はそれを通常のHIDデバイスとして扱います。デバイスから送信された記述子を使用して、デバイスが何であるかを確認します。

あなたの場合専用の隠しドライバーがあります。、しかし、ロードされているようではありません。試してみることはできますが、インストールされていない可能性がmodprobe hid-drあります。 Ubuntuではlinux-image-extraパッケージ内にあります。

おすすめ記事