Skip to contentSkip to conversation

sysfs change of input/event devices in 2.6.23rc breaks udev

DISCUSSION Anssi Hannula 7 participants 12 messages Sep 8, 2007 – Sep 15, 2007 HID

lore
Share & tools
lore
#0 lore raw

Hi!

There seem to be changes in sysfs input structure between 2.6.22 and 2.6.23-rc5 which cause some breakage.

With 2.6.22:

Quoted 13 lines

# LC_ALL=C ls -l /sys/class/input/input4
total 0

drwxr-xr-x 2 root root    0 Sep  8 12:51 capabilities/
lrwxrwxrwx 1 root root    0 Sep  8 19:48 device -> ../../../devices/platform/pcspkr/
drwxr-xr-x 2 root root    0 Sep  8 12:51 event4/
drwxr-xr-x 2 root root    0 Sep  8 12:51 id/
(quoted diff) +0 -3
-r--r--r-- 1 root root 4096 Sep  8 19:48 modalias
-r--r--r-- 1 root root 4096 Sep  8 19:48 name
-r--r--r-- 1 root root 4096 Sep  8 19:48 phys
lrwxrwxrwx 1 root root    0 Sep  8 19:48 subsystem -> ../../../class/input/
--w------- 1 root root 4096 Sep  8 19:48 uevent
-r--r--r-- 1 root root 4096 Sep  8 19:48 uniq
Quoted 8 lines
# ls -l /sys/class/input/event4
lrwxrwxrwx 1 root root 0 Sep  8 19:48 /sys/class/input/event4 -> ../../class/input/input4/event4/
# ls -l /sys/class/input/event4/
total 0
-r--r--r-- 1 root root 4096 Sep  8 19:58 dev
lrwxrwxrwx 1 root root    0 Sep  8 19:58 device -> ../../../../devices/platform/pcspkr/
lrwxrwxrwx 1 root root    0 Sep  8 19:58 subsystem -> ../../../../class/input/
--w------- 1 root root 4096 Sep  8 19:58 uevent

With 2.6.23-rc5:

Quoted 14 lines
# ls -l /sys/class/input/input5
total 0
drwxr-xr-x 2 root root    0 Sep  8 19:47 capabilities/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 device -> ../../../devices/platform/pcspkr/
drwxr-xr-x 2 root root    0 Sep  8 19:47 id/
lrwxrwxrwx 1 root root    0 Sep  8 19:47 input:event5 -> ../../../class/input/event5/
(quoted diff) +0 -3
-r--r--r-- 1 root root 4096 Sep  8 19:03 modalias
-r--r--r-- 1 root root 4096 Sep  8 19:03 name
-r--r--r-- 1 root root 4096 Sep  8 19:47 phys
drwxr-xr-x 2 root root    0 Sep  8 19:47 power/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 subsystem -> ../../../class/input/
(quoted diff) +0 -2
-rw-r--r-- 1 root root 4096 Sep  8 19:03 uevent
-r--r--r-- 1 root root 4096 Sep  8 19:47 uniq
Quoted 7 lines
# ls -l /sys/class/input/event5
total 0
-r--r--r-- 1 root root 4096 Sep  8 19:03 dev
lrwxrwxrwx 1 root root    0 Sep  8 19:03 device -> ../../../class/input/input5/
drwxr-xr-x 2 root root    0 Sep  8 19:48 power/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 subsystem -> ../../../class/input/
-rw-r--r-- 1 root root 4096 Sep  8 19:03 uevent

There are a few changes.

There is no longer:
/sys/class/input/eventX => /sys/class/input/inputX/eventX
instead there is:
/sys/class/inputX/input:eventX => /sys/class/input/eventX
Notice the added "input:". I don't know if any software depends on this, though.

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

Signature · 1 line
Anssi Hannula
#1 lore raw
Quoted 5 lines · Anssi Hannula

Hi!

There seem to be changes in sysfs input structure between 2.6.22 and 2.6.23-rc5 which cause some breakage.

I'm running 2.6.23-rc5 in up-to-date cooker.

Quoted 29 lines

