Skip to contentSkip to conversation

Spurious touchpad events with closed LID

DISCUSSION Pali Rohár 4 participants 11 messages Jun 26, 2017 – Jun 29, 2017 HID

lore
Share & tools
lore
#0 lore raw

Hi!

When I'm using dock with external input devices (keyboard + mouse) and LID is closed, I'm getting spurious touchpad events and random mouse clicks and movements.

It is because top part of LID is above touchpad and probably generates touch pushes.

Year (or two?) when I had conversation with ALPS people I was told that Windows driver is automatically turning touchpad off when ACPI LID close event is received (and similarly turn touchpad on).

Maybe Linux should do similar thing? Random movement or touchpad clicks is really annoying. But I'm not sure if kernel or userspace should do this job... What do you think?

Signature · 2 lines
Pali Rohár
[email protected]
#1 lore raw
Quoted 9 lines · Pali Rohár

Hi!

When I'm using dock with external input devices (keyboard + mouse) and LID is closed, I'm getting spurious touchpad events and random mouse clicks and movements.

It is because top part of LID is above touchpad and probably generates touch pushes.

Quoted 7 lines

Year (or two?) when I had conversation with ALPS people I was told that Windows driver is automatically turning touchpad off when ACPI LID close event is received (and similarly turn touchpad on).

Maybe Linux should do similar thing? Random movement or touchpad clicks is really annoying. But I'm not sure if kernel or userspace should do this job... What do you think?

It is a matter of policy (deciding when device is "usable") and this should be controlled from userspace. Kernel should provide necessary knobs for it though. For a long time I was saying that it should be done at device core level, but I do not think we will ever get there.

On ChromeOS input devices export "inhibit" attribute that basically overrides open/close count and prevents delivery of events to userspace, and power management driver controls this attribute together with wake up and others. This allows us to implement policies like "the touchpad should only be active and a wakeup source while the device is in laptop mode, but not in tablet or tent mode, or when lid is closed", "disable keyboard in tablet mode or when list is closed", etc.

