Skip to contentSkip to conversation

ID_CLASS joystick

PATCH Anssi Hannula 2 participants 2 messages Aug 8, 2006 – Aug 11, 2006

lore
Share & tools
lore
#0 lore raw

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.

Signature · 1 line
Anssi Hannula
etc/udev/60-persistent-input.rules +3 -0
diff -Nur -x '*~' udev-096/etc/udev/60-persistent-input.rules udev-096-fi/etc/udev/60-persistent-input.rules
@@ -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"

-------------------------------------------------------------------------
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

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

#1 lore raw
Quoted 7 lines · Anssi Hannula

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".

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"

Huh, strange match. :) Applied.

Thanks,
Kay

-------------------------------------------------------------------------
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&kid0709&bid&3057&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel