Bug 108861 - Support screen brightness adjustment button, the KEY_BRIGHTNESS_CYCLE EV_KEY
Summary: Support screen brightness adjustment button, the KEY_BRIGHTNESS_CYCLE EV_KEY
Status: RESOLVED FIXED
Alias: None
Product: xkeyboard-config
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: All Linux (All)
: high normal
Assignee: xkb
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-26 02:51 UTC by jian-hong
Modified: 2019-01-21 18:55 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch for mapping evdev keycode KEY_BRIGHTNESS_CYCLE to XF86MonBrightnessCycle (1.51 KB, patch)
2018-11-28 09:49 UTC, jian-hong
Details | Splinter Review

Description jian-hong 2018-11-26 02:51:15 UTC
The Acer Veriton Z4660G/Z4860G/Z6860G series AIO desktops have a brightness button in the bottom, but pressing the button does not work on Linux.  According to ODM's description, a control application will popup for brightness adjustment on Windows, if the button is pressed.
I have checked it with evtest:

sudo evtest 
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:	Sleep Button
/dev/input/event1:	Power Button
/dev/input/event2:	Power Button
/dev/input/event3:	Video Bus
/dev/input/event4:	USB Optical Mouse
/dev/input/event5:	Wired USB Keyboard
/dev/input/event6:	Wired USB Keyboard System Control
/dev/input/event7:	Wired USB Keyboard Consumer Control
/dev/input/event8:	HDA Intel PCH Front Mic
/dev/input/event9:	HDA Intel PCH Front Headphone
/dev/input/event10:	HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event11:	HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event12:	HDA Intel PCH HDMI/DP,pcm=8
/dev/input/event13:	HDA Intel PCH HDMI/DP,pcm=9
/dev/input/event14:	HDA Intel PCH HDMI/DP,pcm=10
/dev/input/event15:	USB2.0 FHD Camera: USB2.0 FHD C
Select the device event number [0-15]: 3
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)
Properties:
Testing ... (interrupt to exit)
Event: time 1542615014.263931, type 1 (EV_KEY), code 243 (KEY_BRIGHTNESS_CYCLE), value 1
Event: time 1542615014.263931, -------------- SYN_REPORT ------------
Event: time 1542615014.263939, type 1 (EV_KEY), code 243 (KEY_BRIGHTNESS_CYCLE), value 0
Event: time 1542615014.263939, -------------- SYN_REPORT ------------
Event: time 1542615015.380922, type 1 (EV_KEY), code 243 (KEY_BRIGHTNESS_CYCLE), value 1
Event: time 1542615015.380922, -------------- SYN_REPORT ------------
Event: time 1542615015.380930, type 1 (EV_KEY), code 243 (KEY_BRIGHTNESS_CYCLE), value 0

When the button is pressed, the code 243 (KEY_BRIGHTNESS_CYCLE) is sent.
I found there are codes for screen brightness "StepUp" and "StepDown".
However, it seems no related code for "Brightness Cycle" (something like that) in g-s-d now.
Comment 1 jian-hong 2018-11-26 02:55:33 UTC
I also checked with xev:

KeyPress event, serial 38, synthetic NO, window 0x2600001,
    root 0x177, subw 0x0, time 3371132, (225,-51), root:(275,35),
    state 0x10, keycode 251 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 38, synthetic NO, window 0x2600001,
    root 0x177, subw 0x0, time 3371132, (225,-51), root:(275,35),
    state 0x10, keycode 251 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

The key code is 251, but no corresponding symbol.
Then checked "/usr/share/X11/xkb/symbols/inet"

//  key <I249>   {      [ ]       }; // KEY_VIDEO_NEXT  --  drive next video source
//  key <I250>   {      [ ]       }; // KEY_VIDEO_PREV  --  drive previous video source
//  key <I251>   {      [ ]       }; // KEY_BRIGHTNESS_CYCLE  --  bright up, max++ == min
//  key <I252>   {      [ ]       }; // KEY_BRIGHTNESS_ZERO  --  brightness off
//  key <I253>   {      [ ]       }; // KEY_DISPLAY_OFF  --  turn off display

There is no symbol of key code 251, but the comment says it is KEY_BRIGHTNESS_CYCLE.

May we add the mapping symbol of the key code 251 for KEY_BRIGHTNESS_CYCLE?

Then we could make gnome-settings-daemon respond to that key, treating it as either a brightness cycle key for simplicity, to avoid having to implement a brightness change UI.
Comment 2 jian-hong 2018-11-26 02:56:43 UTC
By the way, I also reported this bug on gnome-settings-daemon https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/117
Comment 3 jian-hong 2018-11-28 09:24:36 UTC
Sent a patch for adding XF86XK_MonBrightnessCycle -> XF86MonBrightnessCycle in xorgproto
https://lists.x.org/archives/xorg-devel/2018-November/057764.html
Comment 4 jian-hong 2018-11-28 09:49:36 UTC
Created attachment 142641 [details] [review]
Patch for mapping evdev keycode KEY_BRIGHTNESS_CYCLE to XF86MonBrightnessCycle
Comment 5 GitLab Migration User 2018-12-28 00:45:43 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/issues/123.
Comment 6 Hans de Goede 2019-01-21 18:55:08 UTC
Patch merged, changing resolution to fixed.


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.