With 2.6.22:

Quoted 15 lines

# LC_ALL=C ls -l /sys/class/input/input4
total 0

drwxr-xr-x 2 root root    0 Sep  8 12:51 capabilities/
lrwxrwxrwx 1 root root    0 Sep  8 19:48 device ->
../../../devices/platform/pcspkr/
drwxr-xr-x 2 root root    0 Sep  8 12:51 event4/
drwxr-xr-x 2 root root    0 Sep  8 12:51 id/
(quoted diff) +0 -3
-r--r--r-- 1 root root 4096 Sep  8 19:48 modalias
-r--r--r-- 1 root root 4096 Sep  8 19:48 name
-r--r--r-- 1 root root 4096 Sep  8 19:48 phys

lrwxrwxrwx 1 root root 0 Sep 8 19:48 subsystem ->
../../../class/input/
--w------- 1 root root 4096 Sep 8 19:48 uevent
-r--r--r-- 1 root root 4096 Sep 8 19:48 uniq

Quoted 11 lines
# ls -l /sys/class/input/event4
lrwxrwxrwx 1 root root 0 Sep  8 19:48 /sys/class/input/event4 ->
../../class/input/input4/event4/
# ls -l /sys/class/input/event4/
total 0
-r--r--r-- 1 root root 4096 Sep  8 19:58 dev
lrwxrwxrwx 1 root root    0 Sep  8 19:58 device ->
../../../../devices/platform/pcspkr/
lrwxrwxrwx 1 root root    0 Sep  8 19:58 subsystem ->
../../../../class/input/
--w------- 1 root root 4096 Sep  8 19:58 uevent
Quoted 10 lines

With 2.6.23-rc5:

Quoted 8 lines
# ls -l /sys/class/input/input5
total 0
drwxr-xr-x 2 root root    0 Sep  8 19:47 capabilities/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 device ->
../../../devices/platform/pcspkr/
drwxr-xr-x 2 root root    0 Sep  8 19:47 id/
lrwxrwxrwx 1 root root    0 Sep  8 19:47 input:event5 ->
../../../class/input/event5/

I do not have this

Quoted 33 lines
Quoted 9 lines
(quoted diff) +0 -3
-r--r--r-- 1 root root 4096 Sep  8 19:03 modalias
-r--r--r-- 1 root root 4096 Sep  8 19:03 name
-r--r--r-- 1 root root 4096 Sep  8 19:47 phys
drwxr-xr-x 2 root root    0 Sep  8 19:47 power/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 subsystem ->

../../../class/input/

(quoted diff) +0 -2
-rw-r--r-- 1 root root 4096 Sep  8 19:03 uevent
-r--r--r-- 1 root root 4096 Sep  8 19:47 uniq
Quoted 9 lines
# ls -l /sys/class/input/event5
total 0
-r--r--r-- 1 root root 4096 Sep  8 19:03 dev
lrwxrwxrwx 1 root root    0 Sep  8 19:03 device ->
../../../class/input/input5/
drwxr-xr-x 2 root root    0 Sep  8 19:48 power/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 subsystem ->
../../../class/input/
-rw-r--r-- 1 root root 4096 Sep  8 19:03 uevent

There are a few changes.

There is no longer:
/sys/class/input/eventX => /sys/class/input/inputX/eventX instead there is:
/sys/class/inputX/input:eventX => /sys/class/input/eventX Notice the added "input:". I don't know if any software depends on this, though.

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Quoted 6 lines

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

I am using 2.6.23-rc5 in current cooker and I did not notice any breakage; could you please show example of wrong path? E.g. I have

{pts/0}% LC_ALL=C ll /dev/input/by-path
total 0
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-0-event-kbd -> ../event0
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-1-event-mouse -> ../event1
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-1-mouse -> ../mouse0

and it looks pretty sane for me.

Oh, and I do not have CONFIG_SYSFS_DEPRECATED which probably explains why it works for me :)

{pts/0}% LC_ALL=C ll /sys/class/input/input2/
total 0

