All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Linux joystick driver bugreport
       [not found] <20110625011015.6f397f6f@Giskard>
@ 2011-06-27 19:38 ` Dmitry Torokhov
  2011-06-27 20:01   ` simon
  2011-08-26 14:20   ` Jiri Kosina
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2011-06-27 19:38 UTC (permalink / raw)
  To: Pablo Cabrera; +Cc: Jiri Kosina, Linux Input

Hi Pablo,

On Sat, Jun 25, 2011 at 01:10:15AM -0300, Pablo Cabrera wrote:
> Hello Linux maintainer, I want to report a bug.
> 
> Sorry if my English is not good, I'm not native speaker.
> 
> The joystick driver incorrectly maps axes for some devices.
> 
> I tried two different sticks on different computers with very similar
> results. In both cases, the driver detects more axes which each
> joystick has, and does not map the 'arrow buttons' correctly.
> For device 0079:0011 DragonRise Inc. arrows buttons are mapped to axes 3
> and 4.
> For device 0e8f: 0002 GreenAsia Motion Inc. arrows buttons are mapped
> to axes 2 and 3

Jiri Kosina (CCed) normally takes care of USB devices...

> 
> Note: joysticks I've tried only have the 4 'arrow buttons' and 10
> 'standard buttons'. However I am sure that (in the case of DragonRise
> Inc.) there is another 'version' of the joystick wich does have analog
> sticks. Perhaps this is causing the problem.
> 
> All tests were done in 32bit Debian testing.
> The tests for DragonRise were done under linux 2.6.38
> The tests for GreenAsia were done under linux 2.6.32
> The lines preceded by ## are my comments.
> 
> ----------------------------------------
> steamfactory@steamfactory:~$ jstest --event /dev/input/js0
> Driver version is 2.1.0.
> Joystick (USB Gamepad ) has 6 axes (X, Y, Z, Rx, Ry, (null))
> and 10 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2,
> PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4).
> Testing ... (interrupt to exit)
> Event: type 129, time -115044, number 0, value 0
> Event: type 129, time -115044, number 1, value 0
> Event: type 129, time -115044, number 2, value 0
> Event: type 129, time -115044, number 3, value 0
> Event: type 129, time -115044, number 4, value 0
> Event: type 129, time -115044, number 5, value 0
> Event: type 129, time -115044, number 6, value 0
> Event: type 129, time -115044, number 7, value 0
> Event: type 129, time -115044, number 8, value 0
> Event: type 129, time -115044, number 9, value 0
> Event: type 130, time -115044, number 0, value -32767
> Event: type 130, time -115044, number 1, value 0
> Event: type 130, time -115044, number 2, value 0
> Event: type 130, time -115044, number 3, value 0
> Event: type 130, time -115044, number 4, value 0
> Event: type 130, time -115044, number 5, value 32767
> 
> ## Press left arrow ##
> Event: type 2, time -109668, number 3, value -32767
> 
> ## Release left arrow ##
> Event: type 2, time -99148, number 3, value 0
> 
> ## Press right arrow ##
> Event: type 2, time -92548, number 3, value 32767
> 
> ## Release right arrow ##
> Event: type 2, time -88032, number 3, value 0
> 
> ## Press up arrow ##
> Event: type 2, time -85680, number 4, value -32767
> 
> ## Release up arrow ##
> Event: type 2, time -71304, number 4, value 0
> 
> ## Press down arrow ##
> Event: type 2, time -67688, number 4, value 32767
> 
> ## Release down arrow ##
> Event: type 2, time -66552, number 4, value 0
> ----------------------------------------
> 
> Device info (from 'lsusb -v' as root )
> 
> Bus 005 Device 002: ID 0079:0011 DragonRise Inc.
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               1.00
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0
>   bDeviceProtocol         0
>   bMaxPacketSize0         8
>   idVendor           0x0079 DragonRise Inc.
>   idProduct          0x0011
>   bcdDevice            1.06
>   iManufacturer           0
>   iProduct                2 USB Gamepad
>   iSerial                 0
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           34
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          0
>     bmAttributes         0x80
>       (Bus Powered)
>     MaxPower              100mA
>     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.10
>           bCountryCode           33 US
>           bNumDescriptors         1
>           bDescriptorType        34 Report
>           wDescriptorLength     101
>          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              10
> Device Status:     0x0000
>   (Bus Powered)
> 
> ----------------------------------------
> pablo@Giskard:~$ jstest --event /dev/input/js0
> Driver version is 2.1.0.
> Joystick (USB Joystick      USB Joystick     ) has 6 axes (X, Y, Z, Rx,
> (null), (null)) and 10 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn,
> TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4). Testing ...
> (interrupt to exit) Event: type 129, time -219972, number 0, value 0
> Event: type 129, time -219972, number 1, value 0
> Event: type 129, time -219972, number 2, value 0
> Event: type 129, time -219972, number 3, value 0
> Event: type 129, time -219972, number 4, value 0
> Event: type 129, time -219972, number 5, value 0
> Event: type 129, time -219972, number 6, value 0
> Event: type 129, time -219972, number 7, value 0
> Event: type 129, time -219972, number 8, value 0
> Event: type 129, time -219972, number 9, value 0
> Event: type 130, time -219972, number 0, value 0
> Event: type 130, time -219972, number 1, value 0
> Event: type 130, time -219972, number 2, value 0
> Event: type 130, time -219972, number 3, value 0
> Event: type 130, time -219972, number 4, value 32767
> Event: type 130, time -219972, number 5, value 32767
> 
> ## Press left arrow ##
> Event: type 2, time -212312, number 2, value -32767
> 
> ## Release left arrow ##
> Event: type 2, time -212104, number 2, value 0
> 
> ## Press right arrow ##
> Event: type 2, time -210216, number 2, value 32767
> 
> ## Release right arrow ##
> Event: type 2, time -210088, number 2, value 0
> 
> ## Press up arrow ##
> Event: type 2, time -208904, number 3, value -32767
> 
> ## Release up arrow ##
> Event: type 2, time -208776, number 3, value 0
> 
> ## Press down arrow ##
> Event: type 2, time -207624, number 3, value 32767
> 
> ## Release down arrow ##
> Event: type 2, time -207544, number 3, value 0
> 
> ----------------------------------------
> Device info (from 'lsusb -v' as root)
> 
> Bus 001 Device 002: ID 0e8f:0002 GreenAsia Inc. 
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               1.00
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0 
>   bDeviceProtocol         0 
>   bMaxPacketSize0         8
>   idVendor           0x0e8f GreenAsia Inc.
>   idProduct          0x0002 
>   bcdDevice            1.07
>   iManufacturer           1 USB Joystick     
>   iProduct                2 USB Joystick     
>   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.10
>           bCountryCode           33 US
>           bNumDescriptors         1
>           bDescriptorType        34 Report
>           wDescriptorLength     101
>          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              17
> cannot read device status, Broken pipe (32)
> ----------------------------------------
> 
> I hope that my report will be useful. 

-- 
Dmitry

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

* Re: Linux joystick driver bugreport
  2011-06-27 19:38 ` Linux joystick driver bugreport Dmitry Torokhov
