NSLU2-Linux
view · edit · print · history

Info.SetLedOptions History

Hide minor edits - Show changes to markup

August 02, 2008, at 11:42 PM by Marcelo Vianna -- Added linebreaks so the syscalls get right
Changed line 22 from:
  1. define __NR_gpio_high 0x00900101
to:
  1. define __NR_gpio_high 0x00900101\\
Changed line 25 from:
  1. define __NR_gpio_low 0x00900102
to:
  1. define __NR_gpio_low 0x00900102\\
Changed line 28 from:
  1. define __NR_beep 0x00900103
to:
  1. define __NR_beep 0x00900103\\
March 18, 2008, at 12:59 AM by abliss -- more copyediting.
Changed lines 1-2 from:

(Note that this applies to Set_Led, a binary available in Unslung. The analogous command to set or toggle LED states in SlugOS/BE is /bin/leds .)

to:

(Note that this applies to Set_Led, a binary available in Unslung. The analogous command to set or toggle LED states in SlugOS is /sbin/leds .)

March 18, 2008, at 12:56 AM by abliss -- copyediting. don\'t blame me, \"Preview\" is broken
Changed lines 1-2 from:

(Note that this applies to Set_Led, a binary available in Unslung. The analagous command to set or toggle LED states in SlugOS is /bin/leds .)

to:

(Note that this applies to Set_Led, a binary available in Unslung. The analogous command to set or toggle LED states in SlugOS/BE is /bin/leds .)

March 18, 2008, at 12:53 AM by abliss -- add reference to other distros
Added lines 1-2:

(Note that this applies to Set_Led, a binary available in Unslung. The analagous command to set or toggle LED states in SlugOS is /bin/leds .)

February 25, 2006, at 08:45 AM by Sebastian Kraatz -- Shutdown warning crontab
Changed lines 45-57 from:
 -- gerti
to:
 -- gerti

Because I don't want my HDD to run 24/7, I automatically shut down at night (and restart in the morning using the Always-On-wiring). To be warned before shutdown occurs (save data, cancel shutdown, ...), I added the following lines to my /etc/crontab:

 30 22 * * * root Set_Led s_blinking &>/dev/null
 00 23 * * * root Set_Led rs_blinking &>/dev/null
 00 23 * * * root Set_Led beep1 &>/dev/null
 29 23 * * * root Set_Led beep3 &>/dev/null
 30 23 * * * root /usr/sbin/DO_Shutdown &>/dev/null

This way, the Ready-LED starts to blink Green/Orange one hour before shutdown. Half an hour before shutdown, the LED starts to blink Green/Red and a beep is triggered. Finally, one minute before shutdown, a triple beep will demand attention. Feel free to use this as a starting point for your own warning mechanism.

October 13, 2005, at 02:04 PM by ShaunLeeClarke -- typo on Set_Led s_blinking fixed (green element changed to red element)
Changed line 13 from:
  • Set_Led s_blinking - Blinks the green element of the ready/status LED. (Green is not affected).
to:
  • Set_Led s_blinking - Blinks the red element of the ready/status LED. (Green is not affected).
January 21, 2005, at 06:40 PM by gerti --
Changed lines 29-45 from:

The bit arguments referred to above correspond to the information on GPIOConnections. It is not a bitmask, it is the number of the bit to affect.

to:

The bit arguments referred to above correspond to the information on GPIOConnections. It is not a bitmask, it is the number of the bit to affect.


Some additional comments:

There is a bit of 'magic' going on with some of the commands: The "blinking" commands as well as the "beep2" and "beep3" commands do not return. So to use them in a script and avoid blocking, follow them with an ampersand as in

Set_Led rs_blinking &

A subsequent call of "Set_Led ready" will turn the status LED to green and terminate the blinking or beep processes.

Also when the "r_blinking" command is terminated manually while the LED is off, it will stay off. I do not know of a way to achieve this programmatically though.

Lastly the "power_off" command is intended to be used at the end of the shutdown scripts. A proper shutdown that will also call the shutdown scripts can be triggered with the "halt" command.

 -- gerti
October 10, 2004, at 11:49 AM by kaste --
Changed line 6 from:
  • Set_Led beep - one short beep. Returns when done.