drwxr-xr-x 2 root root    0 Sep  8 22:25 capabilities/
drwxr-xr-x 3 root root    0 Sep  8 22:22 event2/
drwxr-xr-x 2 root root    0 Sep  8 22:25 id/
-r--r--r-- 1 root root 4096 Sep  8 22:25 modalias
-r--r--r-- 1 root root 4096 Sep  8 22:25 name
-r--r--r-- 1 root root 4096 Sep  8 22:25 phys
drwxr-xr-x 2 root root    0 Sep  8 22:25 power/
lrwxrwxrwx 1 root root    0 Sep  8 22:25

subsystem -> ../../../../class/input/
-rw-r--r-- 1 root root 4096 Sep 8 22:25 uevent
-r--r--r-- 1 root root 4096 Sep 8 22:25 uniq

this implies that SYSFS_DEPRECATED may be broken w.r.t. udev; OTOH it *is* deprecated, is not it?

-andrey

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
Quoted 7 lines · Andrey Borzenkov
Quoted 5 lines · Anssi Hannula

Hi!

There seem to be changes in sysfs input structure between 2.6.22 and 2.6.23-rc5 which cause some breakage.

[...]

Quoted 12 lines
Quoted 12 lines

There is no longer:
/sys/class/input/eventX => /sys/class/input/inputX/eventX instead there is:
/sys/class/inputX/input:eventX => /sys/class/input/eventX Notice the added "input:". I don't know if any software depends on this, though.

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Quoted 8 lines
Quoted 6 lines

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

I am using 2.6.23-rc5 in current cooker

Same kernel here, but on an older system (MDV2007.1). I tested with a path_id from a recent udev as well, though, but the problem was there as well.

Quoted 11 lines

and I did not notice any breakage; could you please show example of wrong path? E.g. I have

{pts/0}% LC_ALL=C ll /dev/input/by-path
total 0
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-0-event-kbd -> ../event0
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-1-event-mouse -> ../event1
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-1-mouse -> ../mouse0

Quoted 1 line

and it looks pretty sane for me.

I don't have anything under /dev/input/by-path as the lookup in path_id fails.

Quoted 2 lines

Oh, and I do not have CONFIG_SYSFS_DEPRECATED which probably explains why it works for me :)

Probably.

Review

Quoted 13 lines

{pts/0}% LC_ALL=C ll /sys/class/input/input2/
total 0

drwxr-xr-x 2 root root    0 Sep  8 22:25 capabilities/
drwxr-xr-x 3 root root    0 Sep  8 22:22 event2/
drwxr-xr-x 2 root root    0 Sep  8 22:25 id/
(quoted diff) +0 -3
-r--r--r-- 1 root root 4096 Sep  8 22:25 modalias
-r--r--r-- 1 root root 4096 Sep  8 22:25 name
-r--r--r-- 1 root root 4096 Sep  8 22:25 phys
drwxr-xr-x 2 root root    0 Sep  8 22:25 power/
lrwxrwxrwx 1 root root    0 Sep  8 22:25

subsystem -> ../../../../class/input/

(quoted diff) +0 -2
-rw-r--r-- 1 root root 4096 Sep  8 22:25 uevent
-r--r--r-- 1 root root 4096 Sep  8 22:25 uniq

What does this print as devpath for you:

$ udevinfo -q all --name=input/event0

For me on 2.6.23rc5 it prints:
P: /class/input/event0
and on 2.6.22:
P: /class/input/input0/event0

Both are detected as "old sysfs layout" by path_id, but only on 2.6.22 is there a /device symlink pointing to the expected location.

I suspect it prints something like /devices/xyz for you, right?
That seems to be detected as "new sysfs layout" by path_id and handled differently.

Quoted 2 lines

this implies that SYSFS_DEPRECATED may be broken w.r.t. udev; OTOH it *is* deprecated, is not it?

Indeed, at least regarding input subsystem, for which there was a recent switchover [1] from class_device.

