|
|
aeb6369 |
From b28ae436288861916de0019a81b9817366fe35a9 Mon Sep 17 00:00:00 2001
|
|
|
aeb6369 |
From: David Herrmann <dh.herrmann@googlemail.com>
|
|
|
aeb6369 |
Date: Sat, 8 Oct 2011 23:20:17 +0200
|
|
|
aeb6369 |
Subject: [PATCH] HID: wacom: Set input bits before registration
|
|
|
aeb6369 |
|
|
|
aeb6369 |
We shouldn't change the event flags of input devices after they get registered.
|
|
|
aeb6369 |
Otherwise, udev will not get notified of these flags and cannot setup the
|
|
|
aeb6369 |
devices properly.
|
|
|
aeb6369 |
This fixes the probing to set the input event flags on the input_mapped callback
|
|
|
aeb6369 |
instead of the probe function.
|
|
|
aeb6369 |
|
|
|
aeb6369 |
Reported-by: Bastien Nocera <hadess@hadess.net>
|
|
|
aeb6369 |
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
|
|
|
aeb6369 |
Tested-by: Bastien Nocera <hadess@hadess.net>
|
|
|
aeb6369 |
Signed-off-by: Bastien Nocera <hadess@hadess.net>
|
|
|
aeb6369 |
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
|
|
|
aeb6369 |
---
|
|
|
aeb6369 |
drivers/hid/hid-wacom.c | 80 +++++++++++++++++++++++++---------------------
|
|
|
aeb6369 |
1 files changed, 43 insertions(+), 37 deletions(-)
|
|
|
aeb6369 |
|
|
|
aeb6369 |
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
|
|
|
aeb6369 |
index 72ca689..1492728 100644
|
|
|
aeb6369 |
--- a/drivers/hid/hid-wacom.c
|
|
|
aeb6369 |
+++ b/drivers/hid/hid-wacom.c
|
|
|
aeb6369 |
@@ -304,11 +304,51 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
|
|
|
aeb6369 |
return 1;
|
|
|
aeb6369 |
}
|
|
|
aeb6369 |
|
|
|
aeb6369 |
+static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi,
|
|
|
aeb6369 |
+ struct hid_field *field, struct hid_usage *usage, unsigned long **bit,
|
|
|
aeb6369 |
+ int *max)
|
|
|
aeb6369 |
+{
|
|
|
aeb6369 |
+ struct input_dev *input = hi->input;
|
|
|
aeb6369 |
+
|
|
|
aeb6369 |
+ __set_bit(INPUT_PROP_POINTER, input->propbit);
|
|
|
aeb6369 |
+
|
|
|
aeb6369 |
+ /* Basics */
|
|
|
aeb6369 |
+ input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL);
|
|
|
aeb6369 |
+
|
|
|
aeb6369 |
+ __set_bit(REL_WHEEL, input->relbit);
|
|
|
aeb6369 |
+
|
|
|
aeb6369 |
+ __set_bit(BTN_TOOL_PEN, input->keybit);
|
|
|
aeb6369 |
+ __set_bit(BTN_TOUCH, input->keybit);
|
|
|
aeb6369 |
+ __set_bit(BTN_STYLUS, input->keybit);
|
|
|
aeb6369 |
+ __set_bit(BTN_STYLUS2, input->keybit);
|
|
|
aeb6369 |
+ __set_bit(BTN_LEFT, input->keybit);
|
|
|
aeb6369 |
+ __set_bit(BTN_RIGHT, input->keybit);
|
|
|
aeb6369 |
+ __set_bit(BTN_MIDDLE, input->keybit);
|
|
|
aeb6369 |
+
|
|
|
aeb6369 |
+ /* Pad */
|
|
|
aeb6369 |
+ input->evbit[0] |= BIT(EV_MSC);
|
|
|
aeb6369 |
+
|
|
|
aeb6369 |
+ __set_bit(MSC_SERIAL, input->mscbit);
|
|
|
aeb6369 |
+
|
|
|
aeb6369 |
+ __set_bit(BTN_0, input->keybit);
|
|
|
aeb6369 |
+ __set_bit(BTN_1, input->keybit);
|
|
|
aeb6369 |
+ __set_bit(BTN_TOOL_FINGER, input->keybit);
|
|
|
aeb6369 |
+
|
|
|
aeb6369 |
+ /* Distance, rubber and mouse */
|
|
|
aeb6369 |
+ __set_bit(BTN_TOOL_RUBBER, input->keybit);
|
|
|
aeb6369 |
+ __set_bit(BTN_TOOL_MOUSE, input->keybit);
|
|
|
aeb6369 |
+
|
|
|
aeb6369 |
+ input_set_abs_params(input, ABS_X, 0, 16704, 4, 0);
|
|
|
aeb6369 |
+ input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0);
|
|
|
aeb6369 |
+ input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0);
|
|
|
aeb6369 |
+ input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0);
|
|
|
aeb6369 |
+
|
|
|
aeb6369 |
+ return 0;
|
|
|
aeb6369 |
+}
|
|
|
aeb6369 |
+
|
|
|
aeb6369 |
static int wacom_probe(struct hid_device *hdev,
|
|
|
aeb6369 |
const struct hid_device_id *id)
|
|
|
aeb6369 |
{
|
|
|
aeb6369 |
- struct hid_input *hidinput;
|
|
|
aeb6369 |
- struct input_dev *input;
|
|
|
aeb6369 |
struct wacom_data *wdata;
|
|
|
aeb6369 |
int ret;
|
|
|
aeb6369 |
|
|
|
aeb6369 |
@@ -370,41 +410,6 @@ static int wacom_probe(struct hid_device *hdev,
|
|
|
aeb6369 |
goto err_ac;
|
|
|
aeb6369 |
}
|
|
|
aeb6369 |
#endif
|
|
|
aeb6369 |
- hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
|
|
|
aeb6369 |
- input = hidinput->input;
|
|
|
aeb6369 |
-
|
|
|
aeb6369 |
- __set_bit(INPUT_PROP_POINTER, input->propbit);
|
|
|
aeb6369 |
-
|
|
|
aeb6369 |
- /* Basics */
|
|
|
aeb6369 |
- input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL);
|
|
|
aeb6369 |
-
|
|
|
aeb6369 |
- __set_bit(REL_WHEEL, input->relbit);
|
|
|
aeb6369 |
-
|
|
|
aeb6369 |
- __set_bit(BTN_TOOL_PEN, input->keybit);
|
|
|
aeb6369 |
- __set_bit(BTN_TOUCH, input->keybit);
|
|
|
aeb6369 |
- __set_bit(BTN_STYLUS, input->keybit);
|
|
|
aeb6369 |
- __set_bit(BTN_STYLUS2, input->keybit);
|
|
|
aeb6369 |
- __set_bit(BTN_LEFT, input->keybit);
|
|
|
aeb6369 |
- __set_bit(BTN_RIGHT, input->keybit);
|
|
|
aeb6369 |
- __set_bit(BTN_MIDDLE, input->keybit);
|
|
|
aeb6369 |
-
|
|
|
aeb6369 |
- /* Pad */
|
|
|
aeb6369 |
- input->evbit[0] |= BIT(EV_MSC);
|
|
|
aeb6369 |
-
|
|
|
aeb6369 |
- __set_bit(MSC_SERIAL, input->mscbit);
|
|
|
aeb6369 |
-
|
|
|
aeb6369 |
- __set_bit(BTN_0, input->keybit);
|
|
|
aeb6369 |
- __set_bit(BTN_1, input->keybit);
|
|
|
aeb6369 |
- __set_bit(BTN_TOOL_FINGER, input->keybit);
|
|
|
aeb6369 |
-
|
|
|
aeb6369 |
- /* Distance, rubber and mouse */
|
|
|
aeb6369 |
- __set_bit(BTN_TOOL_RUBBER, input->keybit);
|
|
|
aeb6369 |
- __set_bit(BTN_TOOL_MOUSE, input->keybit);
|
|
|
aeb6369 |
-
|
|
|
aeb6369 |
- input_set_abs_params(input, ABS_X, 0, 16704, 4, 0);
|
|
|
aeb6369 |
- input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0);
|
|
|
aeb6369 |
- input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0);
|
|
|
aeb6369 |
- input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0);
|
|
|
aeb6369 |
|
|
|
aeb6369 |
return 0;
|
|
|
aeb6369 |
|
|
|
aeb6369 |
@@ -448,6 +453,7 @@ static struct hid_driver wacom_driver = {
|
|
|
aeb6369 |
.probe = wacom_probe,
|
|
|
aeb6369 |
.remove = wacom_remove,
|
|
|
aeb6369 |
.raw_event = wacom_raw_event,
|
|
|
aeb6369 |
+ .input_mapped = wacom_input_mapped,
|
|
|
aeb6369 |
};
|
|
|
aeb6369 |
|
|
|
aeb6369 |
static int __init wacom_init(void)
|
|
|
aeb6369 |
--
|
|
|
aeb6369 |
1.7.7.1
|
|
|
aeb6369 |
|