linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Getting a functional driver for Mad Catz Fightstick TE 2 (Xbox One version)
@ 2016-03-08 21:45 Silvan Jegen
  2016-03-09 11:43 ` Gregor Riepl
  0 siblings, 1 reply; 3+ messages in thread
From: Silvan Jegen @ 2016-03-08 21:45 UTC (permalink / raw)
  To: linux-input

Heyho

(I was asked on kernelnewbies to send this here instead)

I bought a Mad Catz Fightstick TE2 for Xbox One because I wanted to play
some fighting games on Linux. I chose this stick because it has gotten good
reviews and I assumed that the Kernel driver should work because there are
already drivers for Xbox One controllers in drivers/input/joystick/xpad.c.

It turns out that the driver does not work and dmesg just shows

[12293.077720] usb 1-1.2.1: new full-speed USB device number 9 using ehci-pci

when plugging it in. Simply adding the line

{ 0x0738, 0x4a01, "Mad Catz FightStick TE 2", 0, XTYPE_XBOXONE },

(where the two Hex values are VENDOR_ID and PRODUCT_ID) to xpad_device[]
in xpad.c does not help either (which I naively hoped it would).

I realized that the stick does not conform to the USB HID interface
after looking more closely at the lsusb -v output (pasted below).


Bus 001 Device 007: ID 0738:4a01 Mad Catz, Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          255 Vendor Specific Class
  bDeviceSubClass       255 Vendor Specific Subclass
  bDeviceProtocol       255 Vendor Specific Protocol
  bMaxPacketSize0        64
  idVendor           0x0738 Mad Catz, Inc.
  idProduct          0x4a01 
  bcdDevice            0.34
  iManufacturer           1 MADCATZ
  iProduct                2 FIGHTSTICK
  iSerial                 3 0000BCA2F0E774D2
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              200mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass     71 
      bInterfaceProtocol    208 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        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     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               4
Device Status:     0x0002
  (Bus Powered)
  Remote Wakeup Enabled


The Fightstick seems to use a "Vendor Specific Class" and not the HID
interface.

The device is relatively simple having only about 10 buttons and a digital
stick and the Xbox One driver for Windows works for it so xpad.c should
be able to deal with it I assume. Worst case I would have to reverse-
engineer the USB protocol it uses on my Window installation though I
hope that will not be necessary given that the much more sophisticated
Xbox One controller works on Linux already.

What I would like to know is if it is possible to use the xpad.c
infrastructure in this case and maybe some pointers on where to go from
here (I have looked at [0],[1] and [2] but want to check if somebody
has dealt with a similar case already and can give me a hint). Thanks!


Cheers,

Silvan

[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/input?id=refs/tags/v4.5-rc7
[1] https://lwn.net/Kernel/LDD3/
[2] http://matthias.vallentin.net/blog/2007/04/writing-a-linux-kernel-driver-for-an-unknown-usb-device/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Getting a functional driver for Mad Catz Fightstick TE 2 (Xbox One version)
  2016-03-08 21:45 Getting a functional driver for Mad Catz Fightstick TE 2 (Xbox One version) Silvan Jegen
@ 2016-03-09 11:43 ` Gregor Riepl
  2016-03-10  8:48   ` Silvan Jegen
  0 siblings, 1 reply; 3+ messages in thread
From: Gregor Riepl @ 2016-03-09 11:43 UTC (permalink / raw)
  To: Silvan Jegen, linux-input

Hi Silvan,

> when plugging it in. Simply adding the line
> 
> { 0x0738, 0x4a01, "Mad Catz FightStick TE 2", 0, XTYPE_XBOXONE },
> 
> (where the two Hex values are VENDOR_ID and PRODUCT_ID) to xpad_device[]
> in xpad.c does not help either (which I naively hoped it would).

If the controller is not 100% proprietary - which I doubt, or it would hardly
work on the Xbox without special vendor support - "abusing" xpad seems
perfectly reasonable.

> I realized that the stick does not conform to the USB HID interface
> after looking more closely at the lsusb -v output (pasted below).
>
> The Fightstick seems to use a "Vendor Specific Class" and not the HID
> interface.

This may be because Xbox One controllers require a special initialisation
sequence to make them send input reports at all.

As far as I know, xpad does this for Xbox One pads, but the commands sent may
not be sufficient for the Mad Catz. This may also be the reason why it doesn't
show up as a HID device: It's possible that the device descriptor changes as
soon as initialisation is complete.

> The device is relatively simple having only about 10 buttons and a digital
> stick and the Xbox One driver for Windows works for it so xpad.c should
> be able to deal with it I assume. Worst case I would have to reverse-
> engineer the USB protocol it uses on my Window installation though I
> hope that will not be necessary given that the much more sophisticated
> Xbox One controller works on Linux already.

I think this is a good idea. Watch the initial data sent closely and compare
what xpad does in the case of a Xbox One controller.

Perhaps the logic is there already, and it just needs to be triggered?

Regards,
Gregor

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Getting a functional driver for Mad Catz Fightstick TE 2 (Xbox One version)
  2016-03-09 11:43 ` Gregor Riepl
@ 2016-03-10  8:48   ` Silvan Jegen
  0 siblings, 0 replies; 3+ messages in thread
From: Silvan Jegen @ 2016-03-10  8:48 UTC (permalink / raw)
  To: Gregor Riepl; +Cc: linux-input

Hi Gregor

Am 2016-03-09 12:43, schrieb Gregor Riepl:
>> I realized that the stick does not conform to the USB HID interface
>> after looking more closely at the lsusb -v output (pasted below).
>> 
>> The Fightstick seems to use a "Vendor Specific Class" and not the HID
>> interface.
> 
> This may be because Xbox One controllers require a special 
> initialisation
> sequence to make them send input reports at all.
> 
> As far as I know, xpad does this for Xbox One pads, but the commands 
> sent may
> not be sufficient for the Mad Catz. This may also be the reason why it 
> doesn't
> show up as a HID device: It's possible that the device descriptor 
> changes as
> soon as initialisation is complete.

So thanks to this suggestion I looked at the xpad.c code again yesterday 
to see which initialisation bytes are being sent. When reading through 
it I realized that I did not add an entry for the fight stick in the 
xpad_table[] array. Adding an entry there using the XPAD_XBOXONE_VENDOR 
macro (whose .bInterfaceSubClass and .bInterfaceProtocol values 
correspond to what I found in the lsusb -v output) lets the driver find 
the stick and also lets me read input from it.

I am travelling till next week but as soon as I get back I will test the 
stick's functionality and check if I have to add a quirk. If I find the 
stick to be reasonably functional after some tweaking I will send a 
patch to the list.

Thanks for your help!


Cheers,

Silvan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-10  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-08 21:45 Getting a functional driver for Mad Catz Fightstick TE 2 (Xbox One version) Silvan Jegen
2016-03-09 11:43 ` Gregor Riepl
2016-03-10  8:48   ` Silvan Jegen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).