Commit 9b3eaaa0 authored by Vojtech Pavlik's avatar Vojtech Pavlik

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
parent f9b9f9c6
...@@ -340,7 +340,7 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -340,7 +340,7 @@ static int joydev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
case JSIOCSBTNMAP: case JSIOCSBTNMAP:
if (copy_from_user(joydev->keypam, (__u16 *) arg, sizeof(__u16) * (KEY_MAX - BTN_MISC))) if (copy_from_user(joydev->keypam, (__u16 *) arg, sizeof(__u16) * (KEY_MAX - BTN_MISC)))
return -EFAULT; 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; if (joydev->keypam[i] > KEY_MAX || joydev->keypam[i] < BTN_MISC) return -EINVAL;
joydev->keymap[joydev->keypam[i] - BTN_MISC] = i; joydev->keymap[joydev->keypam[i] - BTN_MISC] = i;
} }
...@@ -377,7 +377,8 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct ...@@ -377,7 +377,8 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct
struct joydev *joydev; struct joydev *joydev;
int i, j, t, minor; 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; return NULL;
for (minor = 0; minor < JOYDEV_MINORS && joydev_table[minor]; minor++); for (minor = 0; minor < JOYDEV_MINORS && joydev_table[minor]; minor++);
...@@ -463,18 +464,18 @@ static void joydev_disconnect(struct input_handle *handle) ...@@ -463,18 +464,18 @@ static void joydev_disconnect(struct input_handle *handle)
static struct input_device_id joydev_ids[] = { static struct input_device_id joydev_ids[] = {
{ {
.flags = INPUT_DEVICE_ID_MATCH_EVBIT, .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
.evbit = { BIT(EV_KEY) | BIT(EV_ABS) }, .evbit = { BIT(EV_ABS) },
.absbit = { BIT(ABS_X) }, .absbit = { BIT(ABS_X) },
}, },
{ {
.flags = INPUT_DEVICE_ID_MATCH_EVBIT, .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
.evbit = { BIT(EV_KEY) | BIT(EV_ABS) }, .evbit = { BIT(EV_ABS) },
.absbit = { BIT(ABS_WHEEL) }, .absbit = { BIT(ABS_WHEEL) },
}, },
{ {
.flags = INPUT_DEVICE_ID_MATCH_EVBIT, .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
.evbit = { BIT(EV_KEY) | BIT(EV_ABS) }, .evbit = { BIT(EV_ABS) },
.absbit = { BIT(ABS_THROTTLE) }, .absbit = { BIT(ABS_THROTTLE) },
}, },
{ }, /* Terminating entry */ { }, /* Terminating entry */
......
...@@ -454,7 +454,11 @@ static struct input_device_id mousedev_ids[] = { ...@@ -454,7 +454,11 @@ static struct input_device_id mousedev_ids[] = {
.keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) }, .keybit = { [LONG(BTN_LEFT)] = BIT(BTN_LEFT) },
.relbit = { BIT(REL_X) | BIT(REL_Y) }, .relbit = { BIT(REL_X) | BIT(REL_Y) },
}, /* A mouse like device, at least one button, two relative axes */ }, /* 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, .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT | INPUT_DEVICE_ID_MATCH_ABSBIT,
.evbit = { BIT(EV_KEY) | BIT(EV_ABS) }, .evbit = { BIT(EV_KEY) | BIT(EV_ABS) },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment