From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anssi Hannula Date: Tue, 08 Aug 2006 21:49:00 +0000 Subject: ID_CLASS joystick Message-Id: <44D906CC.9010805@gmail.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="------------060409090305000502090305" List-Id: To: linux-hotplug@vger.kernel.org This is a multi-part message in MIME format. --------------060409090305000502090305 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi! I'd like to have "joystick" (or maybe "game_controller") added to the possible values of ID_CLASS. The possible values are currently "spkr", "kbd", "mouse", "ir". Joydev (drivers/input/joydev.c) considers a device to be a joystick when it has (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH. Modalias has the necessary info. Example modalias for my sw p2 joystick: MODALIAS=input:b0003v045Ep0038e0108-e0,1,3,k120,121,122,123,124,125,126,127,ra0,1,5,6,10,11,mlsfw ABS caps are after "a" and KEY caps are after "k". ABS_X=0, ABS_WHEEL=8, ABS_THROTTLE=6, BTN_TOUCH=14A. Then we get the following rule to add into 60-persistent-input.rules: SYSFS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", SYSFS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" Another possibility would be to match the capabilites flags in sysfs, but they're bitfields. For example the device in the above example has "30063" in /capabilities/abs which means 110000000001100011. I don't know how to parse that easily. I need this "joystick" value, because it would rather cleanly allow to easily differentiate joystick evdev device nodes, so that they can be chowned to the console user by pam. Patch is attached. Please comment. -- Anssi Hannula --------------060409090305000502090305 Content-Type: text/x-patch; name="udev-096-joystick-class.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="udev-096-joystick-class.patch" diff -Nur -x '*~' udev-096/etc/udev/60-persistent-input.rules udev-096-fi/etc/udev/60-persistent-input.rules --- udev-096/etc/udev/60-persistent-input.rules 2006-07-09 22:48:19.000000000 +0300 +++ udev-096-fi/etc/udev/60-persistent-input.rules 2006-08-06 23:36:10.000000000 +0300 @@ -2,6 +2,9 @@ SUBSYSTEM!="input", GOTO="persistent_input_end" KERNEL=="input[0-9]*", GOTO="persistent_input_end" +# joystick devices +SYSFS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", SYSFS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" + # usb devices BUS=="usb", IMPORT{program}="usb_id -x" BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" --------------060409090305000502090305 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 --------------060409090305000502090305 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel --------------060409090305000502090305--