linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 2.6: joydev is too eager claiming input devices
@ 2003-09-03  5:50 Dmitry Torokhov
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2003-09-03  5:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Vojtech Pavlik, David Cougle

Currently joydev will claim any device reporting ABS_X events. This 
includes Synaptics touchpad in absolute mode, PC110 touchpad and both 
touchscreens. Nothing bad happens except for strange input/jsX device 
but it's still not right.

I think we need stricter rules for joydev matching, like in the patch
below. Unfortunately I do not own any joysticks, but I did go through
all code in input/joystick and I think I covered all possible cases.

Dmitry

--- 2.6.0-test4/drivers/input/joydev.c	2003-09-03 00:43:19.000000000 -0500
+++ linux-2.6.0-test4/drivers/input/joydev.c	2003-09-03 00:44:00.000000000 -0500
@@ -466,13 +466,43 @@
 
 static struct input_device_id joydev_ids[] = {
 	{
-		.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT |
+			 INPUT_DEVICE_ID_MATCH_BUS,
+		.evbit = { BIT(EV_ABS) },
+		.absbit = { BIT(ABS_X) },
+		.id = { .bustype = BUS_GAMEPORT },
+	}, /* anything connected to a gameport is a fair game */
+	{
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT |
+			 INPUT_DEVICE_ID_MATCH_BUS,
+		.evbit = { BIT(EV_ABS) },
+		.absbit = { BIT(ABS_X) },
+		.id = { .bustype = BUS_AMIGA },
+	}, /* amiga joystick does not report any special buttons but luckily it is 
+	      the only device rporting absolute coordinates on Amiga bus */
+	{
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT | 
+			 INPUT_DEVICE_ID_MATCH_KEYBIT,
 		.evbit = { BIT(EV_ABS) },
 		.absbit = { BIT(ABS_X) },
+		.keybit = { BIT(BTN_TRIGGER) }, 
+	}, /* most joysticks have either BTN_TRIGGER or BTN_A or both */
+	{
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT | 
+			 INPUT_DEVICE_ID_MATCH_KEYBIT,
+		.evbit = { BIT(EV_ABS) },
+		.absbit = { BIT(ABS_X) },
+		.keybit = { BIT(BTN_A) },
 	},
 	{
 		.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
 		.evbit = { BIT(EV_ABS) },
+		.absbit = { BIT(ABS_RX), BIT(ABS_RY) },
+	}, /* magellan and some others report only MISC buttons but we can identify 
+	      them by using special axis auch as RX/RY, ABS_WHEEL or ABS_THROTTLE */
+	{
+		.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
+		.evbit = { BIT(EV_ABS) },
 		.absbit = { BIT(ABS_WHEEL) },
 	},
 	{

^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: [PATCH] 2.6: joydev is too eager claiming input devices
@ 2003-09-25  3:03 Dan
  2003-09-25  3:54 ` Dmitry Torokhov
  2003-09-25  5:12 ` Dmitry Torokhov
  0 siblings, 2 replies; 9+ messages in thread
From: Dan @ 2003-09-25  3:03 UTC (permalink / raw)
  To: dtor_core, linux-kernel

This patch seems to have broken my Logitech Wingman Action usb gamepad,
it shows as connected but isn't claimed by joydev... another joystick I
have (saitek cyborg usb gold) works fine, and the logitech worked in
previous 2.5/6.x kernels so I'm guessing this patch is to blame, I'm on
2.6.0-test5-mm1, is there any info from the joystick I can provide you
with to fix it?  I'm not sure where to look, thanks -Dan



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

end of thread, other threads:[~2003-10-02  1:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-03  5:50 [PATCH] 2.6: joydev is too eager claiming input devices Dmitry Torokhov
2003-09-25  3:03 Dan
2003-09-25  3:54 ` Dmitry Torokhov
2003-09-25  4:31   ` Dan
2003-09-25  5:12 ` Dmitry Torokhov
2003-09-25  6:29   ` Andrew Morton
2003-10-01  8:10     ` Dan
2003-10-01 17:27       ` Vojtech Pavlik
2003-10-02  1:51         ` Dan

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