diff mbox series

[v3,3/9] input: elants: remove unused axes

Message ID 62e897b0d6f6054dae26c853a9a1f1fb6d3c420b.1586784389.git.mirq-linux@rere.qmqm.pl (mailing list archive)
State Superseded
Headers show
Series input: elants: Support Asus TF300T touchscreen | expand

Commit Message

Michał Mirosław April 13, 2020, 1:32 p.m. UTC
Driver only ever reports MT events. Clear capabilities of all others.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/input/touchscreen/elants_i2c.c | 11 -----------
 1 file changed, 11 deletions(-)

Comments

Dmitry Torokhov April 26, 2020, 4:52 a.m. UTC | #1
On Mon, Apr 13, 2020 at 03:32:23PM +0200, Michał Mirosław wrote:
> Driver only ever reports MT events. Clear capabilities of all others.

This is not true. input_mt_sync_frame() calls
input_mt_report_pointer_emulation() which does emut single-touch events
for the benefit of older userspace (or userspace that is not interested
in multitouch).

Thanks.
Dmitry Osipenko April 26, 2020, 5:07 a.m. UTC | #2
26.04.2020 07:52, Dmitry Torokhov пишет:
> On Mon, Apr 13, 2020 at 03:32:23PM +0200, Michał Mirosław wrote:
>> Driver only ever reports MT events. Clear capabilities of all others.
> 
> This is not true. input_mt_sync_frame() calls
> input_mt_report_pointer_emulation() which does emut single-touch events
> for the benefit of older userspace (or userspace that is not interested
> in multitouch).

That's a good catch, thank you very much for the clarification!
Michał Mirosław April 26, 2020, 11:21 a.m. UTC | #3
On Sat, Apr 25, 2020 at 09:52:00PM -0700, Dmitry Torokhov wrote:
> On Mon, Apr 13, 2020 at 03:32:23PM +0200, Michał Mirosław wrote:
> > Driver only ever reports MT events. Clear capabilities of all others.
> This is not true. input_mt_sync_frame() calls
> input_mt_report_pointer_emulation() which does emut single-touch events
> for the benefit of older userspace (or userspace that is not interested
> in multitouch).

Oh, I didn't notice that. Looking at the code, I see that
input_mt_init_slots() sets up the emulated axes in this case.

Do you need me to update the commitmsg?

Best Regards,
Michał Mirosław
Dmitry Osipenko April 26, 2020, 3:39 p.m. UTC | #4
26.04.2020 14:21, Michał Mirosław пишет:
> On Sat, Apr 25, 2020 at 09:52:00PM -0700, Dmitry Torokhov wrote:
>> On Mon, Apr 13, 2020 at 03:32:23PM +0200, Michał Mirosław wrote:
>>> Driver only ever reports MT events. Clear capabilities of all others.
>> This is not true. input_mt_sync_frame() calls
>> input_mt_report_pointer_emulation() which does emut single-touch events
>> for the benefit of older userspace (or userspace that is not interested
>> in multitouch).
> 
> Oh, I didn't notice that. Looking at the code, I see that
> input_mt_init_slots() sets up the emulated axes in this case.
> 
> Do you need me to update the commitmsg?

I tried Ubuntu 12.04 that uses ancient libinput (or whatever it was back
then), which doesn't support MT. Mouse doesn't move at all with this
patch being applied. Without this patch mouse moves, but it's not usable
because the cursor's position is wrong, i.e. mouse position doesn't
match the screen touches.

