Bug 1141525 - Two backlight events upon single keypress on Dell Inspiron 1520
Summary: Two backlight events upon single keypress on Dell Inspiron 1520
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 20
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-14 12:35 UTC by Pavel Malyshev
Modified: 2015-01-14 23:57 UTC (History)
16 users (show)

Fixed In Version: systemd-208-29.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-01-14 23:57:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
lspci -vvv (14.68 KB, text/plain)
2014-09-14 12:35 UTC, Pavel Malyshev
no flags Details
lsmod (5.07 KB, text/plain)
2014-09-21 07:43 UTC, Pavel Malyshev
no flags Details
[PATCH] hwdb: Ignore brightness keys on Dell Inspiron 1520 to avoid double events (1.61 KB, patch)
2014-10-30 09:18 UTC, Hans de Goede
no flags Details | Diff

Description Pavel Malyshev 2014-09-14 12:35:56 UTC
Created attachment 937319 [details]
lspci -vvv

Description of problem:

Whenever I press Fn buttons to change backlight on my Dell Inspiron 1520, I observe:
 * Brightness level changes twice
 * Gnome brightness indicator shows level change twice
 * Journalctl shows two executions of gsd-backlight-helper
 * udevadm shows 2 kernel and 2 udev events


Version-Release number of selected component (if applicable):

Linux kelly.ddns.int.prhv.afunix.org 3.16.2-200.fc20.x86_64 #1 SMP Mon Sep 8 11:54:45 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

How reproducible:

Easily


Steps to Reproduce:
1. Press Fn+UP to increase backlight brightness level

Actual results:

Brightness is increased twice

Expected results:

Brightness increased once


Additional info:

Journalctl log:
Sep 14 16:25:49 kelly.ddns.int.prhv.afunix.org pkexec[9342]: pam_unix(polkit-1:session): session opened for user root by (uid=1044)
Sep 14 16:25:49 kelly.ddns.int.prhv.afunix.org pkexec[9342]: afunix: Executing command [USER=root] [TTY=unknown] [CWD=/home/afunix] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 5]
Sep 14 16:25:49 kelly.ddns.int.prhv.afunix.org pkexec[9349]: pam_unix(polkit-1:session): session opened for user root by (uid=1044)
Sep 14 16:25:49 kelly.ddns.int.prhv.afunix.org pkexec[9349]: afunix: Executing command [USER=root] [TTY=unknown] [CWD=/home/afunix] [COMMAND=/usr/libexec/gsd-backlight-helper --set-brightness 6]

# udevadm monitor
KERNEL[6937.062837] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0 (backlight)
UDEV  [6937.145949] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0 (backlight)
KERNEL[6937.173884] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0 (backlight)
UDEV  [6937.174845] change   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/backlight/acpi_video0 (backlight)

Comment 1 Hans de Goede 2014-09-15 14:08:59 UTC
Hi,

Can you please do:

"sudo yum install evemu" 

Then change to a text console (ctrl+alt+f2) and run evemu-record. This will give you a list of input devices, then select the first one, press the brightness keys and see if you get any events for them,
press ctrl+c to exit.

Note down the device name if you get events, then move to the second one in the list, etc.

Repeat this until you've gone over the entire list, and please let us know which devices generate brightness key events (I suspect there will be 2 distinct devices doing this).

Thanks,

Hans

Comment 2 Pavel Malyshev 2014-09-21 07:42:29 UTC
Hi Hans,

The devices which generate events upon brightness keys:
  /dev/input/event3  AT Translated 2 Keyboard
  /dev/input/event5  Video Bus


Not sure if it helps, but I don't know how to debug further:
$ ls -l /sys/class/input | grep event3
lrwxrwxrwx. 1 root root 0 сен 20 08:40 event3 -> ../../devices/platform/i8042/serio0/input/input3/event3

$ cat /sys/class/input/event3/dev
13:67

$ cat /sys/class/input/event3/device/phys
isa0060/serio0/input0

$ cat /sys/class/input/event3/device/modalias
input:b0011v0001p0001eAB41-e0,1,4,11,14,k71,72,73,74,75,76,77,79,7A,7B,7C,7D,7E,7F,80,8C,8D,8E,8F,94,98,9B,9C,9D,9E,9F,A2,A3,A4,A5,A6,AC,AD,B7,B8,B9,BF,CD,D4,D7,D9,E0,E1,E2,E3,EC,F0,ram4,l0,1,2,sfw



$ ls -l /sys/class/input | grep event5
lrwxrwxrwx. 1 root root 0 сен 20 08:40 event5 -> ../../devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:2d/LNXVIDEO:00/input/input7/event5

$ cat /sys/class/input/event5/dev
13:69

$ cat /sys/class/input/event5/device/phys
LNXVIDEO/video/input0

$ cat /sys/class/input/event5/device/modalias
input:b0019v0000p0006e0000-e0,1,kE0,E1,E3,F1,F2,F3,F4,F5,ramlsfw


$ cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.16.2-201.fc20.x86_64 root=/dev/mapper/kelly-root ro vconsole.font=latarcyrheb-sun16 rd.lvm.lv=kelly/usr rd.lvm.lv=kelly/root rd.lvm.lv=kelly/swap rhgb quiet crashkernel=128M LANG=ru_RU.UTF-8

