[PATCH] 2.6: joydev is too eager claiming input devices

From: Dmitry Torokhov
Date: Wed Sep 03 2003 - 00:51:41 EST


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) },
},
{
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/