diff mbox

[3/4] Fix hover in Android (Gingerbread)

Message ID 1310072700-2829-3-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
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.

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 |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

Comments

Jaya Kumar July 8, 2011, 1:13 a.m. UTC | #1
On Fri, Jul 8, 2011 at 5:04 AM, Jason Gerecke <killertofu@gmail.com> wrote:
> 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

>
> 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 |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c
> index e94a21a..40ed685 100644
> --- a/drivers/input/touchscreen/wacom_w8001.c
> +++ b/drivers/input/touchscreen/wacom_w8001.c
> @@ -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
>
> --
> 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
Gerecke, Jason July 8, 2011, 9:04 p.m. UTC | #2
On Thu, Jul 7, 2011 at 6:13 PM, Jaya Kumar <jayakumar.lkml@gmail.com> wrote:
> On Fri, Jul 8, 2011 at 5:04 AM, Jason Gerecke <killertofu@gmail.com> wrote:
>> 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
>

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.
--
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
Jeff Brown July 9, 2011, 6:15 a.m. UTC | #3
On Thu, Jul 7, 2011 at 2:04 PM, Jason Gerecke <killertofu@gmail.com> wrote:
> 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.
--
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
Dima Zavin July 9, 2011, 6:16 a.m. UTC | #4
On Fri, Jul 8, 2011 at 2:04 PM, Jason Gerecke <killertofu@gmail.com> wrote:
> On Thu, Jul 7, 2011 at 6:13 PM, Jaya Kumar <jayakumar.lkml@gmail.com> wrote:
>> On Fri, Jul 8, 2011 at 5:04 AM, Jason Gerecke <killertofu@gmail.com> wrote:
>>> 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
>>
>
> 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.

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

>
> 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
Dima Zavin July 9, 2011, 6:22 a.m. UTC | #5
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

On Fri, Jul 8, 2011 at 11:15 PM, Jeffrey Brown <jeffbrown@android.com> wrote:
> On Thu, Jul 7, 2011 at 2:04 PM, Jason Gerecke <killertofu@gmail.com> wrote:
>> 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.
>
--
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 e94a21a..40ed685 100644
--- a/drivers/input/touchscreen/wacom_w8001.c
+++ b/drivers/input/touchscreen/wacom_w8001.c
@@ -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);