HOWTO: Manipulating front leds on Alix2

HOWTO: Manipulating front leds on Alix2
 Thu, 1970-01-01 00:00
Zhiva
Posts: 2
Joined: 2007-11-27

I think many have wondered how to do this, and after some poking around I finally found a way to do it.

With the newest imedialinux-releases (at least those containing kernel 2.6.18 and above) the GPIO-module is compiled as default, so it's pretty straight forward to do.

First of all, you need to set up the correct /dev-entries. The manual for Alix2 provides us with the info we need, so we know the leds have the pin-assignments 6 (Led1, the on to the left which is on when booted), 25 (Led2, middle led) and 27 (Led3, right). The correct commands will then be:

zhiva@imedia:~$ mknod /dev/led1 c 253 6
zhiva@imedia:~$ mknod /dev/led2 c 253 25
zhiva@imedia:~$ mknod /dev/led3 c 253 27

Now let's see what they say:

zhiva@imedia:~$ cat /dev/led1
1iOTPd
zhiva@imedia:~$ cat /dev/led2
0iOTPd
zhiva@imedia:~$ cat /dev/led3
0iOTPd

What this tells us is the value of the 32bit address on each led. All we need is the first character, the 1 and 0. 1 is led on, 2 is led off. To turn off a led we do the following:

zhiva@imedia:~$ echo 0iOTPd > /dev/led1

And to turn it on:

zhiva@imedia:~$ echo 1iOTPd > /dev/led1

For those interested, to play with the reset-button, do a:

zhiva@imedia:~$ mknod /dev/reset c 253 24

The button has 1iOTPd if it is clear, and 0iOTPd if it is pushed. By making a trigger-app to monitor this /dev, you can easily make a reboot-script.



 Tue, 2007-12-04 13:45 Post removed by me
Zhiva
Posts: 2
Joined: 2007-11-27
Post removed by me