to:
  • Set_Led beep1 - one short beep. Returns when done.
September 22, 2004, at 05:24 PM by glum --
Added lines 16-29:

Set_Led does its magic by accessing a few syscalls. I do not know whether this will work with the OpenSlug kernel. The syscalls are as follows.
#define __NR_gpio_high 0x00900101 _syscall1(void, gpio_high, int, bit);
#define __NR_gpio_low 0x00900102 _syscall1(void, gpio_low, int, bit);
#define __NR_beep 0x00900103 _syscall0(void, beep);

The bit arguments referred to above correspond to the information on GPIOConnections. It is not a bitmask, it is the number of the bit to affect.

September 22, 2004, at 05:11 PM by glum --
Added line 3:
  • Set_Led usb1_blinking - Blinks the Disk 1 indicator until /proc/hd_conn cannot be accessed.
Added line 5:
  • Set_Led usb2_blinking - Blinks the Disk 2 indicator until /proc/usb_conn cannot be accessed.
Changed lines 7-8 from:
  • Set_Led beep2 - two short beeps, then waits for a second. Loops until killed.
  • Set_Led beep3 - Same as beep2, except three beeps. Loops until killed.
to:
  • Set_Led beep2 - two short beeps, then waits for 4 seconds. Loops for about a minute or until killed.
  • Set_Led beep3 - Same as beep2, except three beeps. Loops for about a minute or until killed.
September 22, 2004, at 05:24 AM by rwhitby --
Changed lines 5-6 from:
  • Set_Led beep2 - two short beeps, then waits for a second. Loops until

killed.

to:
  • Set_Led beep2 - two short beeps, then waits for a second. Loops until killed.
Changed lines 7-18 from:
  • Set_Led ready - Turns on the green and off the red elements of the

ready/status bi-color LED.

  • Set_Led s_error - Turns on the red element only of the ready/status

LED. (Green is not affected).

  • Set_Led s_ok - Turns off the red element only of the ready/status LED.

(Green is not affected).

  • Set_Led r_blinking - Blinks the green element of the ready/status LED.

(Red is not affected).

  • Set_Led s_blinking - Blinks the green element of the ready/status LED.

(Green is not affected).

  • Set_Led rs_blinking - Alternates between red and green on the

ready/status LED.

to:
  • Set_Led ready - Turns on the green and off the red elements of the ready/status bi-color LED.
  • Set_Led s_error - Turns on the red element only of the ready/status LED. (Green is not affected).
  • Set_Led s_ok - Turns off the red element only of the ready/status LED. (Green is not affected).
  • Set_Led r_blinking - Blinks the green element of the ready/status LED. (Red is not affected).
  • Set_Led s_blinking - Blinks the green element of the ready/status LED. (Green is not affected).
  • Set_Led rs_blinking - Alternates between red and green on the ready/status LED.
September 22, 2004, at 05:24 AM by rwhitby --
Changed lines 1-20 from:

Describe SetLedOptions here.

to:
  • Set_Led - prints available commands.
  • Set_Led turn_on/off1 - controls the Disk 1 indicator.
  • Set_Led turn_on/off2 - controls the Disk 2 indicator.
  • Set_Led beep - one short beep. Returns when done.
  • Set_Led beep2 - two short beeps, then waits for a second. Loops until

killed.

  • Set_Led beep3 - Same as beep2, except three beeps. Loops until killed.
  • Set_Led ready - Turns on the green and off the red elements of the

ready/status bi-color LED.

  • Set_Led s_error - Turns on the red element only of the ready/status

LED. (Green is not affected).

  • Set_Led s_ok - Turns off the red element only of the ready/status LED.

(Green is not affected).

  • Set_Led r_blinking - Blinks the green element of the ready/status LED.

(Red is not affected).

  • Set_Led s_blinking - Blinks the green element of the ready/status LED.

(Green is not affected).

  • Set_Led rs_blinking - Alternates between red and green on the

ready/status LED.

  • Set_Led power_off - unconditionally turns power off.
view · edit · print · history · Last edited by Marcelo Vianna.
Based on work by abliss, Sebastian Kraatz, ShaunLeeClarke, gerti, kaste, glum, and rwhitby.
Originally by rwhitby.
Page last modified on August 02, 2008, at 11:42 PM