diff mbox

[1/4] Revert to anonymous 'type A' MT protocol for touch

Message ID 1310072700-2829-1-git-send-email-killertofu@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gerecke, Jason July 7, 2011, 9:04 p.m. UTC
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.

Signed-off-by: Jason Gerecke <killertofu@gmail.com>
---
 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(-)

Comments

Dmitry Torokhov July 7, 2011, 9:35 p.m. UTC | #1
On Thu, Jul 07, 2011 at 02:04:57PM -0700, Jason Gerecke wrote:
> 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.
Dima Zavin July 7, 2011, 9:52 p.m. UTC | #2
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

On Thu, Jul 7, 2011 at 2:35 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Thu, Jul 07, 2011 at 02:04:57PM -0700, Jason Gerecke wrote:
>> 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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gerecke, Jason July 7, 2011, 10:32 p.m. UTC | #3
On Thu, Jul 7, 2011 at 2:52 PM, Dima Zavin <dima@android.com> wrote:
> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
JieJing.Zhang Aug. 3, 2011, 4:31 a.m. UTC | #4
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 <dima@android.com>:
> 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
>
> On Thu, Jul 7, 2011 at 2:35 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
>> On Thu, Jul 07, 2011 at 02:04:57PM -0700, Jason Gerecke wrote:
>>> 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
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c
index c14412e..7630806 100644
--- a/drivers/input/touchscreen/wacom_w8001.c
+++ b/drivers/input/touchscreen/wacom_w8001.c
@@ -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,