This means that input_mt_report_pointer_emulation() doesn't set up
everything needed for the legacy pointer emulation.
Dmitry Osipenko April 26, 2020, 3:41 p.m. UTC | #5
26.04.2020 18:39, Dmitry Osipenko пишет:
> 26.04.2020 14:21, Michał Mirosław пишет:
>> On Sat, Apr 25, 2020 at 09:52:00PM -0700, Dmitry Torokhov wrote:
>>> On Mon, Apr 13, 2020 at 03:32:23PM +0200, Michał Mirosław wrote:
>>>> Driver only ever reports MT events. Clear capabilities of all others.
>>> This is not true. input_mt_sync_frame() calls
>>> input_mt_report_pointer_emulation() which does emut single-touch events
>>> for the benefit of older userspace (or userspace that is not interested
>>> in multitouch).
>>
>> Oh, I didn't notice that. Looking at the code, I see that
>> input_mt_init_slots() sets up the emulated axes in this case.
>>
>> Do you need me to update the commitmsg?
> 
> I tried Ubuntu 12.04 that uses ancient libinput (or whatever it was back
> then), which doesn't support MT. Mouse doesn't move at all with this
> patch being applied. Without this patch mouse moves, but it's not usable
> because the cursor's position is wrong, i.e. mouse position doesn't
> match the screen touches.
> 
> This means that input_mt_report_pointer_emulation() doesn't set up
> everything needed for the legacy pointer emulation.
> 

I meant the input_mt_init_slots().
Dmitry Osipenko April 26, 2020, 4:11 p.m. UTC | #6
26.04.2020 18:41, Dmitry Osipenko пишет:
> 26.04.2020 18:39, Dmitry Osipenko пишет:
>> 26.04.2020 14:21, Michał Mirosław пишет:
>>> On Sat, Apr 25, 2020 at 09:52:00PM -0700, Dmitry Torokhov wrote:
>>>> On Mon, Apr 13, 2020 at 03:32:23PM +0200, Michał Mirosław wrote:
>>>>> Driver only ever reports MT events. Clear capabilities of all others.
>>>> This is not true. input_mt_sync_frame() calls
>>>> input_mt_report_pointer_emulation() which does emut single-touch events
>>>> for the benefit of older userspace (or userspace that is not interested
>>>> in multitouch).
>>>
>>> Oh, I didn't notice that. Looking at the code, I see that
>>> input_mt_init_slots() sets up the emulated axes in this case.
>>>
>>> Do you need me to update the commitmsg?
>>
>> I tried Ubuntu 12.04 that uses ancient libinput (or whatever it was back
>> then), which doesn't support MT. Mouse doesn't move at all with this
>> patch being applied.

> Without this patch mouse moves, but it's not usable
>> because the cursor's position is wrong, i.e. mouse position doesn't
>> match the screen touches.

The fix for the legacy pointer emulation is trivial:

