ASUS laptop lighted keyboard start on linux and woofer setup

First, to get the sub-woofer to work use the following, but it is a very poor solution so I didn’t implement it in the final laptop setup:

http://ubuntuforums.org/showthread.php?t=2217683

I want the lighted keyboard on an ASUS laptop to start at level 1 everytime it boots or resumes/thaws from sleep/hibernate. This worked

I created a conf file in /etc/init

Open directory as administrator

/etc/init

Create file

a.keylights_restart.conf

Inside that document paste:

description "start keyboard lights"
author "john statler"

start on [2345]

respawn

scrip

su – tech -c “/sys/class/leds/asus::kbd_backlight/brightness”

end script

Save and reboot. <su  – tech> tells the system to run the command as a super user.

=== more complex but also works ===

add the command into /etc/rc.local

or, for an individual user, into   *home*folder/.bash_profile (I didn’t have one of these so I skipped it)

or in cron

bash -cecho 1 > /sys/class/leds/asus::kbd_backlight/brightness

BUT — that wasn’t all, in order to get this to run as per user (the previous command didn’t pass after user log-in)

This will set the …backlight/brightness file so it can be written to without super user privileges.

sudo visudo

at the end of the file type:

ALL ALL = (ALL) NOPASSWD: /usr/bin/tee /sys/class/leds/asus\:\:kbd_backlight/brightness

reboot to have it take effect

now, to test the script you can run the following from a command line. You can change the 1 to a 3 for instance.

echo 1 | sudo /usr/bin/tee /sys/class/leds/asus::kbd_backlight/brightness

I had to actually create a script file and run that from Menu/Startup Applications
Create file /home/your_user_name/
Create a new text file

#!/bin/bash
#
# set keyboard lights to level 1
#
echo 1 > /sys/class/leds/asus::kbd_backlight/brightness

save as keyboard_lights.sh
Right-click on new file, select properties/permissions and allow execution

Now put the following line into Menu/Startup Applications under some name like key_lights

bash -c "exec /home/your_user_name/keyboard_lights.sh"

==== the following failed to work but here’s the notes====

That works except for resuming from hibernation or sleep.  To get that create 11_keyboard_lights_pm and put in in /etc/pm/sleep.d (the 11 makes sure it runs among the last of the scripts)

#!/bin/bash

case "$1" in
thaw|resume)
echo 3 | sudo /usr/bin/tee "/sys/class/leds/asus::kbd_backlight/brightness"
esac

====   ====

if you want to see the command show in a terminal (I might have gotten something wrong) (I honeslty don’t know why this is here)

mate-terminal bash -c "echo 1 | sudo /usr/bin/tee '/sys/class/leds/asus::kbd_backlight/brightness'; bash"