2003-09-03 05:50:16

by Dmitry Torokhov

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

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) },
},
{


2003-09-25 03:04:14

by Dan

[permalink] [raw]
Subject: RE: [PATCH] 2.6: joydev is too eager claiming input devices

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


2003-09-25 03:54:39

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH] 2.6: joydev is too eager claiming input devices

On Wednesday 24 September 2003 10:03 pm, Dan wrote:
> 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
>

Could you post contents of your /proc/bus/input/devices please?

Dmitry

2003-09-25 05:09:50

by Dan

[permalink] [raw]
Subject: Re: [PATCH] 2.6: joydev is too eager claiming input devices

On Wed, 2003-09-24 at 23:54, Dmitry Torokhov wrote:
> Could you post contents of your /proc/bus/input/devices please?

Here's the gamepad's section:

I: Bus=0003 Vendor=046d Product=c20b Version=0060
N: Name="Logitech WingMan Action Pad"
P: Phys=usb-0000:02:00.0-1/input0
H: Handlers=
B: EV=b
B: KEY=1ff 1 0 0 0 0 0 0 0 0
B: ABS=30007

-Dan


2003-09-25 05:12:58

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH] 2.6: joydev is too eager claiming input devices

On Wednesday 24 September 2003 10:03 pm, Dan wrote:
> 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
>

Could you please try the following patch (it is incremental against the
previous one and should apply to the -mm)

--- 2.6.0-test4/drivers/input/joydev.c 2003-09-25 00:06:52.000000000 -0500
+++ linux-2.6.0-test4/drivers/input/joydev.c 2003-09-25 00:02:17.000000000 -0500
@@ -499,7 +499,28 @@
.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 */
+ them by using special axis auch as RX/RY, HATnX/HATnY, ABS_WHEEL or
+ ABS_THROTTLE */
+ {
+ .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
+ .evbit = { BIT(EV_ABS) },
+ .absbit = { BIT(ABS_HAT0X), BIT(ABS_HAT0Y) },
+ },
+ {
+ .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
+ .evbit = { BIT(EV_ABS) },
+ .absbit = { BIT(ABS_HAT1X), BIT(ABS_HAT1Y) },
+ },
+ {
+ .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
+ .evbit = { BIT(EV_ABS) },
+ .absbit = { BIT(ABS_HAT2X), BIT(ABS_HAT2Y) },
+ },
+ {
+ .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
+ .evbit = { BIT(EV_ABS) },
+ .absbit = { BIT(ABS_HAT3X), BIT(ABS_HAT3Y) },
+ },
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
.evbit = { BIT(EV_ABS) },

2003-09-25 06:29:21

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] 2.6: joydev is too eager claiming input devices

Dmitry Torokhov <[email protected]> wrote:
>
> Could you please try the following patch (it is incremental against the
> previous one and should apply to the -mm)

I ran that patch[1] past Vojtech yesterday and he then fixed the problem
which it was addressing by other means within his tree.

So what we should do is to ask Vojtech to share that change with us so Dan
can test it, please.


[1] ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.0-test5/2.6.0-test5-mm4/broken-out/joydev-exclusions.patch