Fix for problems with eGalax/DWAV multi-touch-screen
PATCH 1/1 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.
drivers/hid/usbhid/hid-quirks.c +0 -1
@@ -33,7 +33,6 @@ { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, - { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_FLYING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT },
drivers/hid/hid-egalax.c +11 -5
@@ -31,7 +31,7 @@bool first;/* is this the first finger in the frame? */ bool valid;/* valid finger data, or just placeholder? */ bool activity;/* at least one active finger previously? */ -__u16 lastx, lasty;/* latest valid (x, y) in the frame */ +__u16 lastx, lasty, lastz;/* latest valid (x, y, z) in the frame */ }; static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi,
@@ -79,6 +79,10 @@case HID_DG_TIPPRESSURE :hid_map_usage (hi, usage, bit, max,EV_ABS ,ABS_MT_PRESSURE ); +/* touchscreen emulation */ +input_set_abs_params (hi->input,ABS_PRESSURE , + field->logical_minimum, + field->logical_maximum,0 ,0 );return 1 ; }return 0 ;
@@ -109,8 +113,8 @@if (td->valid) {/* emit multitouch events */ input_event (input,EV_ABS ,ABS_MT_TRACKING_ID , td->id); -input_event (input,EV_ABS ,ABS_MT_POSITION_X , td->x); -input_event (input,EV_ABS ,ABS_MT_POSITION_Y , td->y); +input_event (input,EV_ABS ,ABS_MT_POSITION_X , td->x >>3 ); +input_event (input,EV_ABS ,ABS_MT_POSITION_Y , td->y >>3 );input_event (input,EV_ABS ,ABS_MT_PRESSURE , td->z);input_mt_sync (input);
@@ -121,6 +125,7 @@*/ td->lastx = td->x; td->lasty = td->y; + td->lastz = td->z; }/*
@@ -129,8 +134,9 @@* the oldest on the panel, the one we want for single touch */ if (!td->first && td->activity) { -input_event (input,EV_ABS ,ABS_X , td->lastx); -input_event (input,EV_ABS ,ABS_Y , td->lasty); +input_event (input,EV_ABS ,ABS_X , td->lastx >>3 ); +input_event (input,EV_ABS ,ABS_Y , td->lasty >>3 ); +input_event (input,EV_ABS ,ABS_PRESSURE , td->lastz); }if (!td->valid) {
Quoted 5 lines · Philipp Merkel
3) Only multi-touch pressure events are sent, single touch emulation is
missing pressure information. This patch adds single-touchABS_PRESSUREevents.
Oops, thx for the fix.
Quoted 5 lines
1) While there is a dedicated multitouch driver for the screen (
hid-egalax.c), theMULTI_INPUTquirk 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.
No opinion here, I'm not comfortable with MULTI_INPUT and multitouch (too much variability from one device to another).
Quoted 11 lines
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.
Mmm. This would be a bug in the firmware? I'll notify the eGalax folks. Anyway, if there's a bug we must fix it. But the driver was (probably too quickly) registered for another eGalax product with a different protocol: 0x0eef:0x720c (the one in the Joojoo). Can someone check if the fix applies to this product as well? Otherwise we'll have to devise a solution.
St.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines
Quoted 4 lines
1) While there is a dedicated multitouch driver for the screen (
hid-egalax.c), theMULTI_INPUTquirk 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.No opinion here, I'm not comfortable with
MULTI_INPUTand multitouch (too much variability from one device to another).
I can only tell you what I experienced: Before the hid_egalax driver, one had to use the MULTI_INPUT quirk in order to make the device work as a single-touch screen, otherwise the coordinates were sent for the wrong axes. But now with hid_egalax handling the device, the MULTI_INPUT quirk is of no use any more for this device and instead seems to prevent hid_egalax from working (it's loaded, but doesn't seem to handle the device as no multitouch events are sent). So it's a leftover from before hid_egalax and can safely be removed.
Quoted 12 lines
Quoted 11 lines
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.
Quoted 6 lines
Mmm. This would be a bug in the firmware? I'll notify the eGalax folks. Anyway, if there's a bug we must fix it. But the driver was (probably too quickly) registered for another eGalax product with a different protocol: 0x0eef:0x720c (the one in the Joojoo). Can someone check if the fix applies to this product as well? Otherwise we'll have to devise a solution.
I don't have a Joojoo, but as its touch screen seems to be quite different, it's probably necessary to distinguish the devices in the driver anyway. At least from what I know from other T101MT users, all screens with the id 0x0eef:0x480d seem to suffer from this problem.
Another possibility would maybe be the following: If the coordinates of the first touch after loading the driver are within the range, the device is set to "Normal" mode and all coordinates are passed as they are. If the first touch is out of range, the device is set to "Quirks" mode and all coordinates are shifted by three bits. This way, the driver would continue working even if the bug in the firmware was corrected for new devices with the same ID. It would be no problem to adapt my patch this way.
For me, the values are as follows: In the HID descriptor, a range of 0-4095 is given for the X and Y axes. So the only situation in which the above solution would not switch the mode correctly would be if the first touch after loading the driver would be in the very top-left corner, with an X and Y coordinate between 0 and 4, as in this case it would be reported as <=4000 and thus not registered as being out of range. This is very unlikely as at least for my screen, one has to press the stylus with force into the corner in order to get such coordinates, which probably no user will do just after turning on his machine...
Quoted 5 lines · Stéphane Chatty
Quoted 4 lines
3) Only multi-touch pressure events are sent, single touch emulation is missing pressure information. This patch adds single-touch
ABS_PRESSUREevents.Oops, thx for the fix.
Stephane, can I consider this being your Acked-by: for the whole patch?
Thanks,
Signature · 6 lines
Jiri Kosina SUSE Labs, Novell Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Jiri Kosina
Quoted 6 lines · Stéphane Chatty
Quoted 5 lines
3) Only multi-touch pressure events are sent, single touch emulation is
missing pressure information. This patch adds single-touchABS_PRESSUREevents.Oops, thx for the fix.
Stephane, can I consider this being your Acked-by: for the whole patch?
Well, there's still the issue of the 0eef:72xx series that might be disrupted by the patch. We can decide to remove that series from the list of supported devices, but it would be good to check first whether these panels have the same issue or not. If they do, we can apply the patch without second thoughts. If they don't, we should probably remove them and write another driver. I have asked feedback from an author of PyMT who owns a Joojoo.
Cheers,
St. --
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 18 lines · Philipp Merkel
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), theMULTI_INPUTquirk 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-touchABS_PRESSUREevents.
Quoted 2 lines
Signed-off-by Philipp Merkel <[email protected]>
This is a late reply to the whole thread.
I have looked at the joojoo (0eef:720c), and constructed a driver for it using MT slots. If would be great if it could be merged with the 0eef:480d in the hid-egalax driver, but there are some things to work out before that can happen. Here are some observations from the joojoo:
1) The HID report says the x/y coordinates are in the 4096 range, but in actuality, they are 32kx32k it seems.
2) Reports fingers serially using slots, and there is *no* message indicating a frame. As Stephane pointed out earlier.
3) Reports x, y and pressure (emulated most likely, since the device is capacitive).
4) Very fast - below 5 ms between completions from preliminary measurements.
5) Only two fingers, but of good quality.
Because of 2), the MT slots protocol is not only suitable, but required unless additional complicating logic is introduced.
Philipp, Stephane, if you are interested in testing out the driver on the 0eff:480d, please let me know (off list), and we should hopefully be able to find a merge.
Cheers,
Henrik
Quoted 7 lines · Henrik Rydberg
Philipp, Stephane, if you are interested in testing out the driver on the
0eff:480d, please let me know (off list), and we should hopefully be able to
find a merge.
I don't have an eGalax device :-)
By the way, since you apparently have access to a Joojoo and I did not get any response from any Joojoo owner, can you tell us whether it exhibits the bogus Xs and Ys that Philipp has observed? It would be consistent with the range inconsistency that you have observed.
St.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Henrik Rydberg
I have looked at the joojoo (0eef:720c), and constructed a driver for it using MT slots. If would be great if it could be merged with the 0eef:480d in the hid-egalax driver, but there are some things to work out before that can happen. Here are some observations from the joojoo:
1) The HID report says the x/y coordinates are in the 4096 range, but in actuality, they are 32kx32k it seems.
Thanks for testing! Okay, so the 0eef:720c also suffers from the three-bit-shift problem my patch addresses. I think it can now be safely applied, or what do you think, Stéphane? Getting your Acked-by?
Of course, this is only an intermediate step that will solve the problems of the 0eef:480d and correct the coordinates of the 0eef:720c, but note solve the multitouch prolem on the latter. I would be glad to test your driver on the 0eef:480d, Henrik, I will send you (and Stéphane) a message off-list about that.
Best Regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Stéphane Chatty
Quoted 5 lines · Henrik Rydberg
Philipp, Stephane, if you are interested in testing out the driver on the 0eff:480d, please let me know (off list), and we should hopefully be able to find a merge.
Quoted 6 lines
I don't have an eGalax device :-)
By the way, since you apparently have access to a Joojoo and I did not get any response from any Joojoo owner, can you tell us whether it exhibits the bogus Xs and Ys that Philipp has observed? It would be consistent with the range inconsistency that you have observed.
Yes, since (4k << 3) == 32k, I believe we are looking at the same behavior on both devices.
Henrik
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Stéphane Chatty
By the way, since you apparently have access to a Joojoo and I did not get any response from any Joojoo owner, can you tell us whether it exhibits the bogus Xs and Ys that Philipp has observed? It would be consistent with the range inconsistency that you have observed.
As I wrote in my previous message (but was too slow and didn't read yours before sending it), the problem Henrik is describing sounds exactly like the one I experienced which is fixed by the three bit shift.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Philipp Merkel
Quoted 4 lines · Stéphane Chatty
By the way, since you apparently have access to a Joojoo and I did not get any response from any Joojoo owner, can you tell us whether it exhibits the bogus Xs and Ys that Philipp has observed? It would be consistent with the range inconsistency that you have observed.
As I wrote in my previous message (but was too slow and didn't read yours before sending it), the problem Henrik is describing sounds exactly like the one I experienced which is fixed by the three bit shift.
Then we could take Philipp's fix for now, and start looking for a way to cross-test Henrik's proposal. Jiri, do you agree on this?
St.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Jiri Kosina
Acked-by Stéphane ChattyQuoted 5 lines · Stéphane Chatty
Quoted 5 lines
Quoted 4 lines
By the way, since you apparently have access to a Joojoo and I did not get any response from any Joojoo owner, can you tell us whether it exhibits the bogus Xs and Ys that Philipp has observed? It would be consistent with the range inconsistency that you have observed.
Quoted 7 lines
Quoted 4 lines
As I wrote in my previous message (but was too slow and didn't read yours before sending it), the problem Henrik is describing sounds exactly like the one I experienced which is fixed by the three bit shift.
Then we could take Philipp's fix for now, and start looking for a way to cross-test Henrik's proposal. Jiri, do you agree on this?
Sounds reasonable to me. So can I add
to Philipp's patch?
Thanks,
Signature · 6 lines
Jiri Kosina SUSE Labs, Novell Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 16 lines · Jiri Kosina
Quoted 5 lines · Stéphane Chatty
Quoted 5 lines
Quoted 4 lines
By the way, since you apparently have access to a Joojoo and I did not get any response from any Joojoo owner, can you tell us whether it exhibits the bogus Xs and Ys that Philipp has observed? It would be consistent with the range inconsistency that you have observed.
Quoted 8 lines
Quoted 4 lines
As I wrote in my previous message (but was too slow and didn't read yours before sending it), the problem Henrik is describing sounds exactly like the one I experienced which is fixed by the three bit shift.
Then we could take Philipp's fix for now, and start looking for a way to
cross-test Henrik's proposal. Jiri, do you agree on this?
Quoted 5 lines
Sounds reasonable to me. So can I add
Acked-by Stéphane Chatty <[email protected]>to Philipp's patch?
Fine by me. And Henrik's solution should come soon, from what I hear.
Cheers,
St.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 13 lines · Stéphane Chatty
Quoted 13 lines
Quoted 12 lines
Quoted 9 lines
Quoted 4 lines
By the way, since you apparently have access to a Joojoo and I did not get any response from any Joojoo owner, can you tell us whether it exhibits the bogus Xs and Ys that Philipp has observed? It would be consistent with the range inconsistency that you have observed.
As I wrote in my previous message (but was too slow and didn't read yours before sending it), the problem Henrik is describing sounds exactly like the one I experienced which is fixed by the three bit shift.
Then we could take Philipp's fix for now, and start looking for a way to cross-test Henrik's proposal. Jiri, do you agree on this?
Quoted 7 lines
Quoted 5 lines
Sounds reasonable to me. So can I add
Acked-by Stéphane Chatty <[email protected]>to Philipp's patch?
Fine by me. And Henrik's solution should come soon, from what I hear.
Excellent. Applied now, thanks!
Signature · 6 lines
Jiri Kosina SUSE Labs, Novell Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html