Control Leds from the web administrative interface:

Here you will add a Led Control on the top of the web administrative interface.


Log as root user with password welc0me using ssh. I prefer using Filezilla using SFTP over SSH.
Make the same modification to the following 2 files using a simple text editor.
First file belongs to the Basic Mode web and the second one to the Advanced Mode web. So if you want this control appears only in Advanced mode web, ignore first file.

Files to edit:


Search for this text:
<div id="HeaderNav">

And add these lines below

        case 'on':
            exec('echo 255>/sys/class/leds/oxnas-wd810-leds:sw/brightness');
        case 'off':
            exec('echo 192>/sys/class/leds/oxnas-wd810-leds:sw/brightness');
    $status = file_get_contents('/sys/class/leds/oxnas-wd810-leds:sw/brightness');
    $state = '<span style="font-weight:bold; color:lightgreen">';
    if ( (intval($status) == 255)||(intval($status)==0)){
            $state .= 'ON</span> <a href="'.$_SERVER['PHP_SELF'].'?ledcontrol=off'.$yLUS.'">OFF</a>';
            $state .= 'OFF</span> <a href="'.$_SERVER['PHP_SELF'].'?ledcontrol=on'.$yLUS.'">ON</a>';
Leds: <?=$state;?>
<img src="/img/headernav_separator.gif" />

When it is ON, click OFF to turn leds off
When it is OFF, click ON to turn leds on

Play with Leds

Meaning of shortcuts in led path:
Shortcut Meaning
ac activity
ca capacity
st state
sw switch

To turn off:
echo 192 > /sys/class/leds/oxnas-wd810-leds\:sw/brightness

To turn on:
echo 255 > /sys/class/leds/oxnas-wd810-leds\:sw/brightness

Quiet mode (when idle, all leds are off):
echo 252 > /sys/class/leds/oxnas-wd810-leds\:sw/brightness

To set capacity gauge to n%:
echo n > /sys/class/leds/oxnas-wd810-leds\:ca/brightness

To do strange things (n value described in a table below):
echo n > /sys/class/leds/oxnas-wd810-leds\:st/brightness

n state / animation
0 to 2 default animation
3 full light bar, slowly fading on and off (good for disk spun-down indicator)
4 bottom 3 LEDs on, then top LED lights on and bottom LED lights off, and the two alternate
5 top and bottom LED's flash alternate on and off
6 entire light bar flashes on and off every ~1 second
7 center two LED lights alone turn on, then surrounding LEDs at top and bottom fade in, then all off
8 entire light bar lit
9 ?
10 to 14 turn off then slowly on led number n-8
15 turn off all leds

Programming Leds

To use cron to turn the lights off overnight, add the following lines to /opt/etc/crontab

30 21 * * * root echo 192>/sys/class/leds/oxnas-wd810-leds\:sw/brightness
30 6 * * * root echo 255>/sys/class/leds/oxnas-wd810-leds\:sw/brightness

Then restart cron:
~ # /opt/etc/init.d/S10cron stop
~ # /opt/etc/init.d/S10cron start

Alternatively, you could rework the Blue Light MBWE gmail-notifier script.
Make sure you keep the time synced as well.

Kernel Module

There is an option available to invert the logic of the LEDs. You can see it in output of modinfo:

~# modinfo oxnas-wd810-leds
filename:       /lib/modules/
license:        GPL
author:         Oxford Semiconductor Ltd
description:    oxnas wd810 1NC/2NC LEDs
vermagic: mod_unload ARMv5 
parm:           negative_led_logic:bool

So the module accepts negative_led_logic parameter.
To see the effect you'll need to do:
~ # modprobe -r oxnas-wd810-leds
~ # modprobe oxnas-wd810-leds negative_led_logic=1

To revert to default behavior do:
~ # modprobe -r oxnas-wd810-leds
~ # modprobe oxnas-wd810-leds negative_led_logic=0

Or simply reboot
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License