From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Pitt Date: Mon, 30 Nov 2009 09:57:15 +0000 Subject: Adding input_id to udev Message-Id: <20091130095715.GA2440@piware.de> MIME-Version: 1 Content-Type: multipart/mixed; boundary="bp/iNruPH9dso1Pn" List-Id: To: linux-hotplug@vger.kernel.org --bp/iNruPH9dso1Pn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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}=3D=3D"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=3D=3D"add|change", SUBSYSTEM=3D=3D"input", ENV{ID_INPUT}=3D=3D"",= IMPORT{program}=3D"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; ./i= nput_id $i; done --- /sys/class/input/input0: Lid Switch ID_INPUT=3D1 --- /sys/class/input/input1: Power Button ID_INPUT=3D1 ID_INPUT_KEY=3D1 --- /sys/class/input/input10: Dell WMI hotkeys ID_INPUT=3D1 ID_INPUT_KEY=3D1 --- /sys/class/input/input11: HDA Intel Line In at Ext Left Jack ID_INPUT=3D1 --- /sys/class/input/input12: HDA Intel HP Out at Ext Left Jack ID_INPUT=3D1 --- /sys/class/input/input13: DualPoint Stick ID_INPUT=3D1 ID_INPUT_MOUSE=3D1 --- /sys/class/input/input14: AlpsPS/2 ALPS DualPoint TouchPad ID_INPUT=3D1 ID_INPUT_MOUSE=3D1 ID_INPUT_TOUCHPAD=3D1 --- /sys/class/input/input2: Sleep Button ID_INPUT=3D1 ID_INPUT_KEY=3D1 --- /sys/class/input/input3: Macintosh mouse button emulation ID_INPUT=3D1 ID_INPUT_MOUSE=3D1 --- /sys/class/input/input4: AT Translated Set 2 keyboard ID_INPUT=3D1 ID_INPUT_KEY=3D1 ID_INPUT_KEYBOARD=3D1 --- /sys/class/input/input5: Video Bus ID_INPUT=3D1 ID_INPUT_KEY=3D1 --- /sys/class/input/input6: Video Bus ID_INPUT=3D1 ID_INPUT_KEY=3D1 --- /sys/class/input/input7: HID 05f3:0007 ID_INPUT=3D1 ID_INPUT_KEY=3D1 ID_INPUT_KEYBOARD=3D1 ##### ^^^ This is an USB keyboard, so this is correct. --- /sys/class/input/input8: HID 05f3:0007 ID_INPUT=3D1 ID_INPUT_KEY=3D1 --- /sys/class/input/input9: Logitech USB-PS/2 Optical Mouse ID_INPUT=3D1 ID_INPUT_MOUSE=3D1 [1] http://people.canonical.com/~pitti/tmp/66-xorg-synaptics.rules [2] http://people.canonical.com/~pitti/tmp/input_id.c --=20 Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org) --bp/iNruPH9dso1Pn Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAksTlvgACgkQDecnbV4Fd/J/0wCgnUrUS/qDHmHn4DOOAWxINkDG f6cAoPa0SyTxt8pduE3zX6MUWEJf6AAZ =ZpTU -----END PGP SIGNATURE----- --bp/iNruPH9dso1Pn--