[1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=9657d75c5f0f7d0a9cb507521d3ad1436aea28c9

Signature · 1 line
Anssi Hannula
#3 lore raw
Quoted 70 lines · Anssi Hannula
Quoted 5 lines · Andrey Borzenkov
Quoted 4 lines · Anssi Hannula

Hi!

There seem to be changes in sysfs input structure between 2.6.22 and 2.6.23-rc5 which cause some breakage.

[...]

Quoted 12 lines
Quoted 12 lines

There is no longer:
/sys/class/input/eventX => /sys/class/input/inputX/eventX instead there is:
/sys/class/inputX/input:eventX => /sys/class/input/eventX Notice the added "input:". I don't know if any software depends on this, though.

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Quoted 7 lines
Quoted 5 lines

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

I am using 2.6.23-rc5 in current cooker

Same kernel here, but on an older system (MDV2007.1). I tested with a path_id from a recent udev as well, though, but the problem was there as well.

Quoted 12 lines

and I did not notice any breakage;
could you please show example of wrong path? E.g. I have

{pts/0}% LC_ALL=C ll /dev/input/by-path
total 0
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-0-event-kbd -> ../event0
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-1-event-mouse -> ../event1
lrwxrwxrwx 1 root root 9 Sep 2 15:00
platform-i8042-serio-1-mouse -> ../mouse0

Quoted 1 line

and it looks pretty sane for me.

I don't have anything under /dev/input/by-path as the lookup in path_id fails.

Quoted 2 lines

Oh, and I do not have CONFIG_SYSFS_DEPRECATED which probably explains why it works for me :)

Probably.

Review

Quoted 13 lines

{pts/0}% LC_ALL=C ll /sys/class/input/input2/
total 0

drwxr-xr-x 2 root root    0 Sep  8 22:25 capabilities/
drwxr-xr-x 3 root root    0 Sep  8 22:22 event2/
drwxr-xr-x 2 root root    0 Sep  8 22:25 id/
(quoted diff) +0 -3
-r--r--r-- 1 root root 4096 Sep  8 22:25 modalias
-r--r--r-- 1 root root 4096 Sep  8 22:25 name
-r--r--r-- 1 root root 4096 Sep  8 22:25 phys
drwxr-xr-x 2 root root    0 Sep  8 22:25 power/
lrwxrwxrwx 1 root root    0 Sep  8 22:25

subsystem -> ../../../../class/input/

(quoted diff) +0 -2
-rw-r--r-- 1 root root 4096 Sep  8 22:25 uevent
-r--r--r-- 1 root root 4096 Sep  8 22:25 uniq

What does this print as devpath for you:

Quoted 2 lines
$ udevinfo -q all --name=input/event0

{pts/1}% udevinfo -q all --name input/event0
P: /devices/platform/i8042/serio0/input/input0/event0
N: input/event0
S: input/by-path/platform-i8042-serio-0-event-kbd
E: ID_CLASS=kbd
E: ID_SERIAL=noserial
E: ID_PATH=platform-i8042-serio-0

Quoted 12 lines

For me on 2.6.23rc5 it prints:
P: /class/input/event0
and on 2.6.22:
P: /class/input/input0/event0

Both are detected as "old sysfs layout" by path_id, but only on 2.6.22 is there a /device symlink pointing to the expected location.

I suspect it prints something like /devices/xyz for you, right? That seems to be detected as "new sysfs layout" by path_id and handled differently.

Quoted 6 lines
Quoted 2 lines

this implies that SYSFS_DEPRECATED may be broken w.r.t. udev; OTOH it *is* deprecated, is not it?

Indeed, at least regarding input subsystem, for which there was a recent switchover [1] from class_device.

If this does not work with current udev this can be considred kernel regression as far as I can tell.

-andrey

Quoted 3 lines

[1]
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdi
ff;h=9657d75c5f0f7d0a9cb507521d3ad1436aea28c9

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#4 lore raw
In reply to Anssi Hannula
Quoted 65 lines · Anssi Hannula

There seem to be changes in sysfs input structure between 2.6.22 and 2.6.23-rc5 which cause some breakage.

With 2.6.22:

Quoted 13 lines

# LC_ALL=C ls -l /sys/class/input/input4
total 0

