[patch] input: joydev/mousedev update [8/14]

Vojtech Pavlik (vojtech@suse.cz)
Wed, 12 Feb 2003 12:04:27 +0100


You can pull this changeset from:
bk://kernel.bkbits.net/vojtech/input

===================================================================

ChangeSet@1.1011, 2003-02-12 11:02:12+01:00, vojtech@suse.cz
input.c: joydev/mousedev update
- relax requirements on devices, joydev now allows joysticks
without buttons to work with throttles and pedals, mousedev
allows a separate mouse wheel
- remove a stray semicolon in joydev

joydev.c | 17 +++++++++--------
mousedev.c | 6 +++++-
2 files changed, 14 insertions(+), 9 deletions(-)

===================================================================

diff -Nru a/drivers/input/joydev.c b/drivers/input/joydev.c
--- a/drivers/input/joydev.c Wed Feb 12 11:56:52 2003
+++ b/drivers/input/joydev.c Wed Feb 12 11:56:52 2003
@@ -340,7 +340,7 @@
case JSIOCSBTNMAP:
if (copy_from_user(joydev->keypam, (__u16 *) arg, sizeof(__u16) * (KEY_MAX - BTN_MISC)))
return -EFAULT;
- for (i = 0; i < joydev->nkey; i++); {
+ for (i = 0; i < joydev->nkey; i++) {
if (joydev->keypam[i] > KEY_MAX || joydev->keypam[i] < BTN_MISC) return -EINVAL;
joydev->keymap[joydev->keypam[i] - BTN_MISC] = i;
}
@@ -377,7 +377,8 @@
struct joydev *joydev;
int i, j, t, minor;

- if (test_bit(BTN_TOUCH, dev->keybit))
+ /* Avoid tablets */
+ if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_TOUCH, dev->keybit))
return NULL;

for (minor = 0; minor < JOYDEV_MINORS && joydev_table[minor]; minor++);
@@ -463,18 +464,18 @@

static struct input_device_id joydev_ids[] = {
{
- .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
- .evbit = { BIT(EV_KEY) | BIT(EV_ABS) },
+ .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
+ .evbit = { BIT(EV_ABS) },
.absbit = { BIT(ABS_X) },
},
{
- .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
- .evbit = { BIT(EV_KEY) | BIT(EV_ABS) },
+ .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
+ .evbit = { BIT(EV_ABS) },
.absbit = { BIT(ABS_WHEEL) },
},
{
- .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
- .evbit = { BIT(EV_KEY) | BIT(EV_ABS) },
+ .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
+ .evbit = { BIT(EV_ABS) },
.absbit = { BIT(ABS_THROTTLE) },
},
{ }, /* Terminating entry */
diff -Nru a/drivers/input/mousedev.c b/drivers/input/mousedev.c
--- a/drivers/input/mousedev.c Wed Feb 12 11:56:52 2003
+++ b/drivers/input/mousedev.c Wed Feb 12 11:56:52 2003
@@ -454,7 +454,11 @@
.keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) },
.relbit = { BIT(REL_X) | BIT(REL_Y) },
}, /* A mouse like device, at least one button, two relative axes */
-
+ {
+ .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_RELBIT,
+ .evbit = { BIT(EV_KEY) | BIT(EV_REL) },
+ .relbit = { BIT(REL_WHEEL) },
+ }, /* A separate scrollwheel */
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
.evbit = { BIT(EV_KEY) | BIT(EV_ABS) },
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/