One fascinating aspect of this storage device is the front LED panel. This can be used to visualize the status of the MyBook, or even to merely play around :)
For the "blue ring" version of the MyBook there exist a detailed tutorial on the related wiki, yet for the newer "white light" version I haven't found anything, but after some testing I managed to have a consistent picture of what is going on. Let's see:
The modul in charge for operating the LEDs is the following:
~#: lsmod | grep led
oxnas_wd810_leds 7496 0
This modul is located in
/lib/modules/2.6.24.4/kernel/arch/arm/mach-oxnas/oxnas-wd810-leds.ko.
If the modul is loaded (it should be on startup), we get the interface in /sys/class/leds:
/sys/class/leds#: ls -1
oxnas-wd810-leds:ac/
oxnas-wd810-leds:ca/oxnas-wd810-leds:st/
oxnas-wd810-leds:sw/
Here we find for directories with rather identical content:
/sys/class/leds/oxnas-wd810-leds:ac#: ls -1
brightnessdevice@
subsystem@
trigger
uevent
In detail:
brightness contains a single numeric value between 0 and 255
device@ symlink to /sys/devices/platform/oxnas-wd810-leds directory
subsystem@ symlink to /sys/class/leds
trigger: by default one single line: none [sata-disk]
uevent: contains:
PHYSDEVPATH=/devices/platform/oxnas-wd810-leds
PHYSDEVBUS=platform
PHYSDEVDRIVER=oxnas-wd810-leds
Out of these brightness will be of the most importance. Using the numeric value here we can control the illumination of the LEDs. The rest, well those need some more research, I think however that it is a good idea to leave uevent alone, and trigger might be responsable of the automated operation in response to some event. It is quite confusing still that it has the same content in all four directiories...
The brightness files can simply be altered by for example:
/sys/class/leds/oxnas-wd810-leds:ac#: echo 1 > brightness
which means that we put "1" in the file. So let's see the role of each directory:
- oxnas-wd810-leds:ac/: "ac" might stand for activity. Putting any numeric value here will cause the LED stripe sweeping up and down once and returning to the previous state. It is interesting that the actual value does not matter (even can be the same always), yet a simple "touch brightness" is not enough.
- oxnas-wd810-leds:ca/: Here we have a fuel gauge operation of the stripe. The numeric value expresses percentage, so that values between 0 and 100 make sense here.
- oxnas-wd810-leds:st/: This directory is for several visual effects (including blinking, wobbling, sweeping back and forth...) which can be altered by putting a number between 0 and 15 in the brightness file. Larger values have no effect, while 0 and 1 stand for the steady pattern determined by the fuel gauge.
- oxnas-wd810-leds:sw/ I did not manage to alter the LED pattern by any numeric value. This can be either not implemented feature or has some different mode of operation.
Using these one can easily visualize the disk usage, temperature, or even the load average of the MyBook :) The moving patterns are also capable of some sort of alarm operation (based on e. g. SMART report of smartmontools).
I noticed that sometimes all of the LEDs turned off and didn't respond anymore. In this case a reboot is necessary since reloading the module itself not seemed to be enough.
There is even more: I also found signs of controlling the rest of the LEDs on the storage (including power, USB). This is what I found in /sbin/fschk_prompt.sh:
#Turn on PWR LED
/bin/echo 0 >/proc/wixgpio/gpio06
#Turn off PWR LED
/bin/echo 1 >/proc/wixgpio/gpio06
#Turn on USB LED
/bin/echo 1 >/proc/wixgpio/gpio10
#Turn off USB LED
/bin/echo 0 >/proc/wixgpio/gpio10
#Turn off ID LED
/bin/echo 0 >/proc/wixgpio/gpio00
The interesting thing is that there is neither such directory in /proc nor any GPIO-related module anywhere. So this can be some sort of residual of code from the "blue ring" device or something like that...
Hi, great job, this is one of the best posts I've seen around about the MBWE leds! Have you by any chance discovered any way of customizing the predefined light patterns? Particularly, I would like to be able to lower the blinking frequency for the standby pattern (oxnas-wd810-leds:st/brightness=7 if I recall well). Any way of playing around wth the module at all? Or would this be just a dream? Thanks.
ReplyDeleteHi,
ReplyDeleteI believe that the patterns including blinking frequency are hardcoded in the driver. So I think to change anything you need to alter and rebuild the oxnas-wd810-leds module. This might not be impossible (though I don't know where to find the source code of it), but it is definitely not straightforward either.
Hi, yeap that's my understanding as well... I'll keep an eye on the forums, maybe some info leaks somewhere ;) Thanks for your reply.
ReplyDelete