drwxr-xr-x 2 root root    0 Sep  8 12:51 capabilities/
lrwxrwxrwx 1 root root    0 Sep  8 19:48 device -> ../../../devices/platform/pcspkr/
drwxr-xr-x 2 root root    0 Sep  8 12:51 event4/
drwxr-xr-x 2 root root    0 Sep  8 12:51 id/
(quoted diff) +0 -3
-r--r--r-- 1 root root 4096 Sep  8 19:48 modalias
-r--r--r-- 1 root root 4096 Sep  8 19:48 name
-r--r--r-- 1 root root 4096 Sep  8 19:48 phys
lrwxrwxrwx 1 root root    0 Sep  8 19:48 subsystem -> ../../../class/input/
--w------- 1 root root 4096 Sep  8 19:48 uevent
-r--r--r-- 1 root root 4096 Sep  8 19:48 uniq
Quoted 8 lines
# ls -l /sys/class/input/event4
lrwxrwxrwx 1 root root 0 Sep  8 19:48 /sys/class/input/event4 -> ../../class/input/input4/event4/
# ls -l /sys/class/input/event4/
total 0
-r--r--r-- 1 root root 4096 Sep  8 19:58 dev
lrwxrwxrwx 1 root root    0 Sep  8 19:58 device -> ../../../../devices/platform/pcspkr/
lrwxrwxrwx 1 root root    0 Sep  8 19:58 subsystem -> ../../../../class/input/
--w------- 1 root root 4096 Sep  8 19:58 uevent

With 2.6.23-rc5:

Quoted 14 lines
# ls -l /sys/class/input/input5
total 0
drwxr-xr-x 2 root root    0 Sep  8 19:47 capabilities/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 device -> ../../../devices/platform/pcspkr/
drwxr-xr-x 2 root root    0 Sep  8 19:47 id/
lrwxrwxrwx 1 root root    0 Sep  8 19:47 input:event5 -> ../../../class/input/event5/
(quoted diff) +0 -3
-r--r--r-- 1 root root 4096 Sep  8 19:03 modalias
-r--r--r-- 1 root root 4096 Sep  8 19:03 name
-r--r--r-- 1 root root 4096 Sep  8 19:47 phys
drwxr-xr-x 2 root root    0 Sep  8 19:47 power/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 subsystem -> ../../../class/input/
(quoted diff) +0 -2
-rw-r--r-- 1 root root 4096 Sep  8 19:03 uevent
-r--r--r-- 1 root root 4096 Sep  8 19:47 uniq
Quoted 7 lines
# ls -l /sys/class/input/event5
total 0
-r--r--r-- 1 root root 4096 Sep  8 19:03 dev
lrwxrwxrwx 1 root root    0 Sep  8 19:03 device -> ../../../class/input/input5/
drwxr-xr-x 2 root root    0 Sep  8 19:48 power/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 subsystem -> ../../../class/input/
-rw-r--r-- 1 root root 4096 Sep  8 19:03 uevent

There are a few changes.

There is no longer:
/sys/class/input/eventX => /sys/class/input/inputX/eventX instead there is:
/sys/class/inputX/input:eventX => /sys/class/input/eventX Notice the added "input:". I don't know if any software depends on this, though.

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Quoted 4 lines

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

Udev's path_id script is too dumb to follow the "device" link of stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does this change fix it for you?
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f

Thanks,
Kay

#5 lore raw
Quoted 82 lines · Kay Sievers
Quoted 75 lines · Anssi Hannula

There seem to be changes in sysfs input structure between 2.6.22 and 2.6.23-rc5 which cause some breakage.

With 2.6.22:

Quoted 15 lines

# LC_ALL=C ls -l /sys/class/input/input4
total 0

drwxr-xr-x 2 root root    0 Sep  8 12:51 capabilities/
lrwxrwxrwx 1 root root    0 Sep  8 19:48 device ->
../../../devices/platform/pcspkr/
drwxr-xr-x 2 root root    0 Sep  8 12:51 event4/
drwxr-xr-x 2 root root    0 Sep  8 12:51 id/
(quoted diff) +0 -3
-r--r--r-- 1 root root 4096 Sep  8 19:48 modalias
-r--r--r-- 1 root root 4096 Sep  8 19:48 name
-r--r--r-- 1 root root 4096 Sep  8 19:48 phys

