Bug 187005 - udev does not make entries for my joystick
Summary: udev does not make entries for my joystick
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 5
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Dave Jones
QA Contact:
URL:
Whiteboard:
: 189060 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-03-27 22:53 UTC by Christopher Stone
Modified: 2015-01-04 22:26 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-08-23 05:16:45 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch fixing auto loading of jodev.ko on x86_64 (1.94 KB, patch)
2006-08-14 09:59 UTC, Hans de Goede
no flags Details | Diff

Description Christopher Stone 2006-03-27 22:53:15 UTC
Description of problem:  When I plug in my usb joystick udev does not make any
/dev/input/js* entries.


Version-Release number of selected component (if applicable):

udev-084-13

How reproducible:
plug in joystick

Steps to Reproduce:
1.  plug in joystick
2.  ls /dev/input
  
Actual results:
no js* entries


Expected results:
js* entries

Additional info:
# lsusb
Bus 002 Device 003: ID 046d:c216 Logitech, Inc. Dual Action Gamepad

message log output:
Mar 27 14:23:08 rivendell kernel: usb 2-4: new low speed USB device using
ohci_hcd and address 3
Mar 27 14:23:08 rivendell kernel: usb 2-4: configuration #1 chosen from 1 choice
Mar 27 14:23:12 rivendell udevd-event[32663]: wait_for_sysfs: waiting for
'/sys/devices/pci0000:00/0000:00:02.0/usb2/2-4/2-4:1.0/bus' failed
Mar 27 14:23:18 rivendell kernel: drivers/usb/input/hid-core.c:
usb_submit_urb(ctrl) failed
Mar 27 14:23:18 rivendell kernel: drivers/usb/input/hid-core.c: timeout
initializing reports
Mar 27 14:23:18 rivendell kernel: input: Logitech Logitech Dual Action as
/class/input/input5
Mar 27 14:23:18 rivendell kernel: input: USB HID v1.10 Joystick [Logitech
Logitech Dual Action] on usb-0000:00:02.0-4

# ls /dev/input
event0  event1  event2  event3  event4  mice  mouse0  mouse1

Comment 1 Kay Sievers 2006-03-29 14:07:25 UTC
Please paste the output of:
  lsmod | grep joy
if it prints nothing, run:
  modprobe joydev
and look for the nodes.

It that doesn't do anything, run:
  udevmonitor
plug in the device and paste the output here.

Comment 2 Christopher Stone 2006-03-30 01:10:30 UTC
[root@rivendell ~]# ls /dev/input
event0  event1  event2  event3  event4  mice  mouse0  mouse1
[root@rivendell ~]# lsmod | grep joy
[root@rivendell ~]# modprobe joydev
[root@rivendell ~]# lsmod | grep joy
joydev                 44225  0
[root@rivendell ~]# ls /dev/input
event0  event1  event2  event3  event4  js0  mice  mouse0  mouse1

So does this mean it's a bug somewhere else in the system?  Please advise on the
best course of action to take from this point.  In FC4 I did not have to
modprobe joydev, so it seems something is missing somewhere.

Thanks for the help.

Comment 3 Kay Sievers 2006-03-30 09:19:46 UTC
Get the kernel device path:
  $ udevinfo -q path -n /dev/input/js0
  /class/input/input5/js0

Lookup the first modalias entry of this path:
  $ udevinfo -a -p /class/input/input5/js0 | grep modalias

Take the first string and pass it to modprobe
  modprobe --first-time -n -v input:b000...

And please paste the command and the result here.

Comment 4 Christopher Stone 2006-03-30 11:30:55 UTC
# udevinfo -q path -n /dev/input/js0
/class/input/input4/js0

# udevinfo -a -p /class/input/input4/js0 | grep modalias
   
SYSFS{modalias}=="input:b0003v046DpC216e0200-e0_1_3_k120_121_122_123_124_125_126_127_128_129_12A_12B_ra0_1_2_5_10_11_mlsfw"
    SYSFS{modalias}=="usb:v046DpC216d0200dc00dsc00dp00ic03isc00ip00"
    SYSFS{modalias}=="pci:v000010DEd0000005Asv00001043sd0000815Abc0Csc03i10"

# modprobe --first-time -n -v
"input:b0003v046DpC216e0200-e0_1_3_k120_121_122_123_124_125_126_127_128_129_12A_12B_ra0_1_2_5_10_11_mlsfw"
FATAL: Module
input:b0003v046DpC216e0200_e0_1_3_k120_121_122_123_124_125_126_127_128_129_12A_12B_ra0_1_2_5_10_11_mlsfw
not found.


