f.prisson
May 22nd, 2005, 10:38 AM
This howto contains nothing really new,but I have tried to write a simple guide for not so much experienced users.
Some of the Asus laptops (or even all, I don't know) have different hotkeys and Status LEDs. This howto describes how to use them in Ubuntu.
Installation
You need the kernel module asus_acpi which is included in the default kernel. Check whether it's loaded with lsmod | grep asus If it isn't loaded do this with sudo modprobe asus_acpiand add the module in /etc/modules with sudo gedit /etc/modules so that it will be loaded automatically on next reboot.
You need the normal linux acpi daemon running. On the top of it you need the asus_acpi daemon which you have to compile yourself. Get the source at http://sourceforge.net/projects/acpi4asus/.
Copy the archive in a temporary directory of your choice and uncompress it withtar -xvjf acpi4asus-0.xx.tar.bz2 change the directory with
cd ./acpi4asus-0.xx/asus_acpid/ As you already have the kernel module you only need to compile the asus_acpi daemon. You need the kernel source, kernel headers, make and gcc for this. For compiling the daemon type make For installing it type sudo make install You now have to copy the directory "samples" to .asus_acpi in your home directory: cp -r ../samples /home/user/.asus_acpi Start the daemon as normal user with asus_acpid & The basic installation is finished now.
Configuration
Go to the just copied .asus_acpi directory in your users home directory. In the "events" directory you can define which skript or action should be taken on which event. There are some predefined events, for the four little buttons below of the display which start a browser, mutt and two other application. For changing this behaviour, edit the skripts in the .asus_acpi directory. The Vol up / down keys are also predefined, but you need aumix installed for this.sudo apt-get install aumix For getting the right event codes of all ofAutostart of the asus_acpid daemon the special keys, you have to stop the ACPI daemons first: killall asus_acpid and sudo /etc/init.d/./acpid stop Have a look at the "/proc/acpi/events" file with sudo cat /proc/acpi/events By pressing the special keys now, you can see the appropiate event codes. If you have finished leave with Ctrl + C Take a look at the examples, for the syntax of your new events. You also can activate the LEDs in the right corner by doing the following (replace 1 with 0 for deactivating): echo 1 > /proc/acpi/asus/mled or echo 1 > /proc/acpi/asus/wled
My configuration as an example
I use the four little buttons for starting applications, no special things here.
The powergear button (event code 5c) is used for activating or deactivating my wireless LAN interface. I use the following skript:# module already loaded?
mod=`/bin/lsmod | /bin/grep ipw2100; echo $?`
case "$mod" in
1) /sbin/modprobe ipw2100
;;
esac
# activate or deactivate
stat=`cat /proc/acpi/asus/wled`
case "$stat" in
0) sudo ifup eth1
echo 1 > /proc/acpi/asus/wled
;;
1) sudo ifdown eth1
echo 0 > /proc/acpi/asus/wled
;;
esacFor getting this work, I had to make ifup and ifdown executable for my normal user without requesting a password. I did it that way (better solutions are welcome).
Edit the /etc/sudoers file with export EDITOR=gedit && sudo visudo Add a line myuser ALL = NOPASSWD: /sbin/ifup eth1, /sbin/ifdown eth1
Test if you are able to activate / deactive the network as normal user without giving password:sudo ifup <WLAN interface> sudo ifdown <WLAN interface> I now deactived the auto activation of my wireless interface by commenting the line "auto eth1" in /etc/network/interfaces
If you create the correct event which calls the script above you can activate and deactive your WLAN interface by the powergear button now. The status is shown by the amber LED.
Getting audiokeys working with xmms
Create four files named xmms_play, xmms_stop, xmms_forward and xmms_back. Best way is to copy one of the sample event, in that case you only have to change the event code and skript name. The event codes are
stop 43
play 45
back 40
forward 41
Create four skripts in "/home/user/.asus_acpi/" corresponding to the names you used in the events. The commands for xmms are
stop xmms -s
play xmms -t
back xmms -r
forward xmms -f
Autostart of the asus_acpid daemon
I made a simple skript that only includes the line "asus_acpid &" and is called at gnome startup time (set it in System -> Settings -> Session). Don't forget to make the skript executable withchmod a+x <skriptfile>
I hope this howto was helpful for you. Any kind of questions or feedback is welcome.
Some of the Asus laptops (or even all, I don't know) have different hotkeys and Status LEDs. This howto describes how to use them in Ubuntu.
Installation
You need the kernel module asus_acpi which is included in the default kernel. Check whether it's loaded with lsmod | grep asus If it isn't loaded do this with sudo modprobe asus_acpiand add the module in /etc/modules with sudo gedit /etc/modules so that it will be loaded automatically on next reboot.
You need the normal linux acpi daemon running. On the top of it you need the asus_acpi daemon which you have to compile yourself. Get the source at http://sourceforge.net/projects/acpi4asus/.
Copy the archive in a temporary directory of your choice and uncompress it withtar -xvjf acpi4asus-0.xx.tar.bz2 change the directory with
cd ./acpi4asus-0.xx/asus_acpid/ As you already have the kernel module you only need to compile the asus_acpi daemon. You need the kernel source, kernel headers, make and gcc for this. For compiling the daemon type make For installing it type sudo make install You now have to copy the directory "samples" to .asus_acpi in your home directory: cp -r ../samples /home/user/.asus_acpi Start the daemon as normal user with asus_acpid & The basic installation is finished now.
Configuration
Go to the just copied .asus_acpi directory in your users home directory. In the "events" directory you can define which skript or action should be taken on which event. There are some predefined events, for the four little buttons below of the display which start a browser, mutt and two other application. For changing this behaviour, edit the skripts in the .asus_acpi directory. The Vol up / down keys are also predefined, but you need aumix installed for this.sudo apt-get install aumix For getting the right event codes of all ofAutostart of the asus_acpid daemon the special keys, you have to stop the ACPI daemons first: killall asus_acpid and sudo /etc/init.d/./acpid stop Have a look at the "/proc/acpi/events" file with sudo cat /proc/acpi/events By pressing the special keys now, you can see the appropiate event codes. If you have finished leave with Ctrl + C Take a look at the examples, for the syntax of your new events. You also can activate the LEDs in the right corner by doing the following (replace 1 with 0 for deactivating): echo 1 > /proc/acpi/asus/mled or echo 1 > /proc/acpi/asus/wled
My configuration as an example
I use the four little buttons for starting applications, no special things here.
The powergear button (event code 5c) is used for activating or deactivating my wireless LAN interface. I use the following skript:# module already loaded?
mod=`/bin/lsmod | /bin/grep ipw2100; echo $?`
case "$mod" in
1) /sbin/modprobe ipw2100
;;
esac
# activate or deactivate
stat=`cat /proc/acpi/asus/wled`
case "$stat" in
0) sudo ifup eth1
echo 1 > /proc/acpi/asus/wled
;;
1) sudo ifdown eth1
echo 0 > /proc/acpi/asus/wled
;;
esacFor getting this work, I had to make ifup and ifdown executable for my normal user without requesting a password. I did it that way (better solutions are welcome).
Edit the /etc/sudoers file with export EDITOR=gedit && sudo visudo Add a line myuser ALL = NOPASSWD: /sbin/ifup eth1, /sbin/ifdown eth1
Test if you are able to activate / deactive the network as normal user without giving password:sudo ifup <WLAN interface> sudo ifdown <WLAN interface> I now deactived the auto activation of my wireless interface by commenting the line "auto eth1" in /etc/network/interfaces
If you create the correct event which calls the script above you can activate and deactive your WLAN interface by the powergear button now. The status is shown by the amber LED.
Getting audiokeys working with xmms
Create four files named xmms_play, xmms_stop, xmms_forward and xmms_back. Best way is to copy one of the sample event, in that case you only have to change the event code and skript name. The event codes are
stop 43
play 45
back 40
forward 41
Create four skripts in "/home/user/.asus_acpi/" corresponding to the names you used in the events. The commands for xmms are
stop xmms -s
play xmms -t
back xmms -r
forward xmms -f
Autostart of the asus_acpid daemon
I made a simple skript that only includes the line "asus_acpid &" and is called at gnome startup time (set it in System -> Settings -> Session). Don't forget to make the skript executable withchmod a+x <skriptfile>
I hope this howto was helpful for you. Any kind of questions or feedback is welcome.