lrwxrwxrwx 1 root root 0 Sep 8 19:48 subsystem ->
../../../class/input/
--w------- 1 root root 4096 Sep 8 19:48 uevent
-r--r--r-- 1 root root 4096 Sep 8 19:48 uniq

Quoted 11 lines
# ls -l /sys/class/input/event4
lrwxrwxrwx 1 root root 0 Sep  8 19:48 /sys/class/input/event4 ->
../../class/input/input4/event4/
# ls -l /sys/class/input/event4/
total 0
-r--r--r-- 1 root root 4096 Sep  8 19:58 dev
lrwxrwxrwx 1 root root    0 Sep  8 19:58 device ->
../../../../devices/platform/pcspkr/
lrwxrwxrwx 1 root root    0 Sep  8 19:58 subsystem ->
../../../../class/input/
--w------- 1 root root 4096 Sep  8 19:58 uevent

With 2.6.23-rc5:

Quoted 17 lines
# ls -l /sys/class/input/input5
total 0
drwxr-xr-x 2 root root    0 Sep  8 19:47 capabilities/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 device ->
../../../devices/platform/pcspkr/
drwxr-xr-x 2 root root    0 Sep  8 19:47 id/
lrwxrwxrwx 1 root root    0 Sep  8 19:47 input:event5 ->
../../../class/input/event5/
(quoted diff) +0 -3
-r--r--r-- 1 root root 4096 Sep  8 19:03 modalias
-r--r--r-- 1 root root 4096 Sep  8 19:03 name
-r--r--r-- 1 root root 4096 Sep  8 19:47 phys
drwxr-xr-x 2 root root    0 Sep  8 19:47 power/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 subsystem ->

../../../class/input/

(quoted diff) +0 -2
-rw-r--r-- 1 root root 4096 Sep  8 19:03 uevent
-r--r--r-- 1 root root 4096 Sep  8 19:47 uniq
Quoted 9 lines
# ls -l /sys/class/input/event5
total 0
-r--r--r-- 1 root root 4096 Sep  8 19:03 dev
lrwxrwxrwx 1 root root    0 Sep  8 19:03 device ->
../../../class/input/input5/
drwxr-xr-x 2 root root    0 Sep  8 19:48 power/
lrwxrwxrwx 1 root root    0 Sep  8 19:03 subsystem ->
../../../class/input/
-rw-r--r-- 1 root root 4096 Sep  8 19:03 uevent

There are a few changes.

There is no longer:
/sys/class/input/eventX => /sys/class/input/inputX/eventX instead there is:
/sys/class/inputX/input:eventX => /sys/class/input/eventX Notice the added "input:". I don't know if any software depends on this, though.

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Quoted 5 lines

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

Quoted 4 lines

Udev's path_id script is too dumb to follow the "device" link of stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does this change fix it for you?

http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f

Quoted 1 line

This just delays the issue until we have 3 levels of indirection :)

#6 lore raw
In reply to Kay Sievers
Quoted 12 lines · Kay Sievers
Quoted 10 lines · Anssi Hannula

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

Quoted 5 lines

Udev's path_id script is too dumb to follow the "device" link of stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does this change fix it for you?
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f

Hmm, fixing udev is good but users will not get the change in time. I think we need to adjust SYSFS_DEPRECATED code to produce old results. Something like the patch below. I wonder what Greg would think...

Signature · 63 lines
Dmitry

Driver core: fix deprectated sysfs structure for nested class devices

Nested class devices used to have 'device' symlink point to a real
(physical) device instead of a parent class device. When converting
subsystems to struct device we need to keep doing what class devices
did if CONFIG_SYSFS_DEPRECATED is Y, otherwise parts of udev break.

Signed-off-by: Dmitry Torokhov <[email protected]>
---
 drivers/base/core.c |   29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