@ 2011-06-27 20:01   ` simon
  2011-06-28 13:25     ` Jiri Kosina
  2011-08-26 14:20   ` Jiri Kosina
  1 sibling, 1 reply; 4+ messages in thread
From: simon @ 2011-06-27 20:01 UTC (permalink / raw)
  To: Pablo Cabrera; +Cc: Dmitry Torokhov, Jiri Kosina, Linux Input

Hi Pablo,

>> For device 0079:0011 DragonRise Inc. arrows buttons are mapped to axes 3
>> and 4.
>> For device 0e8f: 0002 GreenAsia Motion Inc. arrows buttons are mapped
>> to axes 2 and 3

This sounds like the arrows are on a D-Pad and that the D-Pad is described
as a 'HAT' in the HID descriptor, which is like a n-position dial with a
NULL state.

I have a Logitech game pad which does the same, the HID descriptor contains
--
Logical Maximum (7),
Physical Maximum (315),
Report Size (4),
Report Count (1),
Unit (Degrees),
Usage (Hat Switch), ; Hat switch (39h, dynamic value)
Input (Variable, Null State),
Unit,
--

Linux converts these '8 buttons' to a 'vector' to the edge of a circle,
hence the two extra axis.

You can use an application from DigiMend
(http://digimend.sourceforge.net/) to read the HID descriptor for your
device.


A possible work around (if you just want the use the joystick to play) is
described here:
http://hans.fugal.net/blog/2007/06/02/joystick-hat-in-x-plane-in-linux/

Cheers (and good luck),
Simon.


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

* Re: Linux joystick driver bugreport
  2011-06-27 20:01   ` simon
