Re: [PATCH] Re: SERIO_USERDEV patch for 2.6

From: Sau Dan Lee
Date: Thu Jun 03 2004 - 07:22:51 EST


>>>>> "Tuukka" == Tuukka Toivonen <tuukkat@xxxxxxxxxx> writes:


>> On Sun, 30 May 2004, Vojtech Pavlik wrote:
>>> Coexisting would mean that when someone wants to open the raw
>>> device, the serio layer would disconnect the psmouse driver,
>>> and give control to the raw device instead. I believe that
>>> could work.

Tuukka> Done, with slight modification: if the device is opened in
Tuukka> read-only mode, the kernel drivers are not
Tuukka> disconnected. This way the serio port could be controlled
Tuukka> via IOCTL even when assigned to kernel drivers, if it ever
Tuukka> becomes useful. Useful also for debugging etc.

Thanks for the great work, Tuukka! :)

I've just tried it. I loaded 'psmouse' and 'mousedev' and
/proc/bus/input/devices does show the PS/2 AUX port being treated as a
mouse device, handled by 'mousedev'. Then, I start gpm on
/dev/misc/isa0060_serio1, and it works successfully. The mouse device
disappears from /proc/bus/input/devices. When I kill gpm, the kernel
gets control again and the mouse device shows up again in
/proc/.../devices.



Tuukka> The last change I made converts slashes '/' into
Tuukka> underscores '_' (so eg. isa0060/serio0 is changed to
Tuukka> isa0060_serio0 in /proc/misc, /dev with devfs, and /sys)
Tuukka> because Sau Dan Lee reported that slashes don't work well
Tuukka> with sysfs.

It now works in sysfs.

$ cat /sys/class/misc/psaux/dev
10:1
$ cat /sys/class/misc/isa0060_serio1/dev
10:63


Tuukka> I tested the patch in a couple of machines, especially the
Tuukka> new features. Seems to work finely.

Works fine on mine, too.



Tuukka> Compared to Dmitry's rawdev patch, this has a number of
Tuukka> advantages:

Tuukka> - Supports all serio ports without any additional kernel
Tuukka> parameters. Binding between kernel/user driver is done
Tuukka> automatically.

This is wonderful! Or consider my serio_switch patch. We don't need
to want for 2.6.10 when they would eventually add that together with
the sysfs interface.


Tuukka> - Supports multiple drivers on the same port, unlike
Tuukka> Dmitry's rawdev, which works just similarly as 2.4.x psaux
Tuukka> which didn't work with e.g. X11 and gpm together without
Tuukka> a repeater feed, because multiple drivers are fighting for
Tuukka> the byte streams.

On my system X and gpm do live with each other without conflicts, both
accessing /dev/psaux (either on 2.4 or 2.6+SERIO_USERDEV). Both
programs can detect VT switching and close the port when losing
"focus".


Tuukka> (Doesn't still allow multiple kernel drivers nor a kernel
Tuukka> driver with a complete user drivers with write access
Tuukka> since the required infrastructure is missing in serio.c
Tuukka> aka serio-core.c: kernel internal drivers can't lock a
Tuukka> port).

That's a part of the design of the whole serio subsystem. Unless the
design is reworked, you can't do much about it. The basic assumption
is: each port can be connected to only one device, whether the device
is in kernel or userland. That our SERIO_USERDEV allows userland to
overhear (O_RDONLY) the traffic is a special bonus feature.



--
Sau Dan LEE ???(Big5) ~{@nJX6X~}(HZ)

E-mail: danlee@xxxxxxxxxxxxxxxxxxxxxxxxxx
Home page: http://www.informatik.uni-freiburg.de/~danlee

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/