mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Cc: Vojtech Pavlik <vojtech@suse.cz>, David Cougle <davidcougle@hotmail.com>
Subject: [PATCH] 2.6: joydev is too eager claiming input devices
Date: Wed, 3 Sep 2003 00:50:04 -0500	[thread overview]
Message-ID: <200309030050.06800.dtor_core@ameritech.net> (raw)

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

             reply	other threads:[~2003-09-03  5:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-03  5:50 Dmitry Torokhov [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200309030050.06800.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=davidcougle@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®