linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ID_CLASS joystick
@ 2006-08-08 21:49 Anssi Hannula
  2006-08-11 14:49 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Anssi Hannula @ 2006-08-08 21:49 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 1248 bytes --]

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


[-- Attachment #2: udev-096-joystick-class.patch --]
[-- Type: text/x-patch, Size: 697 bytes --]

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"

[-- Attachment #3: Type: text/plain, Size: 373 bytes --]

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

[-- Attachment #4: Type: text/plain, Size: 226 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ID_CLASS joystick
  2006-08-08 21:49 ID_CLASS joystick Anssi Hannula
@ 2006-08-11 14:49 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2006-08-11 14:49 UTC (permalink / raw)
  To: linux-hotplug

On Wed, 2006-08-09 at 00:49 +0300, Anssi Hannula wrote:
> 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&kid\x120709&bid&3057&dat\x121642
_______________________________________________
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-08-11 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-08 21:49 ID_CLASS joystick Anssi Hannula
2006-08-11 14:49 ` Kay Sievers

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