--- >8 ---
diff --git a/drivers/input/touchscreen/elants_i2c.c
b/drivers/input/touchscreen/elants_i2c.c
index 060c60c04f25..3644b5b48081 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -1414,6 +1414,8 @@ static int elants_i2c_probe(struct i2c_client *client,
 	input_abs_set_res(ts->input, ABS_X, ts->x_res);
 	input_abs_set_res(ts->input, ABS_Y, ts->y_res);

+	touchscreen_parse_properties(ts->input, false, &ts->prop);
+
 	/* Multitouch input params setup */
 	error = input_mt_init_slots(ts->input, MAX_CONTACT_NUM,
 				    INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
--- >8 ---

Michał, please incorporate this change into the next version.

>> This means that input_mt_report_pointer_emulation() doesn't set up
>> everything needed for the legacy pointer emulation.
>>
> 
> I meant the input_mt_init_slots().
>
Michał Mirosław April 26, 2020, 4:12 p.m. UTC | #7
On Sun, Apr 26, 2020 at 06:41:34PM +0300, Dmitry Osipenko wrote:
> 26.04.2020 18:39, Dmitry Osipenko пишет:
> > 26.04.2020 14:21, Michał Mirosław пишет:
> >> On Sat, Apr 25, 2020 at 09:52:00PM -0700, Dmitry Torokhov wrote:
> >>> On Mon, Apr 13, 2020 at 03:32:23PM +0200, Michał Mirosław wrote:
> >>>> Driver only ever reports MT events. Clear capabilities of all others.
> >>> This is not true. input_mt_sync_frame() calls
> >>> input_mt_report_pointer_emulation() which does emut single-touch events
> >>> for the benefit of older userspace (or userspace that is not interested
> >>> in multitouch).
> >>
> >> Oh, I didn't notice that. Looking at the code, I see that
> >> input_mt_init_slots() sets up the emulated axes in this case.
> >>
> >> Do you need me to update the commitmsg?
> > 
> > I tried Ubuntu 12.04 that uses ancient libinput (or whatever it was back
> > then), which doesn't support MT. Mouse doesn't move at all with this
> > patch being applied. Without this patch mouse moves, but it's not usable
> > because the cursor's position is wrong, i.e. mouse position doesn't
> > match the screen touches.
> > 
> > This means that input_mt_report_pointer_emulation() doesn't set up
> > everything needed for the legacy pointer emulation.
> > 
> 
> I meant the input_mt_init_slots().

Can you try v4 and see if it helps? input_mt_init_slots() needs other
axes set up before for it to use correct ranges.

Best Regards
Michał Mirosław
Dmitry Osipenko April 26, 2020, 4:14 p.m. UTC | #8
26.04.2020 19:12, Michał Mirosław пишет:
> On Sun, Apr 26, 2020 at 06:41:34PM +0300, Dmitry Osipenko wrote:
>> 26.04.2020 18:39, Dmitry Osipenko пишет:
>>> 26.04.2020 14:21, Michał Mirosław пишет:
>>>> On Sat, Apr 25, 2020 at 09:52:00PM -0700, Dmitry Torokhov wrote:
>>>>> On Mon, Apr 13, 2020 at 03:32:23PM +0200, Michał Mirosław wrote:
>>>>>> Driver only ever reports MT events. Clear capabilities of all others.
>>>>> This is not true. input_mt_sync_frame() calls
>>>>> input_mt_report_pointer_emulation() which does emut single-touch events
>>>>> for the benefit of older userspace (or userspace that is not interested
>>>>> in multitouch).
>>>>
>>>> Oh, I didn't notice that. Looking at the code, I see that
>>>> input_mt_init_slots() sets up the emulated axes in this case.
>>>>
>>>> Do you need me to update the commitmsg?
>>>
>>> I tried Ubuntu 12.04 that uses ancient libinput (or whatever it was back
>>> then), which doesn't support MT. Mouse doesn't move at all with this
>>> patch being applied. Without this patch mouse moves, but it's not usable
>>> because the cursor's position is wrong, i.e. mouse position doesn't
>>> match the screen touches.
>>>
>>> This means that input_mt_report_pointer_emulation() doesn't set up
>>> everything needed for the legacy pointer emulation.
>>>
>>
>> I meant the input_mt_init_slots().
> 
> Can you try v4 and see if it helps? input_mt_init_slots() needs other
> axes set up before for it to use correct ranges.


Sure! I'll try it right now.
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index ddebd3741145..fcd3d189f184 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -1312,17 +1312,6 @@  static int elants_i2c_probe(struct i2c_client *client,
 	ts->input->name = "Elan Touchscreen";
 	ts->input->id.bustype = BUS_I2C;
 
-	__set_bit(BTN_TOUCH, ts->input->keybit);
-	__set_bit(EV_ABS, ts->input->evbit);
-	__set_bit(EV_KEY, ts->input->evbit);
-
-	/* Single touch input params setup */
-	input_set_abs_params(ts->input, ABS_X, 0, ts->x_max, 0, 0);
-	input_set_abs_params(ts->input, ABS_Y, 0, ts->y_max, 0, 0);
-	input_set_abs_params(ts->input, ABS_PRESSURE, 0, 255, 0, 0);
-	input_abs_set_res(ts->input, ABS_X, ts->x_res);
-	input_abs_set_res(ts->input, ABS_Y, ts->y_res);
-
 	/* Multitouch input params setup */
 	error = input_mt_init_slots(ts->input, MAX_CONTACT_NUM,
 				    INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);