Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 136158 - joydev: USB joysticks do not recover gracefully from disconnects by hub
Summary: joydev: USB joysticks do not recover gracefully from disconnects by hub
Status: VERIFIED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High enhancement
Assignee: Greg Kroah-Hartman (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-09 01:06 UTC by Yang Zhao
Modified: 2006-06-10 00:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yang Zhao 2006-06-09 01:06:23 UTC
Currently, the Linux USB drivers contain code which recoveres USB devices that are shut down by the hub due to, supposedly, too much EM inteference. For example:

input: USB Dance Pad as /class/input/input48
input: USB HID v1.00 Joystick [USB Dance Pad] on usb-0000:00:1d.1-2
hub 3-0:1.0: port 2 disabled by hub (EMI?), re-enabling...
usb 3-2: USB disconnect, address 48
usb 3-2: new low speed USB device using uhci_hcd and address 49
usb 3-2: configuration #1 chosen from 1 choice
input: USB Dance Pad as /class/input/input49
input: USB HID v1.00 Joystick [USB Dance Pad] on usb-0000:00:1d.1-2


However, due to the behaviour of joydev, when the device is reactivated again, it is assigned to a different input device (ie. js0 -> js1). This renderes the device inaccessible to the applications that were using it, effectively rendering any device that even occasionally have such a problem unusable.

This is confirmed with 2.6.16-gentoo-r7.


This bug is a request to patch the behaviour of joydev such that temporarily disconnected devices are reassigned their old number upon reconnect.

Now, as much as I'm willing to hack on this myself, I've no idea where to begin aside from locating the relevant source codes, as the joydev codes have minimal commenting.

Any assistance would be appreciated.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-06-09 02:13:57 UTC
Erm, it's AFAIK not a kernel, but an udev "problem" and you can easily "patch" it by configuring udev properly, so that it always assigns the same device node to a device based on its name or whatever else.

Greg, comments? :)
Comment 2 Yang Zhao 2006-06-09 12:00:50 UTC
Hm... right, udev. I'd somehow completely forgotten about it. Oops. :P

I'll see if modifying udev to favour js* names with lower numbers will help.

It seems that assigning device names according to device information available to the system is a poor solution when people do use multiple identical USB joystick devices at the same time, and it appears that the USB ID assigned to the same physical device over disconnect/reconnect cycles are not consistent.
Comment 3 Greg Kroah-Hartman (RETIRED) gentoo-dev 2006-06-09 15:22:20 UTC
Of course the device ids are not consistant, they are not supposed to be.  We
don't want to give you a sense that they would be and then find out that
they are not in reality some time later in the future :)

There's no real bug here, this is how these devices work.

If you want, we can add the persistant device naming for input devices that
Debian and SuSE has implemented.  It's on my todo list for udev, but pretty
far down right now.

Am closing out.
Comment 4 Yang Zhao 2006-06-10 00:18:41 UTC
I've modified my udev scripts such that it will always assign as low numbered js* device as possible. Even with the disconnecting device being re-assigned its previous name, applications using the device still loses the device entirely.

It looks like what I untimately wanted to achieve can't be done through software.

Closing bug.