Index: work/drivers/base/core.c
===================================================================
--- work.orig/drivers/base/core.c
+++ work/drivers/base/core.c
@@ -679,14 +679,26 @@ static int device_add_class_symlinks(str
 			goto out_subsys;
 	}
 	if (dev->parent) {
-		error = sysfs_create_link(&dev->kobj, &dev->parent->kobj,
-					  "device");
-		if (error)
-			goto out_busid;
 #ifdef CONFIG_SYSFS_DEPRECATED
 		{
-			char * class_name = make_class_name(dev->class->name,
-								&dev->kobj);
+			struct device *parent = dev->parent;
+			char *class_name;
+
+			/*
+			 * In old sysfs stacked class devices had 'device'
+			 * link pointing to real device instead of parent
+			 */
+			while (parent->class && !parent->bus && parent->parent)
+				parent = parent->parent;
+
+			error = sysfs_create_link(&dev->kobj,
+						  &parent->kobj,
+						  "device");
+			if (error)
+				goto out_busid;
+
+			class_name = make_class_name(dev->class->name,
+							&dev->kobj);
 			if (class_name)
 				error = sysfs_create_link(&dev->parent->kobj,
 							&dev->kobj, class_name);
@@ -694,6 +706,11 @@ static int device_add_class_symlinks(str
 			if (error)
 				goto out_device;
 		}
+#else
+		error = sysfs_create_link(&dev->kobj, &dev->parent->kobj,
+					  "device");
+		if (error)
+			goto out_busid;
 #endif
 	}
 	return 0;
#7 lore raw
Quoted 19 lines · Dmitry Torokhov
Quoted 12 lines · Kay Sievers
Quoted 10 lines · Anssi Hannula

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

Quoted 5 lines

Udev's path_id script is too dumb to follow the "device" link of stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does this change fix it for you?
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f

Quoted 3 lines

Hmm, fixing udev is good but users will not get the change in time. I think we need to adjust SYSFS_DEPRECATED code to produce old results. Something like the patch below. I wonder what Greg would think...

Hm, I don't understand. Didn't the original conversion of the input layer by Kay not have this kind of problem? What did your changes do differently to cause this driver core change to be needed?

thanks,

greg k-h

#8 lore raw
Quoted 20 lines · Greg KH
Quoted 19 lines · Dmitry Torokhov
Quoted 17 lines · Kay Sievers
Quoted 10 lines · Anssi Hannula

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

Udev's path_id script is too dumb to follow the "device" link of stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does this change fix it for you?
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f

Quoted 8 lines
Quoted 3 lines

Hmm, fixing udev is good but users will not get the change in time. I think we need to adjust SYSFS_DEPRECATED code to produce old results. Something like the patch below. I wonder what Greg would think...

Hm, I don't understand. Didn't the original conversion of the input layer by Kay not have this kind of problem? What did your changes do differently to cause this driver core change to be needed?

If I understand it correctly Kay's convesion had the same issue. With class devices "device" link points to class_dev->device instead of class_dev->parent. If you want to keep compatibility with old sysfs layout when moving from class devices to regular devices then you need to "skip" couple of parents till you get to "real" device. This only matters for input because this was the only subsystem with class devices stacked.

Signature · 1 line
Dmitry
#9 lore raw
Quoted 30 lines · On Mon, 10 Sep 2007 09:24:04 -0400 "Dmitry Torokhov"…
Quoted 20 lines · Greg KH
Quoted 19 lines · Dmitry Torokhov
Quoted 17 lines · Kay Sievers
Quoted 10 lines · Anssi Hannula

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

Udev's path_id script is too dumb to follow the "device" link of stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does this change fix it for you?
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f

Quoted 8 lines
Quoted 3 lines

Hmm, fixing udev is good but users will not get the change in time. I think we need to adjust SYSFS_DEPRECATED code to produce old results. Something like the patch below. I wonder what Greg would think...

Hm, I don't understand. Didn't the original conversion of the input layer by Kay not have this kind of problem? What did your changes do differently to cause this driver core change to be needed?

Quoted 8 lines

If I understand it correctly Kay's convesion had the same issue. With class devices "device" link points to class_dev->device instead of class_dev->parent. If you want to keep compatibility with old sysfs layout when moving from class devices to regular devices then you need to "skip" couple of parents till you get to "real" device. This only matters for input because this was the only subsystem with class devices stacked.

<wonders where the rest of this thread went to>

Did this userspace-visible post-2.6.22 regression get fixed?

#10 lore raw
Quoted 41 lines · Andrew Morton
Quoted 30 lines · On Mon, 10 Sep 2007 09:24:04 -0400 "Dmitry Torokhov"…
Quoted 20 lines · Greg KH
Quoted 19 lines · Dmitry Torokhov
Quoted 17 lines · Kay Sievers
Quoted 10 lines · Anssi Hannula

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

Udev's path_id script is too dumb to follow the "device" link of stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does this change fix it for you?
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f

Quoted 8 lines
Quoted 3 lines

Hmm, fixing udev is good but users will not get the change in time. I think we need to adjust SYSFS_DEPRECATED code to produce old results. Something like the patch below. I wonder what Greg would think...

Hm, I don't understand. Didn't the original conversion of the input layer by Kay not have this kind of problem? What did your changes do differently to cause this driver core change to be needed?

Quoted 8 lines

If I understand it correctly Kay's convesion had the same issue. With class devices "device" link points to class_dev->device instead of class_dev->parent. If you want to keep compatibility with old sysfs layout when moving from class devices to regular devices then you need to "skip" couple of parents till you get to "real" device. This only matters for input because this was the only subsystem with class devices stacked.

Quoted 1 line

<wonders where the rest of this thread went to>

Limbo ;)

