mpalourdio / xps13

:neckbeard: DELL xps13 2015 (9343) Linux Support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keyboard back-light on at boot and resume

rosolko opened this issue · comments

Related to this post and solution

Workaround:
1: Save script to

/usr/local/bin/xps13-kbd-backlight

Make it as executable

sudo chmod +x <script>

2: Problem part
3: Link to /etc/pm/sleep.d

ln -s  /usr/bin/xps13-kbd-backlight /etc/pm/sleep.d/20_xps13-kbd-backlight

A problem:
Partially this solution is working - if talking about back-light on resume, but on boot - I have no luck.

The problem is in this part of the solution:

using preferences set in ${BL_CONF}
[/etc/xps13-kbd-backlight]

How can I set this value?

As commented in my script,
https://askubuntu.com/questions/689907/dell-xps-13-9343-keyboard-backlight-on-at-boot-ubuntu-15-10/711291#711291

You have to edit files with its path in between [],
removing prefix #~ at begining of lines

resulting content of file [/etc/xps13-kbd-backlight]
(edited with command sudo nano /etc/xps13-kbd-backlight)

## 0 : off
## 1 : min
## 2 : max
default=0
current=1

resulting content of file [/etc/xdg/autostart/xps13-kbd-backlight.desktop]
(edited with command sudo nano /etc/xdg/autostart/xps13-kbd-backlight.desktop)

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=xps13-kbd-backlight
X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Phase=Initialization
Icon=keyboard
Name=xps13-kbd-backlight
Comment=set/restore xps13-kbd-backlight
Categories=Utility;
BL_CONF=/etc/xps13-kbd-backlight

can be set to another path at your convenience:

BL_CONF=/path/at/your/convenience

Well, create all of the files.
But, where should I set BL_CONF value?
What command should I use to set them?
Or what file should be changed to set value?

commented

i want a script for each present:
backlight 100% on AC
backlight x% on BAT
(change it on the fly)

Maybe it's possible for TLP to add custom events.

commented

/etc/pm/power.d/run_after_pwrmanagmt.sh

case "${1}" in
true) #battery_mode
xinput set-int-prop 12 277 8 2 3 0 0 1 3 2
echo 1 > /sys/class/backlight/intel_backlight/brightness
;;
false) #ac_mode
xinput set-int-prop 12 277 8 2 3 0 0 1 3 2
echo 937 > /sys/class/backlight/intel_backlight/brightness
esac

i do that

Good work!

But, what about this question related to comment

commented

BL_CONF is set in the script in the first line behind the comments with # infront
https://askubuntu.com/questions/689907/dell-xps-13-9343-keyboard-backlight-on-at-boot-ubuntu-15-10/711291#711291

Ok I see.
But why I have no luck with restoring keyboard back-light on the OS start?

commented

create a script that perform "echo 2 > /sys/class/leds/dell::kbd_backlight/brightness" at your os start as root, just simple, i'm happy with off as default and press fn+f10 if i need light on the keys

Can I just place this script into /etc/init.d to work?

commented

use /etc/rc.local

The content of the /etc/rc.local now is:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo 2 > /sys/class/leds/dell::kbd_backlight/brightness
rfkill block bluetooth
exit 0

And the back-light is turn on by start :C

commented

and you want to disable it on start? then change the value from 2 to 0 - 1 is for the 50% lightlevel

Just looking onto behavior of the content of the /sys/class/leds/dell::kbd_backlight/brightness in accordance with light options - seems like for turning off light respond 0 value.

Have no luck again even after changing value to 0.
PC start with maximum back-light brightness level.

commented

but the command worked as root in terminal?
"echo 0 > /sys/class/leds/dell::kbd_backlight/brightness"
worked for me without problem

overlord@moon:~$ sudo echo 0 > /sys/class/leds/dell::kbd_backlight/brightness
bash: /sys/class/leds/dell::kbd_backlight/brightness: Permission denied

Little confused :|

commented

sudo su
password
echo 0 > /sys/class/leds/dell::kbd_backlight/brightness

sudo su
password
echo 0 > /sys/class/leds/dell::kbd_backlight/brightness

In this case it's work.

commented

so test the lines like:

echo 0 > /sys/class/leds/dell::kbd_backlight/brightness &
rfkill block bluetooth &
exit 0

in rc.local

echo 0 > /sys/class/leds/dell::kbd_backlight/brightness &
rfkill block bluetooth &
exit 0

Doesn't work.

One more question:
Relate to original script - we create and save as executable script to /usr/local/bin/xps13-kbd-backlight but later we create link to /usr/bin/xps13-kbd-backlight with /etc/pm/sleep.d/20_xps13-kbd-backlight is it correct?

@rosolko so did you solve?

@brunano21 Yes. After fresh system install this solution completely solve my problem. Complete solution and script available on askubuntu.

@rosolko do you refers to this?

Can you pastebin your script?

Because I have done like in the AskUbuntu thread, but still getting on when booting and resuming. :/

Also,

    br1@br1-xps13-9343:~$ ll /etc/pm/sleep.d/
    total 20
    ...
    lrwxrwxrwx 1 root root   34 May  2 10:39 20_xps13-kbd-backlight -> /usr/local/bin/xps13-kbd-backlight*
    ...

Is it a matter of permission maybe?