Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore from ram / hibernation does not restore keyboard light #9

Open
pointhi opened this Issue Dec 29, 2018 · 7 comments

Comments

Projects
None yet
4 participants
@pointhi
Copy link
Contributor

pointhi commented Dec 29, 2018

When I leaf the Laptop for a longer time alone and it goes into suspend to ram or hibernation, the keyboard backlight changes to blue and does not restore when using the laptop again

@djallet

This comment has been minimized.

Copy link

djallet commented Jan 23, 2019

I have the same issue, with a clevo N151ZU. Everything else run fine, this is a pleasure to be able to change keyboard backlit on linux :-)

@tuxedochris

This comment has been minimized.

Copy link
Member

tuxedochris commented Feb 7, 2019

Hi,

Sorry, this is not possible. The problem is, the driver can not save the Informations.
A workaround would, you write a script, that save the colors in intervals and set this after wake up.

Cheers
Chris

@tuxedochris tuxedochris closed this Feb 7, 2019

@Darael

This comment has been minimized.

Copy link

Darael commented Feb 12, 2019

A workaround, albeit an untested one, if you use systemd: place the following script in your systemd suspend hooks directory (for me, /lib/systemd/system-sleep/, though I've seen it be in /usr/lib/systemd/system-sleep/), and make it executable:

#!/bin/sh
case $1 in
  (pre|suspend|hibernate)
    for file in color_center color_left color_right color_extra mode brightness state;
    do
      filepath="/sys/devices/platform/tuxedo_keyboard/$file"
      if [ -e $filepath ]
      then
        case $file in
          (color_*)
            prefix="0x"
            ;;
          (*)
            prefix=""
            ;;
        esac
        echo "$file ${prefix}$(cat $filepath)" >> /tmp/tuxedo_keyboard_conf
      fi
    done
    ;;
  (post|resume|thaw)
    if [ -e /tmp/tuxedo_keyboard_conf ];
    then
      awk '{ print $2 >("/sys/devices/platform/tuxedo_keyboard/" $1) }' /tmp/tuxedo_keyboard_conf
      rm /tmp/tuxedo_keyboard_conf
    fi
    ;;
esac

This should save the keyboard settings to /tmp/tuxedo_keyboard_conf when your computer sleeps, and restore them when it wakes. It will not, as written, make them persist across shutdown/reboot, but it will work for all sleep states including hibernate, hybrid sleep, and so on.

Edit: If you don't use systemd but do use pm-utils, this should still work if placed in /etc/pm/sleep.d instead.

@djallet

This comment has been minimized.

Copy link

djallet commented Feb 15, 2019

It works like a charm on eOS, great job Darael ! Thanks you so much.

@Darael

This comment has been minimized.

Copy link

Darael commented Feb 15, 2019

Updated slightly to be usable with pm-utils as well as systemd-suspend

@Darael

This comment has been minimized.

Copy link

Darael commented Feb 18, 2019

@tuxedochris is there any reason the driver can't use driver power-management hooks (->prepare() and ->complete() might be good candidates) or, failing that, register PM suspend notifiers?

@tuxedochris

This comment has been minimized.

Copy link
Member

tuxedochris commented Feb 18, 2019

Hi Darael,

no, there are no reasons why we did not use it. I create a task internally, for testing the power management in the driver. I believe that by the end of March we will have a result for the test.

Cheers
Chris

@tuxedochris tuxedochris reopened this Feb 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.