Comment 3 Pavel Malyshev 2014-09-21 07:43:19 UTC
Created attachment 939721 [details]
lsmod

Comment 4 Hans de Goede 2014-10-28 10:54:18 UTC
Hi Pavel,

Sorry for the slow response, I've had quite a busy month with the XDC & Plumbers conferences, etc.

Lets try and see where the "AT Translated 2 Keyboard" events are coming from and if we can disable them.

Can you boot your system with "atkbd.softraw=0" added to the kernel commandline, then switch to a text-console (use ctrl+alt+F2), login as root and then run:

showkey -s

And then press the brightness up / down key-combos, write down what the emit, and report back here in bugzilla what they emit, then I can see if I can find where they are being mapped, and if we can suppress that mapping.

Regards,

Hans

Comment 5 Pavel Malyshev 2014-10-28 18:11:32 UTC
Hi Hans.

Updated kernel commandline to (/proc/cmdline):
BOOT_IMAGE=/vmlinuz-3.16.6-200.fc20.x86_64 root=/dev/mapper/kelly-root ro vconsole.font=latarcyrheb-sun16 rd.lvm.lv=kelly/usr rd.lvm.lv=kelly/root rd.lvm.lv=kelly/swap rhgb quiet crashkernel=128M LANG=ru_RU.UTF-8 atkbd.softraw=0

Brightness up key emits:
0xe0 0x06 0xe0 0x54 0xe0 0xd4 

Brightness down key emits:
0xe0 0x05 0xe0 0x4c 0xe0 0xcc

Comment 6 Hans de Goede 2014-10-29 11:09:34 UTC
Hi Pavel,

Good, we seem to be getting somewhere, can you please (as root) open:

/lib/udev/hwdb.d/60-keyboard.hwdb

In a terminal, and then go to line 193, at (or around) line 193 you should have:

 KEYBOARD_KEY_85=brightnessdown                         # Fn+Down Brightness Down
 KEYBOARD_KEY_86=brightnessup                           # Fn+Up Brightness Up

Change these 2 lines into:

 KEYBOARD_KEY_85=unknown                         # Brightness Down, also emitted by acpi-video, ignore
 KEYBOARD_KEY_86=unknown                         # Brightness Up, also emitted by acpi-video, ignore

Then save and close the file.

After this as root run:

udevadm hwdb --update

And then reboot your system, after this the double key presses should be gone.


To make a proper upstreamable patch of this, I need to add a snippet to 60-keyboard.hwdb overriding
the previous snippet, which matches on your model only.

So if this fixes things, please restore the 2 lines to their original, and add a new snippet below the
generic Dell block (the block which starts with "keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pn*"

This new snippet should look something like this:

keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnInspiron*1520:pvr*
 KEYBOARD_KEY_85=unknown                         # Brightness Down, also emitted by acpi-video, ignore
 KEYBOARD_KEY_86=unknown                         # Brightness Up, also emitted by acpi-video, ignore

The "Inspiron*1520" bit may be incorrect, do:

cat /sys/class/dmi/id/product_name

To see what you should use to match your model on. Once you've the new snippet written, run
"sudo udevadm hwdb --update" again, and reboot again, then check the brightness keys still only emit one event per press. Once you've a working overriding snippet, please add a comment here copy and pasting the new snippet, then I'll turn it into a patch and submit that to the upstream hwdb maintainers.

Thanks,

Hans

Comment 7 Pavel Malyshev 2014-10-29 20:34:03 UTC
Hans, it's amazing!


The snippet is exactly the one you've posted:
# Dell Inspiron 1520
keyboard:dmi:bvn*:bvr*:bd*:svnDell*:pnInspiron*1520:pvr*
 KEYBOARD_KEY_85=unknown
 KEYBOARD_KEY_86=unknown


And /sys/class/dmi/id/product_name contains:
Inspiron 1520          


Thank you, it finally works!

Comment 8 Hans de Goede 2014-10-30 09:18:47 UTC
Created attachment 952019 [details]
[PATCH] hwdb: Ignore brightness keys on Dell Inspiron 1520 to avoid double events

(In reply to Pavel Malyshev from comment #7)
> Thank you, it finally works!

Great. I've just send a patch upstream (systemd) to add the fix to the official hwdb. Fixing this offically in Fedora also is up to the systemd maintainers, so I'm re-assigning this to them.

Hi systemd-maintainers, this patch (which has also been send upstream) fixes this issue, perhaps you can add it to the next build of systemd for F20+ ?

Regards,

Hans

Comment 9 Hans de Goede 2014-10-30 09:20:24 UTC
Re-assigning this to systemd.

Hi systemd-maintainers, the attached patch (which has also been send upstream) fixes this issue, perhaps you can add it to the next build of systemd for F20+ ?

Regards,

Hans

Comment 10 Zbigniew Jędrzejewski-Szmek 2014-10-30 12:53:06 UTC
Sure, thanks for the patch.

Comment 12 Fedora Update System 2015-01-06 13:51:42 UTC
systemd-208-29.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/systemd-208-29.fc20

Comment 13 Fedora Update System 2015-01-07 01:24:49 UTC
Package systemd-208-29.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing systemd-208-29.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-0254/systemd-208-29.fc20
then log in and leave karma (feedback).

Comment 14 Fedora Update System 2015-01-14 23:57:09 UTC
systemd-208-29.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.