Drivers can also implement inhibit/uninhibit methods that can put inhibited devices into lower power mode. I am not too happy with the implementation (I'd like to see if we could merge inhibit/uninhibit and open/close), that is why I haven't pushed it upstream yet.

Thanks.

Signature · 1 line
Dmitry
#2 lore raw
Quoted 24 lines · On Monday 26 June 2017 19:03:12 Dmitry Torokhov wrote:
Quoted 9 lines · Pali Rohár

Hi!

When I'm using dock with external input devices (keyboard + mouse) and LID is closed, I'm getting spurious touchpad events and random mouse clicks and movements.

It is because top part of LID is above touchpad and probably generates touch pushes.

Quoted 7 lines

Year (or two?) when I had conversation with ALPS people I was told that Windows driver is automatically turning touchpad off when ACPI LID close event is received (and similarly turn touchpad on).

Maybe Linux should do similar thing? Random movement or touchpad clicks is really annoying. But I'm not sure if kernel or userspace should do this job... What do you think?

It is a matter of policy (deciding when device is "usable") and this should be controlled from userspace. Kernel should provide necessary knobs for it though. For a long time I was saying that it should be done at device core level, but I do not think we will ever get there.

Quoted 4 lines

On ChromeOS input devices export "inhibit" attribute that basically overrides open/close count and prevents delivery of events to userspace, and power management driver controls this attribute together with wake up and others.

Hm... this sounds like a "disable" property for each event device which I was talking about months ago (ccing Pavel). Very similar problem is on Nokia N900, where touchscreen needs to be turned off when screen is locked and phone in pocket.

Quoted 5 lines

This allows us to implement
policies like "the touchpad should only be active and a wakeup source while the device is in laptop mode, but not in tablet or tent mode, or when lid is closed", "disable keyboard in tablet mode or when list is closed", etc.

Exactly. Userspace receive all needed events and then tell kernel to "mute" input device based on own userspace policies.

Quoted 2 lines

Drivers can also implement inhibit/uninhibit methods that can put inhibited devices into lower power mode.

Sounds good. Once events are not delivered to userspace, kernel does not have to receive them too and can power off that input device (if hw support such thing).

Quoted 3 lines

I am not too happy with the
implementation (I'd like to see if we could merge inhibit/uninhibit and open/close), that is why I haven't pushed it upstream yet.

Can you send some links to that implementation/patch series?

Signature · 2 lines
Pali Rohár
[email protected]
#3 lore raw

Hi!

Quoted 26 lines
Quoted 21 lines
Quoted 7 lines

When I'm using dock with external input devices (keyboard + mouse) and LID is closed, I'm getting spurious touchpad events and random mouse clicks and movements.

It is because top part of LID is above touchpad and probably generates touch pushes.

Quoted 7 lines

Year (or two?) when I had conversation with ALPS people I was told that Windows driver is automatically turning touchpad off when ACPI LID close event is received (and similarly turn touchpad on).

Maybe Linux should do similar thing? Random movement or touchpad clicks is really annoying. But I'm not sure if kernel or userspace should do this job... What do you think?

It is a matter of policy (deciding when device is "usable") and this should be controlled from userspace. Kernel should provide necessary knobs for it though. For a long time I was saying that it should be done at device core level, but I do not think we will ever get there.

Quoted 4 lines

On ChromeOS input devices export "inhibit" attribute that basically overrides open/close count and prevents delivery of events to userspace, and power management driver controls this attribute together with wake up and others.

Quoted 4 lines

Hm... this sounds like a "disable" property for each event device which I was talking about months ago (ccing Pavel). Very similar problem is on Nokia N900, where touchscreen needs to be turned off when screen is locked and phone in pocket.

Yes, disable property would be nice.

Quoted 5 lines
Quoted 5 lines

This allows us to implement
policies like "the touchpad should only be active and a wakeup source while the device is in laptop mode, but not in tablet or tent mode, or when lid is closed", "disable keyboard in tablet mode or when list is closed", etc.

While policy normally belongs to userspace, I'd argue this is workaround for a hardware bug, and in-kernel solution would be acceptable.

Anyway, disable attribute would be nice first step.

Best regards,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw
Quoted 1 line · Pavel Machek

<snip>

Quoted 5 lines

While policy normally belongs to userspace, I'd argue this is workaround for a hardware bug, and in-kernel solution would be acceptable.

Anyway, disable attribute would be nice first step.

It's already fixed for those of us on recent distributions. The "ID_INPUT_TOUCHPAD_INTEGRATION=internal" touchpads will be disabled when the lid is closed, when libinput is used to process the events.

Usually, non-crappy hardware will do that in firmware, but software is easier to patch ;)

#5 lore raw
Quoted 7 lines · On Thursday 29 June 2017 00:44:27 Bastien Nocera wrote:
Quoted 1 line · Pavel Machek

<snip>

Quoted 4 lines

While policy normally belongs to userspace, I'd argue this is workaround for a hardware bug, and in-kernel solution would be acceptable.

Quoted 5 lines
Quoted 1 line

Anyway, disable attribute would be nice first step.

It's already fixed for those of us on recent distributions. The "ID_INPUT_TOUCHPAD_INTEGRATION=internal" touchpads will be disabled when the lid is closed, when libinput is used to process the events.

But this does not fix other usage of /dev/input/* and also does not fix pressing spurious keys in linux virtual tty (ctrl+alt+f1). So it is not a fix.

Also important question is: How you detect which input device is "internal", non-removable part of notebook and which one is external?

You can have external USB touchpad, and also you can have external PS/2 keyboard connected to docking station (which was e.g. my situation).

Also there are PS/2 to active USB converters, to make whole situation complicated.

And moreover some internal notebook keyboards are connected via USB and some touchpads via i2c/smbus.

I think this detection is not easy or at least I have no idea how to do properly. Existence of PS/2 keyboard does not mean it is internal and existence of USB keyboard does not mean it is external.

Maybe ACPI/DSDT provides some information? (No idea, just asking)

Quoted 2 lines

Usually, non-crappy hardware will do that in firmware, but software is easier to patch ;)

Signature · 2 lines
Pali Rohár
[email protected]
#6 lore raw

Hi!

Quoted 27 lines · Pali Rohár
Quoted 7 lines · On Thursday 29 June 2017 00:44:27 Bastien Nocera wrote:
Quoted 1 line · Pavel Machek

<snip>

Quoted 4 lines

While policy normally belongs to userspace, I'd argue this is workaround for a hardware bug, and in-kernel solution would be acceptable.

Quoted 5 lines
Quoted 1 line

Anyway, disable attribute would be nice first step.

It's already fixed for those of us on recent distributions. The "ID_INPUT_TOUCHPAD_INTEGRATION=internal" touchpads will be disabled when the lid is closed, when libinput is used to process the events.

But this does not fix other usage of /dev/input/* and also does not fix pressing spurious keys in linux virtual tty (ctrl+alt+f1). So it is not a fix.

Also important question is: How you detect which input device is "internal", non-removable part of notebook and which one is external?

You can have external USB touchpad, and also you can have external PS/2 keyboard connected to docking station (which was e.g. my situation).

Also there are PS/2 to active USB converters, to make whole situation complicated.

Quoted 8 lines

And moreover some internal notebook keyboards are connected via USB and some touchpads via i2c/smbus.

I think this detection is not easy or at least I have no idea how to do properly. Existence of PS/2 keyboard does not mean it is internal and existence of USB keyboard does not mean it is external.

Maybe ACPI/DSDT provides some information? (No idea, just asking)

I'm not sure it is complex. You simply add DMI blacklist of the bad systems, with IDs of bad devices.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#7 lore raw
Quoted 33 lines · On Thursday 29 June 2017 12:08:37 Pavel Machek wrote:

Hi!

Quoted 30 lines · Pali Rohár
Quoted 7 lines · On Thursday 29 June 2017 00:44:27 Bastien Nocera wrote:
Quoted 1 line · Pavel Machek

<snip>

Quoted 4 lines

While policy normally belongs to userspace, I'd argue this is workaround for a hardware bug, and in-kernel solution would be acceptable.

Quoted 5 lines
Quoted 1 line

Anyway, disable attribute would be nice first step.

It's already fixed for those of us on recent distributions. The "ID_INPUT_TOUCHPAD_INTEGRATION=internal" touchpads will be disabled when the lid is closed, when libinput is used to process the events.

But this does not fix other usage of /dev/input/* and also does not fix pressing spurious keys in linux virtual tty (ctrl+alt+f1). So it is not a fix.

Also important question is: How you detect which input device is "internal", non-removable part of notebook and which one is external?

You can have external USB touchpad, and also you can have external PS/2 keyboard connected to docking station (which was e.g. my situation).

Also there are PS/2 to active USB converters, to make whole situation complicated.

And moreover some internal notebook keyboards are connected via USB and some touchpads via i2c/smbus.

Quoted 8 lines
Quoted 5 lines

I think this detection is not easy or at least I have no idea how to do properly. Existence of PS/2 keyboard does not mean it is internal and existence of USB keyboard does not mean it is external.

Maybe ACPI/DSDT provides some information? (No idea, just asking)

I'm not sure it is complex. You simply add DMI blacklist of the bad systems, with IDs of bad devices.

My original request is to disable internal keyboard, touchpad and trackpoint on notebook when it is docked and LID is closed.

It has nothing to do with DMI blacklist or so.

Signature · 2 lines
Pali Rohár
[email protected]
#8 lore raw
Quoted 40 lines · Pali Rohár
Quoted 39 lines · On Thursday 29 June 2017 12:08:37 Pavel Machek wrote:

Hi!

Quoted 35 lines · Pali Rohár
Quoted 7 lines · On Thursday 29 June 2017 00:44:27 Bastien Nocera wrote:
Quoted 1 line · Pavel Machek

<snip>

Quoted 4 lines

While policy normally belongs to userspace, I'd argue this is workaround for a hardware bug, and in-kernel solution would be acceptable.

Quoted 5 lines
Quoted 1 line

Anyway, disable attribute would be nice first step.

It's already fixed for those of us on recent distributions. The "ID_INPUT_TOUCHPAD_INTEGRATION=internal" touchpads will be disabled when the lid is closed, when libinput is used to process the events.

But this does not fix other usage of /dev/input/* and also does not fix pressing spurious keys in linux virtual tty (ctrl+alt+f1). So it is not a fix.

Also important question is: How you detect which input device is "internal", non-removable part of notebook and which one is external?

You can have external USB touchpad, and also you can have external PS/2 keyboard connected to docking station (which was e.g. my situation).

Also there are PS/2 to active USB converters, to make whole situation complicated.

And moreover some internal notebook keyboards are connected via USB and some touchpads via i2c/smbus.

I think this detection is not easy or at least I have no idea how to do properly. Existence of PS/2 keyboard does not mean it is internal and existence of USB keyboard does not mean it is external.

Maybe ACPI/DSDT provides some information? (No idea, just asking)

Quoted 7 lines
Quoted 2 lines

I'm not sure it is complex. You simply add DMI blacklist of the bad systems, with IDs of bad devices.

My original request is to disable internal keyboard, touchpad and trackpoint on notebook when it is docked and LID is closed.

It has nothing to do with DMI blacklist or so.

Well, you have a buggy notebook. On non-buggy ones, touchpad will not generate events when closed.

That's where the DMI blacklist comes to mind.

(Of course, disable attribute would still be nice for other cases.)
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#9 lore raw
Quoted 47 lines · On Thursday 29 June 2017 12:15:00 Pavel Machek wrote:
Quoted 46 lines · Pali Rohár
Quoted 33 lines · On Thursday 29 June 2017 12:08:37 Pavel Machek wrote:

Hi!

Quoted 30 lines · Pali Rohár
Quoted 7 lines · On Thursday 29 June 2017 00:44:27 Bastien Nocera wrote:
Quoted 1 line · Pavel Machek

<snip>

Quoted 4 lines

While policy normally belongs to userspace, I'd argue this is workaround for a hardware bug, and in-kernel solution would be acceptable.

Quoted 5 lines
Quoted 1 line

Anyway, disable attribute would be nice first step.

It's already fixed for those of us on recent distributions. The "ID_INPUT_TOUCHPAD_INTEGRATION=internal" touchpads will be disabled when the lid is closed, when libinput is used to process the events.

But this does not fix other usage of /dev/input/* and also does not fix pressing spurious keys in linux virtual tty (ctrl+alt+f1). So it is not a fix.

Also important question is: How you detect which input device is "internal", non-removable part of notebook and which one is external?

You can have external USB touchpad, and also you can have external PS/2 keyboard connected to docking station (which was e.g. my situation).

Also there are PS/2 to active USB converters, to make whole situation complicated.

And moreover some internal notebook keyboards are connected via USB and some touchpads via i2c/smbus.

Quoted 8 lines
Quoted 5 lines

I think this detection is not easy or at least I have no idea how to do properly. Existence of PS/2 keyboard does not mean it is internal and existence of USB keyboard does not mean it is external.

Maybe ACPI/DSDT provides some information? (No idea, just asking)

I'm not sure it is complex. You simply add DMI blacklist of the bad systems, with IDs of bad devices.

My original request is to disable internal keyboard, touchpad and trackpoint on notebook when it is docked and LID is closed.

Quoted 6 lines
Quoted 1 line

It has nothing to do with DMI blacklist or so.

Well, you have a buggy notebook. On non-buggy ones, touchpad will not generate events when closed.

That's where the DMI blacklist comes to mind.

Such blacklist would be huge. Lot of notebooks working in this way.

Quoted 1 line

(Of course, disable attribute would still be nice for other cases.)

Yes.

Signature · 2 lines
Pali Rohár
[email protected]
#10 lore raw
In reply to Pali Rohár
Quoted 16 lines · Pali Rohár
Quoted 8 lines · On Thursday 29 June 2017 00:44:27 Bastien Nocera wrote:
Quoted 1 line · Pavel Machek

<snip>

Quoted 4 lines

While policy normally belongs to userspace, I'd argue this is workaround for a hardware bug, and in-kernel solution would be acceptable.

Quoted 6 lines
Quoted 1 line

Anyway, disable attribute would be nice first step.

It's already fixed for those of us on recent distributions. The "ID_INPUT_TOUCHPAD_INTEGRATION=internal" touchpads will be disabled when the lid is closed, when libinput is used to process the events.

Quoted 8 lines

But this does not fix other usage of /dev/input/* and also does not fix
pressing spurious keys in linux virtual tty (ctrl+alt+f1). So it is not
a fix.

Also important question is: How you detect which input device is "internal", non-removable part of notebook and which one is external?

We have heuristics and a database. Look at the hwdb/ subdirectory in systemd.

Quoted 1 line

Maybe ACPI/DSDT provides some information? (No idea, just asking)

It could and should, but it's usually empty because when some hardware makers can't be bothered to change the device's name, they'll hardly spend that time adding location information, are they?