Comment 5 Kay Sievers 2006-03-30 11:55:29 UTC
(Oh, the "'" gets replaced by "_" in udevinfo cause the value is read from
sysfs, but should not be the problem and it is fixed in a later udev version)

Please remove the last part of the result you get with:
  udevinfo -q path -n /dev/input/js0
  /class/input/input4/js0

And try:
  udevtest /class/input/input4

And paste the result in here.

Comment 6 Christopher Stone 2006-03-30 12:01:36 UTC
# udevtest /class/input/input4
main: looking at device '/class/input/input4' from subsystem 'input'
main: run: 'socket:/org/kernel/udev/monitor'
main: run: '/lib/udev/udev_run_devd'
main: run: 'socket:/org/freedesktop/hal/udev_event'


Comment 7 Kay Sievers 2006-03-30 12:09:23 UTC
Hmm, ok, next try :)

What does:
  modprobe -n -v --first-time $(cat /sys/class/input/input4/modalias)
print?


Comment 8 Christopher Stone 2006-03-30 12:13:33 UTC
# cat /sys/class/input/input4/modalias
input:b0003v046DpC216e0200-e0,1,3,k120,121,122,123,124,125,126,127,128,129,12A,1
# modprobe -n -v --first-time $(cat /sys/class/input/input4/modalias)
FATAL: Module
input:b0003v046DpC216e0200_e0,1,3,k120,121,122,123,124,125,126,127,128,129,12A,12B,ra0,1,2,5,10,11,mlsfw
not found.


Comment 9 Kay Sievers 2006-03-30 12:17:09 UTC
Ok, we're coming closer.

What does:
  grep joydev /lib/modules/$(uname -r)/modules.alias
print?

Comment 10 Christopher Stone 2006-03-30 12:24:22 UTC
# grep joydev /lib/modules/$(uname -r)/modules.alias
alias input:b*v*p*e*-e*3,*k*r*a*0,*20,*m*l*s*f*w* joydev
alias input:b*v*p*e*-e*3,*k*r*a*8,*28,*m*l*s*f*w* joydev
alias input:b*v*p*e*-e*3,*k*r*a*6,*26,*m*l*s*f*w* joydev


Comment 11 Kay Sievers 2006-03-30 12:32:34 UTC
Ick, that should definitely work. 
Your modalias works fine for me (not Fedora) and matches the joydev module:
  modprobe -n -v --first-time
input:b0003v046DpC216e0200-e0,1,3,k120,121,122,123,124,125,126,127,128,129,12A,12B,ra0,1,2,5,10,11,mlsfw
  FATAL: Module joydev already in kernel.

Please try exactly that command if it fails to find joydev on your box.

Comment 12 Christopher Stone 2006-03-30 12:41:37 UTC
ok Im a bit confused here because it looks like none of those aliases actually
match.  The only one that comes close is:
alias input:b*v*p*e*-e*3,*k*r*a*0,*20,*m*l*s*f*w* joydev
but this does not match the *20 part after the r*a*0,

Typing the exact command:
# modprobe -n -v --first-time
input:b0003v046DpC216e0200-e0,1,3,k120,121,122,123,124,125,126,127,128,129,12A,12B,ra0,1,2,5,10,11,mlsfw
FATAL: Module
input:b0003v046DpC216e0200_e0,1,3,k120,121,122,123,124,125,126,127,128,129,12A,12B,ra0,1,2,5,10,11,mlsfw
not found.


Comment 13 Kay Sievers 2006-03-30 12:49:44 UTC
Yeah, you are right. It prints for me:
  grep joydev /lib/modules/$(uname -r)/modules.alias
  alias input:b*v*p*e*-e*3,*k*r*a*0,*m*l*s*f*w* joydev
  alias input:b*v*p*e*-e*3,*k*r*a*8,*m*l*s*f*w* joydev
  alias input:b*v*p*e*-e*3,*k*r*a*6,*m*l*s*f*w* joydev

Now, let's find the difference why I have different aliases generated from the
MODULE_DEVICE_TABLE macro. :)

What does:
  uname -a
and
  modprobe -V
print.

I have 2.6.16 and 3.2.2.

