Revert to anonymous 'type A' MT protocol for touch
Subsystems (2)
PATCH 1/4 Revert to anonymous 'type A' MT protocol for touch
Android (at least up to Gingerbread) does not understand the 'B' protocol first made available in 2.6.36. As a workaround until this is fixed, we drop back to using the 'A' protocol.
---
Now being sent upstream to LKML at the behest of Google.
drivers/input/touchscreen/wacom_w8001.c | 33 ++++++++++++++++++++++++++---- 1 files changed, 28 insertions(+), 5 deletions(-)
drivers/input/touchscreen/wacom_w8001.c +28 -5
@@ -151,8 +151,6 @@ static void parse_multi_touch(struct w8001 *w8001)for (i =0 ; i <2 ; i++) {bool touch = data[0 ] & (1 << i); -input_mt_slot (dev, i); -input_mt_report_slot_state (dev,MT_TOOL_FINGER , touch);if (touch) { x = (data[6 * i +1 ] <<7 ) | data[6 * i +2 ]; y = (data[6 * i +3 ] <<7 ) | data[6 * i +4 ];
@@ -163,9 +161,14 @@ static void parse_multi_touch(struct w8001 *w8001)input_report_abs (dev,ABS_MT_POSITION_X , x);input_report_abs (dev,ABS_MT_POSITION_Y , y); +input_report_abs (dev,ABS_MT_TOOL_TYPE ,MT_TOOL_FINGER ); count++; + +input_mt_sync (dev); } } +if (count ==0 ) +input_mt_sync (dev);/* emulate single touch events when stylus is out of proximity. * This is to make single touch backward support consistent
@@ -173,8 +176,20 @@ static void parse_multi_touch(struct w8001 *w8001)*/ if (w8001->type !=BTN_TOOL_PEN && w8001->type !=BTN_TOOL_RUBBER ) { +struct w8001_coord coord; + w8001->type = count ==1 ?BTN_TOOL_FINGER :KEY_RESERVED ; -input_mt_report_pointer_emulation (dev, true); + +parse_single_touch (data, &coord); + x = coord.x; + y = coord.y; +scale_touch_coordinates (w8001, &x, &y); + +input_report_abs (dev,ABS_X , x); +input_report_abs (dev,ABS_Y , y); +input_report_key (dev,BTN_TOUCH , count >0 ); +input_report_key (dev,BTN_TOOL_FINGER , count ==1 ); +input_report_key (dev,BTN_TOOL_DOUBLETAP , count ==2 ); }input_sync (dev);
@@ -228,6 +243,10 @@ static void report_pen_events(struct w8001 *w8001, struct w8001_coord *coord)input_report_key (dev,BTN_STYLUS ,0 );input_report_key (dev,BTN_STYLUS2 ,0 );input_report_key (dev,BTN_TOOL_RUBBER ,0 ); + +/* No multi-touchpoints -> SYN_MT_REPORT; SYN_REPORT */ +input_mt_sync (dev); +input_sync (dev); w8001->type =BTN_TOOL_PEN ; }
@@ -236,10 +255,15 @@ static void report_pen_events(struct w8001 *w8001, struct w8001_coord *coord)case BTN_TOOL_FINGER :input_report_key (dev,BTN_TOUCH ,0 );input_report_key (dev,BTN_TOOL_FINGER ,0 ); -input_sync (dev); +/* fall through */ case KEY_RESERVED : +/* No multi-touchpoints -> SYN_MT_REPORT; SYN_REPORT */ +input_mt_sync (dev); + +input_sync (dev); + w8001->type = coord->f2 ?BTN_TOOL_RUBBER :BTN_TOOL_PEN ;break ;
@@ -455,7 +479,6 @@ static int w8001_setup(struct w8001 *w8001)case 5 : w8001->pktlen =W8001_PKTLEN_TOUCH2FG ; -input_mt_init_slots (dev,2 );input_set_abs_params (dev,ABS_MT_POSITION_X ,0 , touch.x,0 ,0 ); input_set_abs_params(dev, ABS_MT_POSITION_Y,
Signature · 1 line
1.7.5.2
PATCH 2/4 Use MT (in addition to single-touch) protocol for all events
Android (begining with Gingerbread) ignores all single-touch events from multi-touch capable devices. This patch augments the pen and single-touch handlers to emit MT events for Android's consumption.
---
Now being sent upstream to LKML at the behest of Google.
drivers/input/touchscreen/wacom_w8001.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
drivers/input/touchscreen/wacom_w8001.c +14 -0
@@ -278,6 +278,13 @@ static void report_pen_events(struct w8001 *w8001, struct w8001_coord *coord)input_report_key (dev,BTN_TOUCH , coord->tsw);input_report_key (dev,BTN_STYLUS , coord->f1);input_report_key (dev, w8001->type, coord->rdy); + +input_report_abs (dev,ABS_MT_POSITION_X , coord->x); +input_report_abs (dev,ABS_MT_POSITION_Y , coord->y); +input_report_abs (dev,ABS_MT_PRESSURE , coord->pen_pressure); +input_report_abs (dev,ABS_MT_TOOL_TYPE ,MT_TOOL_PEN ); + +input_mt_sync (dev);input_sync (dev);if (!coord->rdy)
@@ -298,6 +305,11 @@ static void report_single_touch(struct w8001 *w8001, struct w8001_coord *coord)input_report_key (dev,BTN_TOUCH , coord->tsw);input_report_key (dev,BTN_TOOL_FINGER , coord->tsw); +input_report_abs (dev,ABS_MT_POSITION_X , x); +input_report_abs (dev,ABS_MT_POSITION_Y , y); +input_report_abs (dev,ABS_MT_TOOL_TYPE ,MT_TOOL_FINGER ); + +input_mt_sync (dev);input_sync (dev); w8001->type = coord->tsw ?BTN_TOOL_FINGER :KEY_RESERVED ;
@@ -485,6 +497,8 @@ static int w8001_setup(struct w8001 *w8001) 0, touch.y, 0, 0);input_set_abs_params (dev,ABS_MT_TOOL_TYPE ,0 ,MT_TOOL_MAX ,0 ,0 ); +input_set_abs_params (dev,ABS_MT_PRESSURE , +0 , coord.pen_pressure,0 ,0 );strlcat (w8001->name," 2FG" ,sizeof (w8001->name));if (w8001->max_pen_x && w8001->max_pen_y)
Signature · 1 line
1.7.5.2
PATCH 3/4 Fix hover in Android (Gingerbread)
In reply to Jason GereckeAs of Gingerbread, Android does not pay attention to if the pen is in contact with the screen, or merely in proximity. Since the Xorg Wacom driver does not make use of MT pen events, we simply do not emit MT data while hovering.
---
Now being sent upstream to LKML at the behest of Google.
drivers/input/touchscreen/wacom_w8001.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/input/touchscreen/wacom_w8001.c +6 -4
@@ -279,10 +279,12 @@ static void report_pen_events(struct w8001 *w8001, struct w8001_coord *coord)input_report_key (dev,BTN_STYLUS , coord->f1);input_report_key (dev, w8001->type, coord->rdy); -input_report_abs (dev,ABS_MT_POSITION_X , coord->x); -input_report_abs (dev,ABS_MT_POSITION_Y , coord->y); -input_report_abs (dev,ABS_MT_PRESSURE , coord->pen_pressure); -input_report_abs (dev,ABS_MT_TOOL_TYPE ,MT_TOOL_PEN ); +if (coord->pen_pressure >0 ) { +input_report_abs (dev,ABS_MT_POSITION_X , coord->x); +input_report_abs (dev,ABS_MT_POSITION_Y , coord->y); +input_report_abs (dev,ABS_MT_PRESSURE , coord->pen_pressure); +input_report_abs (dev,ABS_MT_TOOL_TYPE ,MT_TOOL_PEN ); + }input_mt_sync (dev);input_sync (dev);
Signature · 1 line
1.7.5.2
Re: [PATCH 3/4] Fix hover in Android (Gingerbread)
Quoted 4 lines · Jason Gerecke
As of Gingerbread, Android does not pay attention to if the pen is in contact with the screen, or merely in proximity. Since the Xorg Wacom driver does not make use of MT pen events, we simply do not emit MT data while hovering.
Hi Jason,
It would be nice if you could CC me next time. I would like to be aware of the changes to the driver I wrote and use.
I guess the change below is ok, but it changes existing behavior. It doesn't affect my apps (be aware that Xorg and Android may be the well known users, but there are other custom apps).
Thanks,
jaya
Quoted 32 lines
Signed-off-by Jason Gerecke <[email protected]>---
Now being sent upstream to LKML at the behest of Google.drivers/input/touchscreen/wacom_w8001.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)drivers/input/touchscreen/wacom_w8001.c +6
-5@@ -279,10 +279,12 @@ static void report_pen_events(struct w8001 *w8001, struct w8001_coord *coord) input_report_key(dev, BTN_STYLUS, coord->f1); input_report_key(dev, w8001->type, coord->rdy); - input_report_abs(dev, ABS_MT_POSITION_X, coord->x); - input_report_abs(dev, ABS_MT_POSITION_Y, coord->y); - input_report_abs(dev, ABS_MT_PRESSURE, coord->pen_pressure); - input_report_abs(dev, ABS_MT_TOOL_TYPE, MT_TOOL_PEN); + if (coord->pen_pressure > 0) { + input_report_abs(dev, ABS_MT_POSITION_X, coord->x); + input_report_abs(dev, ABS_MT_POSITION_Y, coord->y); + input_report_abs(dev, ABS_MT_PRESSURE, coord->pen_pressure); + input_report_abs(dev, ABS_MT_TOOL_TYPE, MT_TOOL_PEN); + } input_mt_sync(dev); input_sync(dev); --1.7.5.2
Quoted 5 lines
--
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
--
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
Re: [PATCH 3/4] Fix hover in Android (Gingerbread)
Quoted 11 lines · Jaya Kumar
Quoted 4 lines · Jason Gerecke
As of Gingerbread, Android does not pay attention to if the pen is in contact with the screen, or merely in proximity. Since the Xorg Wacom driver does not make use of MT pen events, we simply do not emit MT data while hovering.
Hi Jason,
It would be nice if you could CC me next time. I would like to be aware of the changes to the driver I wrote and use.
Quoted 7 lines
I guess the change below is ok, but it changes existing behavior. It doesn't affect my apps (be aware that Xorg and Android may be the well known users, but there are other custom apps).
Thanks,
jaya
Thanks for the heads-up. Since I had originally intended the patches to go against the Android tree, I wasn't thinking too hard about how other things would react to the changes. I figured I'd make them Xorg-compatible in case they were rejected by Google, but didn't consider custom applications.
Based on the replies to the first patch though, I may be withdrawing these patches anyway... We need to wait and see if my Android rejection is reversed or not.
Jason
---
Day xee-nee-svsh duu-'ushtlh-ts'it;
nuu-wee-ya' duu-xan' 'vm-nvshtlh-ts'it.
Huu-chan xuu naa~-gha.
Re: [PATCH 3/4] Fix hover in Android (Gingerbread)
Quoted 26 lines · Jason Gerecke
Quoted 11 lines · Jaya Kumar
Quoted 4 lines · Jason Gerecke
As of Gingerbread, Android does not pay attention to if the pen is in contact with the screen, or merely in proximity. Since the Xorg Wacom driver does not make use of MT pen events, we simply do not emit MT data while hovering.
Hi Jason,
It would be nice if you could CC me next time. I would like to be aware of the changes to the driver I wrote and use.
Quoted 7 lines
I guess the change below is ok, but it changes existing behavior. It doesn't affect my apps (be aware that Xorg and Android may be the well known users, but there are other custom apps).
Thanks,
jayaThanks for the heads-up. Since I had originally intended the patches to go against the Android tree, I wasn't thinking too hard about how other things would react to the changes. I figured I'd make them Xorg-compatible in case they were rejected by Google, but didn't consider custom applications.
Quoted 3 lines
Based on the replies to the first patch though, I may be withdrawing these patches anyway... We need to wait and see if my Android rejection is reversed or not.
It will not be. We do not want to carry non-essential patches in our tree. Our userspace now implements the B protocol, so things should work fine in the next release.
--Dima
Quoted 8 lines
Jason
---
Day xee-nee-svsh duu-'ushtlh-ts'it;
nuu-wee-ya' duu-xan' 'vm-nvshtlh-ts'it.
Huu-chan xuu naa~-gha.
Re: [PATCH 3/4] Fix hover in Android (Gingerbread)
In reply to Jason GereckeQuoted 4 lines · Jason Gerecke
As of Gingerbread, Android does not pay attention to if the pen is in contact with the screen, or merely in proximity. Since the Xorg Wacom driver does not make use of MT pen events, we simply do not emit MT data while hovering.
I'd rather not change the behavior of the upstream driver because that would break other things. It would be better to just fix the Android framework code for the device you are shipping.
What is it about Gingerbread that causes problems with hover? Is it the fact it isn't checking BTN_TOUCH or the fact that it doesn't care when ABS_MT_PRESSURE == 0? (Is BTN_TOUCH still relevant to the MT protocol or only in single-touch?)
I have already added hover support to Android. It will appear in an upcoming release, along with support for the MT slots protocol "B".
Sending a non-zero ABS_MT_DISTANCE is also a good robust hint for hover. Zero pressure can be ambiguous sometimes.
Who did you talk to at Google about this?
Jeff.
Re: [PATCH 3/4] Fix hover in Android (Gingerbread)
Jason spoke with me. I pushed back because I did not want to carry any patches for this in our kernel tree and asked Jason to send them upstream. I, unfortunately, did not take a close look to see what the patches were doing. As mentioned, these android-specific changes shouldn't be accepted.
--Dima
Quoted 18 lines · Jeffrey Brown
Quoted 4 lines · Jason Gerecke
As of Gingerbread, Android does not pay attention to if the pen is in contact with the screen, or merely in proximity. Since the Xorg Wacom driver does not make use of MT pen events, we simply do not emit MT data while hovering.
I'd rather not change the behavior of the upstream driver because that would break other things. It would be better to just fix the Android framework code for the device you are shipping.
What is it about Gingerbread that causes problems with hover? Is it the fact it isn't checking
BTN_TOUCHor the fact that it doesn't care whenABS_MT_PRESSURE== 0? (IsBTN_TOUCHstill relevant to the MT protocol or only in single-touch?)I have already added hover support to Android. It will appear in an upcoming release, along with support for the MT slots protocol "B".
Quoted 7 lines
Sending a non-zero
ABS_MT_DISTANCEis also a good robust hint for hover. Zero pressure can be ambiguous sometimes.Who did you talk to at Google about this?
Jeff.
--
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
PATCH 4/4 Only report multi-touch when pen is out of range
In reply to Jason GereckeDon't bother evaluating multi-touch packets from the hardware when the pen is in range. Single-touch is already filtered, but not MT.
---
Now being sent upstream to LKML at the behest of Google.
drivers/input/touchscreen/wacom_w8001.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/input/touchscreen/wacom_w8001.c +4 -1
@@ -379,7 +379,10 @@ static irqreturn_t w8001_interrupt(struct serio *serio,/* 2 finger touch packet */ case W8001_PKTLEN_TOUCH2FG -1 : w8001->idx =0 ; -parse_multi_touch (w8001); +if (w8001->type !=BTN_TOOL_PEN && + w8001->type !=BTN_TOOL_RUBBER ) { +parse_multi_touch (w8001); + }break ; }
Signature · 1 line
1.7.5.2
Re: [PATCH 4/4] Only report multi-touch when pen is out of range
I don't see why we should filter out multitouch while the pen is in range. There are many reasons why it might be useful to support simultaneous pen and touch.
For example, use one finger to select a color to draw with and use the pen in the other hand to draw.
Jeff.
Quoted 27 lines · Jason Gerecke
Don't bother evaluating multi-touch packets from the hardware when the pen is in range. Single-touch is already filtered, but not MT.
Signed-off-by Jason Gerecke <[email protected]>---
Now being sent upstream to LKML at the behest of Google.drivers/input/touchscreen/wacom_w8001.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)drivers/input/touchscreen/wacom_w8001.c +0
-0@@ -379,7 +379,10 @@ static irqreturn_t w8001_interrupt(struct serio *serio, /* 2 finger touch packet */case
W8001_PKTLEN_TOUCH2FG- 1:
w8001->idx = 0;
-parse_multi_touch(w8001);
+ if (w8001->type!=BTN_TOOL_PEN&&
+w8001->type!=BTN_TOOL_RUBBER) {
+parse_multi_touch(w8001);
+ }
break;
}
Quoted 8 lines
--
1.7.5.2--
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
--
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
Dmitry Torokhov
maintainerQuoted 4 lines · Jason Gerecke
Android (at least up to Gingerbread) does not understand the 'B' protocol first made available in 2.6.36. As a workaround until this is fixed, we drop back to using the 'A' protocol.
Well, fix Android then. Same goes for patches 2 & 3.
Thanks.
Signature · 1 line
Dmitry
Agreed. The next version will correctly use protocol B. When I briefly (too briefly clearly :-( ) looked at the original patches, I thought they were driver bug fixes. If it's just workarounds for stuff android doesn't do, then we should fix our framework.
Jason, do any of these patches fix actual driver bugs or make the driver more robust?
--Dima
Quoted 13 lines · Dmitry Torokhov
Quoted 4 lines · Jason Gerecke
Android (at least up to Gingerbread) does not understand the 'B' protocol first made available in 2.6.36. As a workaround until this is fixed, we drop back to using the 'A' protocol.
Well, fix Android then. Same goes for patches 2 & 3.
Thanks.
--
Dmitry
Quoted 8 lines · Dima Zavin
Agreed. The next version will correctly use protocol B. When I briefly (too briefly clearly :-( ) looked at the original patches, I thought they were driver bug fixes. If it's just workarounds for stuff android doesn't do, then we should fix our framework.
Jason, do any of these patches fix actual driver bugs or make the driver more robust?
The only patch which *may* be a bugfix is number 4 ("Only report multi-touch when pen is out of range"). I can only reproduce multi-touch + pen oddities under Android, but that could be due to some kind of filtering from the xf86-input-wacom driver.
The remaining patches are absolutely specific to Android (though still compatible with desktop distros).
Jason
---
Day xee-nee-svsh duu-'ushtlh-ts'it;
nuu-wee-ya' duu-xan' 'vm-nvshtlh-ts'it.
Huu-chan xuu naa~-gha.
Hi Dima,
Could you tell when will android support protocol B ?
I'm using android honeycomb mr2 release, I found it not support Protocol B yet.
Best regards,
Zhang Jiejing
2011/7/8 Dima Zavin <[email protected]>:
Quoted 22 lines
Agreed. The next version will correctly use protocol B. When I briefly (too briefly clearly :-( ) looked at the original patches, I thought they were driver bug fixes. If it's just workarounds for stuff android doesn't do, then we should fix our framework.
Jason, do any of these patches fix actual driver bugs or make the driver more robust?
--Dima
Quoted 10 lines · Dmitry Torokhov
Quoted 4 lines · Jason Gerecke
Android (at least up to Gingerbread) does not understand the 'B' protocol first made available in 2.6.36. As a workaround until this is fixed, we drop back to using the 'A' protocol.
Well, fix Android then. Same goes for patches 2 & 3.
Thanks.
Quoted 8 lines
Quoted 3 lines
--
Dmitry--
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
--
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