* [PATCH] Input: wm97xx: add BTN_TOUCH event to wm97xx to use it with Android
@ 2009-02-17 9:43 Mike Rapoport
2009-02-17 10:02 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Mike Rapoport @ 2009-02-17 9:43 UTC (permalink / raw)
To: lrg, broonie; +Cc: linux-input, Mike Rapoport
Please CC me, I'm not subscribed to linux-input
Android expects BTN_TOUCH events when pen state changes. Add BTN_TOUCH
event reporting to allow use of wm97xx touchscreen controller wiht
Android devices.
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
---
drivers/input/touchscreen/wm97xx-core.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index d15aa11..4551f88 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -409,6 +409,7 @@ static int wm97xx_read_samples(struct wm97xx *wm)
wm->pen_is_down = 0;
dev_dbg(wm->dev, "pen up\n");
input_report_abs(wm->input_dev, ABS_PRESSURE, 0);
+ input_report_key(wm->input_dev, BTN_TOUCH, 0);
input_sync(wm->input_dev);
} else if (!(rc & RC_AGAIN)) {
/* We need high frequency updates only while
@@ -433,6 +434,7 @@ static int wm97xx_read_samples(struct wm97xx *wm)
input_report_abs(wm->input_dev, ABS_X, data.x & 0xfff);
input_report_abs(wm->input_dev, ABS_Y, data.y & 0xfff);
input_report_abs(wm->input_dev, ABS_PRESSURE, data.p & 0xfff);
+ input_report_key(wm->input_dev, BTN_TOUCH, 1);
input_sync(wm->input_dev);
wm->pen_is_down = 1;
wm->ts_reader_interval = wm->ts_reader_min_interval;
@@ -629,9 +631,11 @@ static int wm97xx_probe(struct device *dev)
wm->input_dev->open = wm97xx_ts_input_open;
wm->input_dev->close = wm97xx_ts_input_close;
set_bit(EV_ABS, wm->input_dev->evbit);
+ set_bit(EV_KEY, wm->input_dev->evbit);
set_bit(ABS_X, wm->input_dev->absbit);
set_bit(ABS_Y, wm->input_dev->absbit);
set_bit(ABS_PRESSURE, wm->input_dev->absbit);
+ set_bit(BTN_TOUCH, wm->input_dev->keybit);
input_set_abs_params(wm->input_dev, ABS_X, abs_x[0], abs_x[1],
abs_x[2], 0);
input_set_abs_params(wm->input_dev, ABS_Y, abs_y[0], abs_y[1],
--
1.5.6.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: wm97xx: add BTN_TOUCH event to wm97xx to use it with Android
2009-02-17 9:43 [PATCH] Input: wm97xx: add BTN_TOUCH event to wm97xx to use it with Android Mike Rapoport
@ 2009-02-17 10:02 ` Mark Brown
2009-02-17 11:42 ` Mike Rapoport
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2009-02-17 10:02 UTC (permalink / raw)
To: Mike Rapoport; +Cc: lrg, linux-input
On Tue, Feb 17, 2009 at 11:43:33AM +0200, Mike Rapoport wrote:
> Please CC me, I'm not subscribed to linux-input
> Android expects BTN_TOUCH events when pen state changes. Add BTN_TOUCH
> event reporting to allow use of wm97xx touchscreen controller wiht
> Android devices.
> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Hrm. While this is obviously fine from a code point of view it seems
like it'd be better to synthesise the BTN_TOUCH events in the input core
if we want to do this - that way all drivers will behave consistently.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: wm97xx: add BTN_TOUCH event to wm97xx to use it with Android
2009-02-17 10:02 ` Mark Brown
@ 2009-02-17 11:42 ` Mike Rapoport
2009-02-17 13:30 ` Mark Brown
0 siblings, 1 reply; 5+ messages in thread
From: Mike Rapoport @ 2009-02-17 11:42 UTC (permalink / raw)
To: Mark Brown; +Cc: lrg, linux-input
Mark Brown wrote:
> On Tue, Feb 17, 2009 at 11:43:33AM +0200, Mike Rapoport wrote:
>> Please CC me, I'm not subscribed to linux-input
>
>> Android expects BTN_TOUCH events when pen state changes. Add BTN_TOUCH
>> event reporting to allow use of wm97xx touchscreen controller wiht
>> Android devices.
>
>> Signed-off-by: Mike Rapoport <mike@compulab.co.il>
>
> Hrm. While this is obviously fine from a code point of view it seems
> like it'd be better to synthesise the BTN_TOUCH events in the input core
> if we want to do this - that way all drivers will behave consistently.
>
The difficulty here is to find out when BTN_TOUCH should be generated and what
should be its value. As far as I can see from different drivers, there's no
one-to-one correspondence between ABS_PRESSURE and BTN_TOUCH. For instance,
drivers/input/mouse/synaptics.c has
if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1);
if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0);
if (hw.z > 0) {
input_report_abs(dev, ABS_X, hw.x);
input_report_abs(dev, ABS_Y, YMAX_NOMINAL + YMIN_NOMINAL - hw.y);
}
input_report_abs(dev, ABS_PRESSURE, hw.z);
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: wm97xx: add BTN_TOUCH event to wm97xx to use it with Android
2009-02-17 11:42 ` Mike Rapoport
@ 2009-02-17 13:30 ` Mark Brown
2009-02-18 7:29 ` Mike Rapoport
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2009-02-17 13:30 UTC (permalink / raw)
To: Mike Rapoport; +Cc: lrg, linux-input
On Tue, Feb 17, 2009 at 01:42:19PM +0200, Mike Rapoport wrote:
> The difficulty here is to find out when BTN_TOUCH should be generated and what
> should be its value. As far as I can see from different drivers, there's no
> one-to-one correspondence between ABS_PRESSURE and BTN_TOUCH. For instance,
> drivers/input/mouse/synaptics.c has
As a default it should be fine to check for zero/non-zero. Anything
that wants to override the behaviour could supply their own BTN_TOUCH.
Another option would be to change Android user space to support pressure
only touchscreens.
Like I say, I'm fine with the patch itself so it's got my ack - it just
feels like it fixes the problem at the wrong level. From that PoV
consider it to have
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Input: wm97xx: add BTN_TOUCH event to wm97xx to use it with Android
2009-02-17 13:30 ` Mark Brown
@ 2009-02-18 7:29 ` Mike Rapoport
0 siblings, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2009-02-18 7:29 UTC (permalink / raw)
To: Mark Brown; +Cc: lrg, linux-input
Mark Brown wrote:
> On Tue, Feb 17, 2009 at 01:42:19PM +0200, Mike Rapoport wrote:
>
>> The difficulty here is to find out when BTN_TOUCH should be generated and what
>> should be its value. As far as I can see from different drivers, there's no
>> one-to-one correspondence between ABS_PRESSURE and BTN_TOUCH. For instance,
>> drivers/input/mouse/synaptics.c has
>
> As a default it should be fine to check for zero/non-zero. Anything
> that wants to override the behaviour could supply their own BTN_TOUCH.
> Another option would be to change Android user space to support pressure
> only touchscreens.
Android uses test_bit(BTN_TOUCH) to detect a touchscreen. So, adding generated
BTN_TOUCH event in the input core without changing the input_dev->keybit won't
help. And if we force BTN_TOUCH set in the input core there would be no way to
differentiate between devices that supply their own BTN_TOUCH and devices that
don't.
Apparently the most correct way would be to change Android touchscreen detection
and BTN_TOUCH/ABS_PRESSURE handling. But until it's done I'd prefer wm97xx to
report BTN_TOUCH :)
> Like I say, I'm fine with the patch itself so it's got my ack - it just
> feels like it fixes the problem at the wrong level. From that PoV
> consider it to have
>
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-02-18 7:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-17 9:43 [PATCH] Input: wm97xx: add BTN_TOUCH event to wm97xx to use it with Android Mike Rapoport
2009-02-17 10:02 ` Mark Brown
2009-02-17 11:42 ` Mike Rapoport
2009-02-17 13:30 ` Mark Brown
2009-02-18 7:29 ` Mike Rapoport
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).