2

I have a wireless PS3 controller adapter that is plugged in to my Ubuntu 14.04 box. It has 2 modes: XInput and DInput, which as far as I can tell, it just passes two different vendor/product id's over USB (XInput has a Microsoft XBOX id, the other is generic). The XInput mode works fine (loads xpad driver), but in the DInput mode the kernel identifies the device as a mouse, instead of as a joystick.

Related Questions:

What do I need to change to make it identify as a joystick?

How does the usbhid driver assign minor numbers to a character device?

dmesg

[ 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 info --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 monitor --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
...

Update

In my quest for knowledge, I found a site that lists the Major/Minor numbers for the usbhid driver. As you can see below, my device is 13,32, which is reserved by the driver for mouse0. It would appear that I need to trick(?) the driver into assigning a different Minor number to it? ...or am I headed down the wrong path? (Admittedly, I'm more familiar with Windows driver dev, than linux)

Reference

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/input/

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
2
  • What does lsusb -v says about the device ?
    – Leiaz
    May 9, 2015 at 19:56
  • I added the lsusb information Leiaz. Thank you for checking it out and for any help you can provide.
    – ac3d912
    May 10, 2015 at 20:02

1 Answer 1

0

The HID system checks for a specialized driver matching the vendor and product ids, and if there is none it is treated as a generic HID device : the descriptors sent by the device are used to determine what it is.

In your case there is a specialized hid driver, but it looks like it wasn't loaded. You can try modprobe hid-dr, but you probably don't have it installed. On Ubuntu, it is in the linux-image-extra package.

3
  • It has taken me a couple of days to finish testing it out, but this is the correct answer; unfortunately, the driver doesn't support the PID for my device. I am adding code for my device now. Thanks for pointing this driver out to me!
    – ac3d912
    May 17, 2015 at 19:43
  • So, after adding { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x1801), }, to the driver, then re-compiling, and insmodding the driver, it still uses hid_generic as the driver for my device. How do I tell the HID system to use the hid_dr driver instead of the generic one? (I figured by adding the PID as I did, would do it)
    – ac3d912
    May 17, 2015 at 21:50
  • Oh. Sorry, my eyes glitched here, I thought the PID matched, for some reason. The VID/PID also need to be in the hid_have_special_driver array in hid-core.c. But the two devices supported by this driver don't work exactly the same way, and your device may also be different from those. It may not work out of the box just by adding its PID.
    – Leiaz
    May 17, 2015 at 22:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .