Skip to content

Commit f516611

Browse files
PlippoJiri Kosina
authored andcommitted
HID: Fix for problems with eGalax/DWAV multi-touch-screen
This patch fixes three problems with the eGalax/DWAV multi-touch screen found in the Eee PC T101MT: 1) While there is a dedicated multitouch driver for the screen (hid-egalax.c), the MULTI_INPUT quirk is also applied, preventing the hid-egalax driver from working. This patch removes the quirk so the hid-egalax driver can handle the device correctly. 2) The x and y coordinates sent by the screen in multi-touch mode are shifted by three bits from the events sent in single-touch mode, thus the coordinates are out of range, leading to the pointer being stuck in the bottom-right corner if no additional calibration is applied (e.g. in the X evdev driver). This patch shifts the coordinates back. This does not decrease accuracy as the last three bits of the "wrong" coordinates are always 0. 3) Only multi-touch pressure events are sent, single touch emulation is missing pressure information. This patch adds single-touch ABS_PRESSURE events. Signed-off-by: Philipp Merkel <mail@philmerk.de> Acked-by: Stéphane Chatty <chatty@enac.fr> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent a850ea3 commit f516611

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎drivers/hid/hid-egalax.c‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct egalax_data {
3131
bool first; /* is this the first finger in the frame? */
3232
bool valid; /* valid finger data, or just placeholder? */
3333
bool activity; /* at least one active finger previously? */
34-
__u16 lastx, lasty; /* latest valid (x, y) in the frame */
34+
__u16 lastx, lasty, lastz; /* latest valid (x, y, z) in the frame */
3535
};
3636

3737
static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi,
@@ -79,6 +79,10 @@ static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi,
7979
case HID_DG_TIPPRESSURE:
8080
hid_map_usage(hi, usage, bit, max,
8181
EV_ABS, ABS_MT_PRESSURE);
82+
/* touchscreen emulation */
83+
input_set_abs_params(hi->input, ABS_PRESSURE,
84+
field->logical_minimum,
85+
field->logical_maximum, 0, 0);
8286
return 1;
8387
}
8488
return 0;
@@ -109,8 +113,8 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input)
109113
if (td->valid) {
110114
/* emit multitouch events */
111115
input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id);
112-
input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x);
113-
input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y);
116+
input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x >> 3);
117+
input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y >> 3);
114118
input_event(input, EV_ABS, ABS_MT_PRESSURE, td->z);
115119

116120
input_mt_sync(input);
@@ -121,6 +125,7 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input)
121125
*/
122126
td->lastx = td->x;
123127
td->lasty = td->y;
128+
td->lastz = td->z;
124129
}
125130

126131
/*
@@ -129,8 +134,9 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input)
129134
* the oldest on the panel, the one we want for single touch
130135
*/
131136
if (!td->first && td->activity) {
132-
input_event(input, EV_ABS, ABS_X, td->lastx);
133-
input_event(input, EV_ABS, ABS_Y, td->lasty);
137+
input_event(input, EV_ABS, ABS_X, td->lastx >> 3);
138+
input_event(input, EV_ABS, ABS_Y, td->lasty >> 3);
139+
input_event(input, EV_ABS, ABS_PRESSURE, td->lastz);
134140
}
135141

136142
if (!td->valid) {

‎drivers/hid/usbhid/hid-quirks.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ static const struct hid_blacklist {
3434
{ USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD },
3535
{ USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD },
3636
{ USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET },
37-
{ USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH, HID_QUIRK_MULTI_INPUT },
3837
{ USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT },
3938
{ USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
4039
{ USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },

0 commit comments

Comments
 (0)