Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • G gnome-settings-daemon
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 317
    • Issues 317
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 43
    • Merge requests 43
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • gnome-settings-daemon
  • Merge requests
  • !16

gsd: Fix keyboard backlight toggle state machines

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Jian-Hong Pan requested to merge starnight/gnome-settings-daemon:I41 into master May 03, 2018
  • Overview 2
  • Commits 1
  • Pipelines 3
  • Changes 1

Some laptops like ASUS UX550GE has a hotkey (Fn+F7) for keyboard backlight toggle. In this UX550GE, the hotkey not only switches on/off the keyboard backlight, but also increments the level of brightness from 1 to max 3. In this case, it will trigger the keyboard backlight StepUp and Toggle events and execute the handle_method_call_keyboard function of gsd_power_manager.c in GNOME settings daemon when the hotkey is pressed.

The ideal scenario of pressing hotkey should trigger the events like:

.. StepUp -> Toggle -> StepUp -> StepUp -> StepUp -> Toggle -> StepUp ..

However, we noticed the actual processes are:

.. StepUp -> Toggle -> Toggle -> StepUp -> StepUp -> StepUp -> Toggle ..

It triggers Toggle event two times between StepUp events.

We check the upower_kbd_toggle function called in handle_method_call_keyboard when the event is Toggle, and find out it checks only the state of old brightness without current brightness. That misses some other states changing.

So, here is the list of the Toggle Method's state machines:

  1. brightness_now: 0, brightness_old: 1 ~ max level of brightness -> toggle to old brightness
  2. brightness_now: 0, brightness_old: -1 or 0 -> toggle to max brightness
  3. brightness_now: 1 ~ max level of brightness, brightness_old: all -> toggle to 0 brightness

This commit fixes and implements the state machines. Closes #41 (closed)

Signed-off-by: Jian-Hong Pan jian-hong@endlessm.com

Edited May 05, 2018 by Jian-Hong Pan
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: I41