Soekris 6501 control status LED, error LED on FreeBSD from bash script

Controlling Soekris 6501 LEDs is a little bit tricky.
We need to write 0 or 1 to specific I/O addresses.

There is no standard program or command to do this task. Happily, I’ve goggled a suitable piece of code from Bjorn Karlsson — program named gpdevio (mirror).

First you need to compile source code. After this you can read and write from I/O ports (with root privileges).

For example to set Ready LED to on state:
# gpdevio -p 0x069D -w -v 0x1

Or shut off error LED:
# gpdevio -p 0x069C -w -v 0x0

I use this program to flash LEDs according to state of my NTP server on FreeBSD 9.1 i386. If ntpd is down Error LED is on, otherwise green Status LED is on. But if ntpd is up and stratum is not 1 I turn on both LEDs. I run this bash script with crontab every minute:

You can use this technique to control GPIO pins of Soekris 6501 as well.

Via http://www.mail-archive.com/soekris-tech@lists.soekris.com/msg06738.html

Запись опубликована в рубрике NTP, администрирование с метками , , , , . Добавьте в закладки постоянную ссылку.