From: Martin Pitt <martin.pitt@ubuntu.com>
To: linux-hotplug@vger.kernel.org
Subject: Adding input_id to udev
Date: Mon, 30 Nov 2009 09:57:15 +0000 [thread overview]
Message-ID: <20091130095715.GA2440@piware.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 3044 bytes --]
Hello,
in the course of udevifying X.org, we determined that we need a
reliable way of detecting whether an input device is a touchpad (and
thus should be driven by -synaptics instead of -evdev). Our first
attempt [1] uses ATTRS{protocol}=="AlpsPS/2", but that misses a lot of
devices using other protocols.
So at least for now it would be better to actually check the
inputN/capabilities/{key,abs} flags in sysfs, like hal used to do.
I took the hal code as a basis and created an input_id program [2]
which detects the class of a device (since bit testing in udev rules
isn't possible). We can then use this in X.org's and potentially other
rules.
Questions:
* Should we maintain this in udev proper, in extras/input_id/ ? (My
preferred solution, since it's not really X.org specific). I'm up
for maintaining it.
* Should udev itself install rules which call this, or should we just
provide it for other packages to use? Calling it in udev itself
feels a little more robust to me, but it would mean that the
probing would be done in vain on systems which use X.org with hal.
Something like
ACTION=="add|change", SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{program}="input_id /sys/%p"
(I'll drop the /sys/ and move it into input_id.c before committing)
Thanks in advance for comments,
Martin
On my system:
$ gcc -o input_id input_id.c
$ for i in /sys/class/input/input*; do echo -n "--- $i: "; cat $i/name; ./input_id $i; done
--- /sys/class/input/input0: Lid Switch
ID_INPUT=1
--- /sys/class/input/input1: Power Button
ID_INPUT=1
ID_INPUT_KEY=1
--- /sys/class/input/input10: Dell WMI hotkeys
ID_INPUT=1
ID_INPUT_KEY=1
--- /sys/class/input/input11: HDA Intel Line In at Ext Left Jack
ID_INPUT=1
--- /sys/class/input/input12: HDA Intel HP Out at Ext Left Jack
ID_INPUT=1
--- /sys/class/input/input13: DualPoint Stick
ID_INPUT=1
ID_INPUT_MOUSE=1
--- /sys/class/input/input14: AlpsPS/2 ALPS DualPoint TouchPad
ID_INPUT=1
ID_INPUT_MOUSE=1
ID_INPUT_TOUCHPAD=1
--- /sys/class/input/input2: Sleep Button
ID_INPUT=1
ID_INPUT_KEY=1
--- /sys/class/input/input3: Macintosh mouse button emulation
ID_INPUT=1
ID_INPUT_MOUSE=1
--- /sys/class/input/input4: AT Translated Set 2 keyboard
ID_INPUT=1
ID_INPUT_KEY=1
ID_INPUT_KEYBOARD=1
--- /sys/class/input/input5: Video Bus
ID_INPUT=1
ID_INPUT_KEY=1
--- /sys/class/input/input6: Video Bus
ID_INPUT=1
ID_INPUT_KEY=1
--- /sys/class/input/input7: HID 05f3:0007
ID_INPUT=1
ID_INPUT_KEY=1
ID_INPUT_KEYBOARD=1
##### ^^^ This is an USB keyboard, so this is correct.
--- /sys/class/input/input8: HID 05f3:0007
ID_INPUT=1
ID_INPUT_KEY=1
--- /sys/class/input/input9: Logitech USB-PS/2 Optical Mouse
ID_INPUT=1
ID_INPUT_MOUSE=1
[1] http://people.canonical.com/~pitti/tmp/66-xorg-synaptics.rules
[2] http://people.canonical.com/~pitti/tmp/input_id.c
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next reply other threads:[~2009-11-30 9:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-30 9:57 Martin Pitt [this message]
2009-11-30 13:42 ` Adding input_id to udev Dan Nicholson
2009-11-30 19:27 ` Martin Pitt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091130095715.GA2440@piware.de \
--to=martin.pitt@ubuntu.com \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).