Comment 14 Christopher Stone 2006-03-30 12:52:40 UTC
# uname -a
Linux rivendell 2.6.16-1.2080_FC5 #1 SMP Tue Mar 28 03:38:47 EST 2006 x86_64
x86_64 x86_64 GNU/Linux
# modprobe -V
module-init-tools version 3.2-pre9


Comment 15 Kay Sievers 2006-03-30 13:00:49 UTC
Harald, it's likely a module-init-tools bug.

module-init-tools-3.2.2/ChangeLog
3.2.2 Version:
o depmod: Try to generate correct input tables for 2.6.14 and above
  (thanks to report from Scott James Remnant)



Comment 16 Harald Hoyer 2006-03-30 14:47:22 UTC
Thank you Kay!

Comment 17 Harald Hoyer 2006-04-04 13:00:04 UTC
Please test the erratum from:
https://www.redhat.com/archives/fedora-test-list/2006-April/msg00052.html

Comment 18 Christopher Stone 2006-04-06 15:02:49 UTC
# rpm -q module-init-tools
module-init-tools-3.2.2-0.FC5.2

# grep joydev /lib/modules/$(uname -r)/modules.alias
alias input:b*v*p*e*-e*3,*k*r*a*0,*20,*m*l*s*f*w* joydev
alias input:b*v*p*e*-e*3,*k*r*a*8,*28,*m*l*s*f*w* joydev
alias input:b*v*p*e*-e*3,*k*r*a*6,*26,*m*l*s*f*w* joydev

Seems the updated version of module-init-tools did not help.  :(

Comment 19 Kay Sievers 2006-04-06 15:08:59 UTC
What does:
  /sbin/depmod -n | grep joydev
print?

Comment 20 Christopher Stone 2006-04-06 15:10:57 UTC
# /sbin/depmod -n | grep joydev
/lib/modules/2.6.16-1.2080_FC5/kernel/drivers/input/joydev.ko:
joydev              0x90  0x0  0x0  0x0  0x0  8  0  0  1  0  0  0  0  0  0x0
joydev              0x90  0x0  0x0  0x0  0x0  8  0  0  100  0  0  0  0  0  0x0
joydev              0x90  0x0  0x0  0x0  0x0  8  0  0  40  0  0  0  0  0  0x0
alias input:b*v*p*e*-e*3,*k*r*a*0,*20,*m*l*s*f*w* joydev
alias input:b*v*p*e*-e*3,*k*r*a*8,*28,*m*l*s*f*w* joydev
alias input:b*v*p*e*-e*3,*k*r*a*6,*26,*m*l*s*f*w* joydev


Comment 21 Kay Sievers 2006-04-06 15:42:09 UTC
Hmm, strange. What's in the module itself?
  /sbin/modinfo joydev

Comment 22 Christopher Stone 2006-04-06 15:52:44 UTC
$ /sbin/modinfo joydev
filename:       /lib/modules/2.6.16-1.2080_FC5/kernel/drivers/input/joydev.ko
author:         Vojtech Pavlik <vojtech>
description:    Joystick device interfaces
license:        GPL
vermagic:       2.6.16-1.2080_FC5 SMP gcc-4.1
depends:
alias:          input:b*v*p*e*-e*3,*k*r*a*0,*20,*m*l*s*f*w*
alias:          input:b*v*p*e*-e*3,*k*r*a*8,*28,*m*l*s*f*w*
alias:          input:b*v*p*e*-e*3,*k*r*a*6,*26,*m*l*s*f*w*
srcversion:     61FB5FE89F97C26D3909D22


Comment 23 Kay Sievers 2006-04-06 19:02:10 UTC
I asked on IRC for the output of a rawhide box with kernel-2.6.16-1.2118_FC6
and got:
  alias:          input:b*v*p*e*-e*3,*k*r*a*0,*m*l*s*f*w*
  alias:          input:b*v*p*e*-e*3,*k*r*a*8,*m*l*s*f*w*
  alias:          input:b*v*p*e*-e*3,*k*r*a*6,*m*l*s*f*w*

which looks fine. So it's a FC5 kernel issue?

Comment 24 Kay Sievers 2006-04-06 19:45:09 UTC
We got another box which is fine:
  2.6.16-1.2080_FC5 686 REGPARM 4KSTACKS gcc-4.1
  input:b*v*p*e*-e*3,*k*r*a*0,*m*l*s*f*w*
  input:b*v*p*e*-e*3,*k*r*a*8,*m*l*s*f*w*
  input:b*v*p*e*-e*3,*k*r*a*6,*m*l*s*f*w*

And we found a SUSE box with kernel-smp-2.6.16_rc5_git9-2 which has
the wrong alias strings too.

Comment 25 Harald Hoyer 2006-04-07 07:01:51 UTC
ok.. reassigning to component kernel.

Comment 26 Harald Hoyer 2006-04-18 10:45:18 UTC
*** Bug 189060 has been marked as a duplicate of this bug. ***

Comment 27 Kay Sievers 2006-04-28 02:29:51 UTC
It is identified as a module-init-tools "range pattern match" bug. Patch or new
version is available.

Comment 28 Harald Hoyer 2006-07-17 06:11:54 UTC
did the update work?

Comment 29 Christopher Stone 2006-07-17 22:43:38 UTC
hmm okay I rebooted into 2.6.17-1.2157_FC5 and now when I plug in my joystick I
get a /dev/input/event4:

# ls /dev/input ; # Before plugging in joystick
event0  event1  event2  event3  mice  mouse0  mouse1

# ls /dev/input ; # After plugging in joystick
event0  event1  event2  event3  event4  mice  mouse0  mouse1

jstest on /dev/input/event4 doesn't seem to work.


Comment 30 Nicholas Miell 2006-07-17 23:25:57 UTC
The native event devices have always been created -- that isn't the problem. The
problem is that joydev never gets loaded and thus /dev/js* don't get created,
and apps actually use /dev/js* as opposed to the input event devices.

And, no, module-init-tools-3.2.2-0.FC5.3 did not fix this.

Comment 31 Hans de Goede 2006-08-04 09:42:46 UTC
Hi all,

I'm digging into this as this bug has annoyed me for long enough the problem is
either with jodev.ko itself or with module-init-tools.

With the latest kernel and module-init-tools from Rawhide I get:
/sbin/modinfo joydev:
alias:          input:b*v*p*e*-e*3,*k*r*a*0,*20,*m*l*s*f*w*
alias:          input:b*v*p*e*-e*3,*k*r*a*8,*28,*m*l*s*f*w*
alias:          input:b*v*p*e*-e*3,*k*r*a*6,*26,*m*l*s*f*w*

From which the first one in order to work for me should be:
alias:          input:b*v*p*e*-e*3,*k*r*a*0,*11,*m*l*s*f*w*

(20 -> 11), but as commented before some other machines have:
alias:          input:b*v*p*e*-e*3,*k*r*a*0,*m*l*s*f*w*
alias:          input:b*v*p*e*-e*3,*k*r*a*8,*m*l*s*f*w*
alias:          input:b*v*p*e*-e*3,*k*r*a*6,*m*l*s*f*w*

Thus accepting both 20 and 11, which is probably correct. With the problem
narrowed down to this, there are only 2 questions left:
1) kernel or module-init-tools problem
2) locate the problem and fix it