Anssi, could you please tell me if the patch fixes the issue on your box?

Quoted 3 lines

Did this userspace-visible post-2.6.22 regression get fixed?

I'd like the patch to go through Greg if he is OK with it.

Signature · 1 line
Dmitry
#11 lore raw
Quoted 36 lines · Dmitry Torokhov
Quoted 35 lines · Andrew Morton
Quoted 33 lines · On Mon, 10 Sep 2007 09:24:04 -0400 "Dmitry Torokhov"…
Quoted 17 lines · Greg KH
Quoted 16 lines · Dmitry Torokhov
Quoted 15 lines · Kay Sievers
Quoted 9 lines · Anssi Hannula

However, the change that broke id_path of udev is that /sys/class/input/event5/device is now a symlink to the inputX directory instead of being the same as the device symlink in inputX directory, i.e. to ../../../devices/platform/pcspkr in this case.

Udev id_path uses that directory to construct the ID_PATH variable. Should the sysfs structure be reverted or should udev be adapted to handle traversing /device symlink twice? I think the former, as there should be considerably more time to adapt udev for coming changes in sysfs.

Udev's path_id script is too dumb to follow the "device" link of stacked class devices in the CONFIG_SYSFS_DEPRECATED=y layout. Does this change fix it for you?
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff_plain;h=b1ac36ff5e3756cefc79967a26280056da31bf6f

Quoted 7 lines
Quoted 3 lines

Hmm, fixing udev is good but users will not get the change in time. I think we need to adjust SYSFS_DEPRECATED code to produce old results. Something like the patch below. I wonder what Greg would think...

Hm, I don't understand. Didn't the original conversion of the input layer by Kay not have this kind of problem? What did your changes do differently to cause this driver core change to be needed?

If I understand it correctly Kay's convesion had the same issue. With class devices "device" link points to class_dev->device instead of class_dev->parent. If you want to keep compatibility with old sysfs layout when moving from class devices to regular devices then you need to "skip" couple of parents till you get to "real" device. This only matters for input because this was the only subsystem with class devices stacked.

Quoted 5 lines
Quoted 1 line

<wonders where the rest of this thread went to>

Limbo ;)

Anssi, could you please tell me if the patch fixes the issue on your box?

It does.

Quoted 5 lines
Quoted 2 lines

Did this userspace-visible post-2.6.22 regression get fixed?

I'd like the patch to go through Greg if he is OK with it.

Signature · 1 line
Anssi Hannula