ZyXEL NSA325 - LEDs and Buttons

This forum is for Marvell Kirkwood devices such as the GoFlex Home/Net, PogoPlug v1/v2, SheevaPlug, and ZyXEL devices.

ZyXEL NSA325 - LEDs and Buttons

Postby AvanOsch » Fri Nov 29, 2013 3:48 am

After installing Arch only the orange system-led is lit.
Both buttons have no use. Dead.
Also, both HDD leds are triggered at the same time.
USB Led doesn't work either.

I tried tweaking a bit using systemd.
Didn't get very far:
I got all the leds to blink when booting, and go off when booted.
[EDIT] I added a small animation when booting is done. Pretty cool. [/EDIT]
The green system-led is green after booting, and flashes orange when cpu is used.
I use /etc/tmpfile.d/leds.conf to start the blinking on boot.
That was the earliest time during boot I could find to do this...
$this->bbcode_second_pass_code('', 'w /sys/class/leds/nsa325\:orange\:sys/trigger - - - - heartbeat
w /sys/class/leds/nsa325\:red\:hdd1/trigger - - - - heartbeat
w /sys/class/leds/nsa325\:red\:hdd2/trigger - - - - heartbeat
w /sys/class/leds/nsa325\:green\:usb/trigger - - - - heartbeat
w /sys/class/leds/nsa325\:green\:copy/trigger - - - - heartbeat
')

Then I use /usr/lib/systemd/system/leds.service to stop the blinking when booted.
[EDIT] This script runs when booting is totally completed. [/EDIT]
This also re-starts the blinking when I reboot/shutdown (in a much cooler way)
$this->bbcode_second_pass_code('', '[Unit]
Description=Set LEDs
After=multi-user.target

[Service]
Type=oneshot
RemainAfterExit=true

ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:copy/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:usb/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:red\:hdd2/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:red\:hdd1/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:orange\:sys/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo default-on > /sys/class/leds/nsa325\:green\:sys/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo default-on > /sys/class/leds/nsa325\:green\:hdd1/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo default-on > /sys/class/leds/nsa325\:green\:hdd2/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo default-on > /sys/class/leds/nsa325\:green\:usb/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo default-on > /sys/class/leds/nsa325\:green\:copy/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:sys/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:hdd1/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:hdd2/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:usb/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:copy/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo default-on > /sys/class/leds/nsa325\:green\:copy/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo default-on > /sys/class/leds/nsa325\:green\:usb/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo default-on > /sys/class/leds/nsa325\:green\:hdd2/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo default-on > /sys/class/leds/nsa325\:green\:hdd1/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo default-on > /sys/class/leds/nsa325\:green\:sys/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:copy/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:usb/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:hdd2/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:hdd1/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo ide-disk > /sys/class/leds/nsa325\:green\:hdd1/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo ide-disk > /sys/class/leds/nsa325\:green\:hdd2/trigger'
ExecStartPre=/usr/bin/bash -c '/usr/bin/echo default-on > /sys/class/leds/nsa325\:green\:sys/trigger'
ExecStart=/usr/bin/bash -c '/usr/bin/echo cpu0 > /sys/class/leds/nsa325\:orange\:sys/trigger'
ExecStop=/usr/bin/bash -c '/usr/bin/echo none > /sys/class/leds/nsa325\:green\:sys/trigger'
ExecStopPost=/usr/bin/bash -c '/usr/bin/echo heartbeat > /sys/class/leds/nsa325\:orange\:sys/trigger'
ExecStopPost=/usr/bin/bash -c '/usr/bin/echo heartbeat > /sys/class/leds/nsa325\:red\:hdd1/trigger'
ExecStopPost=/usr/bin/bash -c '/usr/bin/echo heartbeat > /sys/class/leds/nsa325\:red\:hdd2/trigger'
ExecStopPost=/usr/bin/bash -c '/usr/bin/echo heartbeat > /sys/class/leds/nsa325\:green\:usb/trigger'
ExecStopPost=/usr/bin/bash -c '/usr/bin/echo heartbeat > /sys/class/leds/nsa325\:green\:copy/trigger'

[Install]
WantedBy=multi-user.target
')
This last file is a service that has to be enabled:
$this->bbcode_second_pass_code('', 'systemctl enable leds')

The files above are easily edited to your liking.
Check the folder /sys/class/leds for available leds:
$this->bbcode_second_pass_code('', 'ls /sys/class/leds')
Each led can be sent one of the following options:
none, nand-disk, timer, ide-disk, heartbeat, cpu0, default-on

For the leds.service, the ExecStartPre entries are run before running ExecStart. Then it stops.
When shutting down or rebooting, the ExecStop entry is run, then all the ExecStopPost entries.

If you're just looking to change the led's behaviour after booting, you're best off with just setting the led's options as you want them in the /etc/tmpfiles.d/leds.conf file. No need to run an extra service in such a case.
The service is mainly to stop the flashing (and while it's there, restart flashing on reboot/shutdown).
[EDIT] Also, the service shows when the system is completely done booting. The tmpfile kicks in earlier. [/EDIT]

I guess there should also be a way to get the Buttons and USB led working this way...?
AvanOsch
 
Posts: 12
Joined: Thu Sep 05, 2013 12:57 am

Re: ZyXEL NSA325 - LEDs and Buttons

Postby technosf » Sat Nov 30, 2013 11:50 pm

Have a look at this:
https://github.com/pkirchhofer/nsa325-kernel/wiki

I'm still organizing my NSA325, but ACPI looks like it will help organize the events driven actions.

It would be nice to dim those LEDs though!
[size=85] MochaBin 5G || NSA325 [/size]
technosf
 
Posts: 147
Joined: Sat Jan 08, 2011 10:54 pm


Return to Marvell Kirkwood

Who is online

Users browsing this forum: No registered users and 1 guest