I'm now downloading the kernel and will take a look in which form this info is
in the kernel sources.


Comment 32 Kay Sievers 2006-08-04 09:55:43 UTC
This is a known bug fixed in m-i-t 3.3*, see comment #27. Are you sure you run a
fixed version?

Comment 33 Ralf Ertzinger 2006-08-04 10:13:04 UTC
Works for me:

[sun@sisko ~ :) 7]$ /sbin/modinfo joydev
filename:       /lib/modules/2.6.17-1.2462.fc6/kernel/drivers/input/joydev.ko
author:         Vojtech Pavlik <vojtech>
description:    Joystick device interfaces
license:        GPL
vermagic:       2.6.17-1.2462.fc6 SMP mod_unload 686 REGPARM 4KSTACKS gcc-4.1
depends:        
alias:          input:b*v*p*e*-e*3,*k*r*a*0,*m*l*s*f*w*
alias:          input:b*v*p*e*-e*3,*k*r*a*8,*m*l*s*f*w*
alias:          input:b*v*p*e*-e*3,*k*r*a*6,*m*l*s*f*w*
srcversion:     750C0C08E65178E6C4B5E74
[sun@sisko ~ :) 8]$ rpm -q module-init-tools
module-init-tools-3.3-0.pre1.4.17

Comment 34 Hans de Goede 2006-08-04 10:14:03 UTC
rpm -q module-init-tools: module-init-tools-3.3-0.pre1.4.17.x86_64

Notice the "pre" perhaps that is the problem I'll try downloading the latest
upstream and rebuilding the SRPM with the latest upstream, hopefully that will
fix things.