@ 2011-06-28 13:25     ` Jiri Kosina
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2011-06-28 13:25 UTC (permalink / raw)
  To: simon; +Cc: Pablo Cabrera, Dmitry Torokhov, Linux Input

On Mon, 27 Jun 2011, simon@mungewell.org wrote:

> Hi Pablo,
> 
> >> For device 0079:0011 DragonRise Inc. arrows buttons are mapped to axes 3
> >> and 4.
> >> For device 0e8f: 0002 GreenAsia Motion Inc. arrows buttons are mapped
> >> to axes 2 and 3
> 
> This sounds like the arrows are on a D-Pad and that the D-Pad is described
> as a 'HAT' in the HID descriptor, which is like a n-position dial with a
> NULL state.
> 
> I have a Logitech game pad which does the same, the HID descriptor contains
> --
> Logical Maximum (7),
> Physical Maximum (315),
> Report Size (4),
> Report Count (1),
> Unit (Degrees),
> Usage (Hat Switch), ; Hat switch (39h, dynamic value)
> Input (Variable, Null State),
> Unit,
> --
> 
> Linux converts these '8 buttons' to a 'vector' to the edge of a circle,
> hence the two extra axis.
> 
> You can use an application from DigiMend
> (http://digimend.sourceforge.net/) to read the HID descriptor for your
> device.

Or you can obtain in from debugfs (/sys/kernel/debug/hid/<device>/rdesc on 
most distributions) in human-readable form as well.

> A possible work around (if you just want the use the joystick to play) 
> is described here: 
> http://hans.fugal.net/blog/2007/06/02/joystick-hat-in-x-plane-in-linux/

Or write a kernel patch/driver that will fix up the report descriptor.

-- 
Jiri Kosina
SUSE Labs

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

* Re: Linux joystick driver bugreport
  2011-06-27 19:38 ` Linux joystick driver bugreport Dmitry Torokhov
  2011-06-27 20:01   ` simon
@ 2011-08-26 14:20   ` Jiri Kosina
  1 sibling, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2011-08-26 14:20 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Pablo Cabrera, Linux Input

On Mon, 27 Jun 2011, Dmitry Torokhov wrote:

> > The joystick driver incorrectly maps axes for some devices.
> > 
> > I tried two different sticks on different computers with very similar
> > results. In both cases, the driver detects more axes which each
> > joystick has, and does not map the 'arrow buttons' correctly.
> > For device 0079:0011 DragonRise Inc. arrows buttons are mapped to axes 3
> > and 4.
> > For device 0e8f: 0002 GreenAsia Motion Inc. arrows buttons are mapped
> > to axes 2 and 3

Pablo,

could you please post report descriptor and HID debugging output for those 
devices?

You can obtain those from debugfs -- /sys/kernel/debug/hid/<device>/ on 
most systems (depending where you have debugfs mounted to).

There are two text files -- the 'rdesc' one never changes, and contains 
report descriptor as presented by the device. The 'events' one has new 
event every time event is triggered by the HID device, and presents view 
of the event from the HID core POV.

I'd be interested in those outputs for the affected devices.

Thanks,

-- 
Jiri Kosina
SUSE Labs

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

end of thread, other threads:[~2011-08-26 14:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20110625011015.6f397f6f@Giskard>
2011-06-27 19:38 ` Linux joystick driver bugreport Dmitry Torokhov
2011-06-27 20:01   ` simon
2011-06-28 13:25     ` Jiri Kosina
2011-08-26 14:20   ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.