Bug 106057

Summary: Unwanted brightness events from ACPI video device on Dell Vostro 1520
Product: Wayland Reporter: Sam Morris <sam>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: CLOSED NOTOURBUG QA Contact:
Severity: enhancement    
Priority: medium CC: benjamin.tissoires, peter.hutterer
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Sam Morris 2018-04-15 18:52:05 UTC
On the Dell Vostro 1520, each event from the brightness up/down keys triggers an event from two different keyboards:

# libinput-debug-events
WARNING: This compatibility wrapper will be removed in the future. Please run 'libinput debug-events' instead
-event4   DEVICE_ADDED     Power Button                      seat0 default group1  cap:k
-event5   DEVICE_ADDED     Video Bus                         seat0 default group2  cap:k
-event2   DEVICE_ADDED     Power Button                      seat0 default group3  cap:k
-event1   DEVICE_ADDED     Lid Switch                        seat0 default group4  cap:S
-event3   DEVICE_ADDED     Sleep Button                      seat0 default group5  cap:k
-event9   DEVICE_ADDED     HDA Intel Mic                     seat0 default group6  cap:
-event10  DEVICE_ADDED     HDA Intel Front Headphone         seat0 default group6  cap:
-event0   DEVICE_ADDED     AT Translated Set 2 keyboard      seat0 default group7  cap:k
-event6   DEVICE_ADDED     AlpsPS/2 ALPS GlidePoint          seat0 default group8  cap:p  size 73x51mm tap(dl off) left scroll-nat scroll-edge dwt-on
-event0   KEYBOARD_KEY      +5.62s      KEY_BRIGHTNESSDOWN (224) pressed
 event0   KEYBOARD_KEY      +5.62s      KEY_BRIGHTNESSDOWN (224) released
-event5   KEYBOARD_KEY      +5.63s      KEY_BRIGHTNESSDOWN (224) pressed
 event5   KEYBOARD_KEY      +5.63s      KEY_BRIGHTNESSDOWN (224) released
 event5   KEYBOARD_KEY      +6.43s      KEY_BRIGHTNESSDOWN (224) pressed
 event5   KEYBOARD_KEY      +6.43s      KEY_BRIGHTNESSDOWN (224) released
-event0   KEYBOARD_KEY      +6.43s      KEY_BRIGHTNESSDOWN (224) pressed
 event0   KEYBOARD_KEY      +6.43s      KEY_BRIGHTNESSDOWN (224) released
-event5   KEYBOARD_KEY      +7.11s      KEY_BRIGHTNESSDOWN (224) pressed
 event5   KEYBOARD_KEY      +7.11s      KEY_BRIGHTNESSDOWN (224) released
-event0   KEYBOARD_KEY      +7.11s      KEY_BRIGHTNESSDOWN (224) pressed
 event0   KEYBOARD_KEY      +7.11s      KEY_BRIGHTNESSDOWN (224) released
 event0   KEYBOARD_KEY      +8.38s      KEY_BRIGHTNESSUP (225) pressed
 event0   KEYBOARD_KEY      +8.38s      KEY_BRIGHTNESSUP (225) released
-event5   KEYBOARD_KEY      +8.38s      KEY_BRIGHTNESSUP (225) pressed
 event5   KEYBOARD_KEY      +8.38s      KEY_BRIGHTNESSUP (225) released
-event0   KEYBOARD_KEY      +9.01s      KEY_BRIGHTNESSUP (225) pressed
 event0   KEYBOARD_KEY      +9.01s      KEY_BRIGHTNESSUP (225) released
-event5   KEYBOARD_KEY      +9.01s      KEY_BRIGHTNESSUP (225) pressed
 event5   KEYBOARD_KEY      +9.01s      KEY_BRIGHTNESSUP (225) released
-event0   KEYBOARD_KEY      +9.61s      KEY_BRIGHTNESSUP (225) pressed
 event0   KEYBOARD_KEY      +9.61s      KEY_BRIGHTNESSUP (225) released
-event5   KEYBOARD_KEY      +9.61s      KEY_BRIGHTNESSUP (225) pressed
 event5   KEYBOARD_KEY      +9.61s      KEY_BRIGHTNESSUP (225) released

The following hwdb entry tells libinput to ignore events from the unwanted device:

libinput:name:Video Bus:dmi:*svnDellInc.:pnVostro1520:*
  LIBINPUT_IGNORE_DEVICE=1

According to evtest, this device is capable of generating some other events:

# evtest /dev/input/event5
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x6 version 0x0
Input device name: "Video Bus"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 224 (KEY_BRIGHTNESSDOWN)
    Event code 225 (KEY_BRIGHTNESSUP)
    Event code 227 (KEY_SWITCHVIDEOMODE)
    Event code 241 (KEY_VIDEO_NEXT)
    Event code 242 (KEY_VIDEO_PREV)
    Event code 243 (KEY_BRIGHTNESS_CYCLE)
    Event code 244 (KEY_BRIGHTNESS_ZERO)
    Event code 245 (KEY_DISPLAY_OFF)

Fn+F8 generates KEY_SWITCHVIDEOMODE on the normal keyboard device, so this too is redundant. The other events do not correspond to any key combination that I know of, so it's probably safe to ignore this device entirely.
Comment 1 Peter Hutterer 2018-04-15 22:43:09 UTC
This is with a standard distro kernel or some custom-built one? What kernel version is this with?
Comment 2 Sam Morris 2018-04-16 10:24:45 UTC
The laptop is running the Debian provided kernel from unstable which is currently 4.15.11; it's possible that I haven't rebooted the laptop for a few days, so it might be slightly older but it's still a relatively recent distro-provided release.
Comment 3 Peter Hutterer 2018-04-17 00:55:36 UTC
Next question I should've asked in comment 1 already: is this a new bug, did you ever try with an earlier kernel? Just to rule out any kernel regressions.

A bit of digging in the kernel shows commit 4b4b3b20e8e645be103cf737827372f86479867a "ACPI / video: Add quirks for the Dell Vostro V131".

So this is one option, but a better option seems to be
https://github.com/systemd/systemd/issues/6972. That is the same issue on a different box and it can be fixed with a 60-keyboard.hwdb entry. So I'm punting this to systemd, please submit a PR to systemd for the hwdb to add your device there. If you cc me (@whot), I'll get your patch merged there.
Comment 4 Sam Morris 2018-04-18 09:26:03 UTC
Thanks for your feedback on this. I'll try to get a PR for systemd sent this weekend.
Comment 5 Sam Morris 2018-04-30 10:08:49 UTC
PR submitted as https://github.com/systemd/systemd/pull/8858 but even though the properties are applied to the input device, xorg is still not ignoring the keypresses--would appreciate if you could take a look. Thanks!
Comment 6 Peter Hutterer 2018-05-02 01:09:08 UTC
What's the status of this now? The PR is closed and you say the ML helped you out, so it's all good now?
Comment 7 Sam Morris 2018-05-02 08:42:37 UTC
I didn't realised that I used the translated keycode, not the original scan code in my PR. I'll re-open that once I've got it working with the right scan codes.

Thanks!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.