Comment 35 Hans de Goede 2006-08-04 10:16:06 UTC
I just collided with Ralphs comment, but submitted mine anyway since it was only
a comment.

Thinking some more about Ralphs comment, we run the same version! But ralph is
on an i386 system, so this most likely is a 64 bit related bug!


Comment 36 Hans de Goede 2006-08-04 10:28:11 UTC
Hmm,

Compiling m-i-t gives this:
modprobe.c: In function 'do_command':
modprobe.c:786: warning: field precision should have type 'int', but argument 3
modinfo.c: In function 'main':
modinfo.c:338: warning: 'infosize' may be used uninitialized in this function

The modprobe warning is very likely 64 bit related, but probably unrelated to
this, I'll dig into the source.



Comment 37 Hans de Goede 2006-08-04 10:44:32 UTC
Hmm,

The problem is not in m-i-t, unless m-i-t injects it during the kernel build, a
simple strings on /lib/modules/2.6.17-1.2505.fc6/kernel/drivers/input/joydev.ko
reveals:
alias=input:b*v*p*e*-e*3,*k*r*a*0,*20,*m*l*s*f*w*
alias=input:b*v*p*e*-e*3,*k*r*a*8,*28,*m*l*s*f*w*
alias=input:b*v*p*e*-e*3,*k*r*a*6,*26,*m*l*s*f*w*

So the ,*20 is injected during kernel build, on x86_64 only?


Comment 38 Hans de Goede 2006-08-04 12:57:55 UTC
Getting much much closer now, the problem is in the kernel not in m-i-t,
reassigning.

The problem is somewhere in:
scripts/mod/file2alias.c

In there is the following code for generating the input aliases:
static void do_input(char *alias,
                     kernel_ulong_t *arr, unsigned int min, unsigned int max)
{
        unsigned int i;

        for (i = min; i < max; i++)
                if (arr[i / BITS_PER_LONG] & (1 << (i%BITS_PER_LONG)))
                        sprintf(alias + strlen(alias), "%X,*", i);
}

On 32 bits systems, this correctly generates "0,*" for the first alias, "8,*"
for the second etc.

However on 64 bits it generates: "0,*20,*" resp "8,*28,*" Notice how it adds 20
+ first entry (hex) ! to the list of hex codes, which is 32 more then the first
entry, thus the bit test above appearently wraps at 32 bits instead of 64 for
some reason, or something like that. Investigating further!



Comment 39 Hans de Goede 2006-08-04 13:09:44 UTC
Yes YES *YES*,

I nailed this nasty bug, it could very well affect other input modules too.
scripts/mod/file2alias.c, line 379 reads:
                if (arr[i / BITS_PER_LONG] & (1 << (i%BITS_PER_LONG)))
That should be:
                if (arr[i / BITS_PER_LONG] & (1l << (i%BITS_PER_LONG)))

Notice the added 'l' after the 1, otherwise that is an 32 bit int instead of a
64 bit long, and when that int gets shifted >= 32 times, appearantly the number
by which to shift is wrapped at 5 bits ( % 32) causing it to test a bit 32 bits
too low.

Dave, can you add this fix to the next kernel please? Read the long story above
for the rational.


Comment 40 Hans de Goede 2006-08-10 09:48:31 UTC
Dave,

I know you are really busy, put could you please spare a few minutes and take a
look at this bug. Its a really annoying bug and I've hunted down the cause and
provided a fix for you above. The fix is a one liner (one char actually) and is
trivially correct.

Thanks!


Comment 41 Hans de Goede 2006-08-14 09:59:17 UTC
Created attachment 134122 [details]
Patch fixing auto loading of jodev.ko on x86_64

Since this bug doesn't seem to be moving anywhere, despite beeing very very
easy to fix now that I've provided the fix, I've submitted a patch to fix this
upstream in the hope that this will eventually trickle down inte Fedora.

I've also attached the patch here, so that you can apply it in the mean time.

Comment 42 Hans de Goede 2006-08-19 17:31:36 UTC
The patch has been accepted upstream by GKH and should be merged by Linus when
he returns from his vacation.


Comment 43 Hans de Goede 2006-08-23 05:16:45 UTC
Kernel 2.6.17-1.2573.fc6 from rawhide has picked up the fix for this from GKH's
tree, closing.



Note You need to log in before you can comment on or make changes to this bug.