LEDs on NSA325v2 January 27, 2021 05:52AM |
Registered: 5 years ago Posts: 16 |
Re: LEDs on NSA325v2 January 27, 2021 06:11PM |
Admin Registered: 13 years ago Posts: 18,997 |
if [ -d /sys/class/leds/nsa325:green:sys ]; then echo default-on > /sys/class/leds/nsa325:green:sys/trigger echo none > /sys/class/leds/nsa325:orange:sys/trigger fi if [ -d /sys/class/leds/nsa325:green:sata1 ]; then echo ide-disk1 > /sys/class/leds/nsa325:green:sata1/trigger fi if [ -d /sys/class/leds/nsa325:green:sata2 ]; then echo ide-disk2 > /sys/class/leds/nsa325:green:sata2/trigger fi
Quote
ls -l /sys/class/leds/
total 0
drwxr-xr-x 2 root root 0 Jan 27 15:58 .
drwxr-xr-x 49 root root 0 Jan 27 15:56 ..
lrwxrwxrwx 1 root root 0 Jan 27 15:58 nsa325:green:copy -> ../../devices/platform/gpio-leds/leds/nsa325:green:copy
lrwxrwxrwx 1 root root 0 Jan 27 15:58 nsa325:green:sata1 -> ../../devices/platform/gpio-leds/leds/nsa325:green:sata1
lrwxrwxrwx 1 root root 0 Jan 27 15:58 nsa325:green:sata2 -> ../../devices/platform/gpio-leds/leds/nsa325:green:sata2
lrwxrwxrwx 1 root root 0 Jan 27 15:58 nsa325:green:sys -> ../../devices/platform/gpio-leds/leds/nsa325:green:sys
lrwxrwxrwx 1 root root 0 Jan 27 15:58 nsa325:green:usb -> ../../devices/platform/gpio-leds/leds/nsa325:green:usb
lrwxrwxrwx 1 root root 0 Jan 27 15:58 nsa325:orange:sys -> ../../devices/platform/gpio-leds/leds/nsa325:orange:sys
lrwxrwxrwx 1 root root 0 Jan 27 15:58 nsa325:red:copy -> ../../devices/platform/gpio-leds/leds/nsa325:red:copy
lrwxrwxrwx 1 root root 0 Jan 27 15:58 nsa325:red:sata1 -> ../../devices/platform/gpio-leds/leds/nsa325:red:sata1
lrwxrwxrwx 1 root root 0 Jan 27 15:58 nsa325:red:sata2 -> ../../devices/platform/gpio-leds/leds/nsa325:red:sata2
echo none > /sys/class/leds/nsa325:green:sata1/trigger echo ide-disk1 > /sys/class/leds/nsa325:red:sata1/triggeror to make it stay solid red:
echo default-on > /sys/class/leds/nsa325:red:sata1/trigger
Quote
ls -l /sys/class/leds/nsa325\:red\:sata1/
total 0
drwxr-xr-x 3 root root 0 Jan 27 16:03 .
drwxr-xr-x 11 root root 0 Jan 27 16:03 ..
-rw-r--r-- 1 root root 4096 Jan 27 16:03 brightness
lrwxrwxrwx 1 root root 0 Jan 27 16:03 device -> ../../../gpio-leds
-r--r--r-- 1 root root 4096 Jan 27 16:03 max_brightness
drwxr-xr-x 2 root root 0 Jan 27 16:03 power
lrwxrwxrwx 1 root root 0 Jan 27 16:03 subsystem -> ../../../../../class/leds
-rw-r--r-- 1 root root 0 Jan 27 16:03 trigger
-rw-r--r-- 1 root root 4096 Jan 27 16:03 uevent
Re: LEDs on NSA325v2 January 28, 2021 01:25AM |
Registered: 5 years ago Posts: 16 |
Re: LEDs on NSA325v2 January 28, 2021 07:02AM |
Registered: 5 years ago Posts: 16 |
Re: LEDs on NSA325v2 January 28, 2021 03:49PM |
Admin Registered: 13 years ago Posts: 18,997 |
Quote
Key daemon (button control)
Multimedia keyboard daemon for Linux
How to use set up button to reboot or shutdown with Key Daemon (esekeyd)
Re: LEDs on NSA325v2 January 31, 2021 04:46AM |
Registered: 5 years ago Posts: 16 |
Quote
Key daemon (button control)
>
> Multimedia keyboard daemon for Linux
> How to use set up button to reboot or shutdown
> with Key Daemon (esekeyd)
Re: LEDs on NSA325v2 February 02, 2021 09:42AM |
Registered: 3 years ago Posts: 21 |
Re: LEDs on NSA325v2 April 12, 2021 01:53PM |
Registered: 4 years ago Posts: 2 |
#!/bin/bash cd /sys/class/leds LEDS=(*) ONOFF=('none' 'default-on') while true ; do LED=${LEDS[$((0 + $RANDOM % ${#LEDS[@]} ))]} VALUE=${ONOFF[$RANDOM % 2]} echo $VALUE > ${LED}/trigger sleep 0.1 done
Re: LEDs on NSA325v2 April 13, 2021 02:27AM |
Admin Registered: 13 years ago Posts: 18,997 |
> #!/bin/bash > > cd /sys/class/leds > > LEDS=(*) > ONOFF=('none' 'default-on') > > while true ; do > LED=${LEDS[$((0 + $RANDOM % ${#LEDS[@]} ))]} > VALUE=${ONOFF[$RANDOM % 2]} > echo $VALUE > ${LED}/trigger > sleep 0.1 > done >
Re: LEDs on NSA325v2 December 27, 2021 12:11PM |
Registered: 2 years ago Posts: 6 |
Re: LEDs on NSA325v2 December 27, 2021 03:56PM |
Admin Registered: 13 years ago Posts: 18,997 |
Re: LEDs on NSA325v2 December 28, 2021 04:44AM |
Registered: 2 years ago Posts: 6 |
root@nsa325:/sys/devices/platform/gpio-leds/leds/nsa325:green:usb/ports# ls . .. 1-1-port1 1-1-port2 1-1-port3 1-1-port4 usb1-port1 usb2-port1 usb2-port2 usb3-port1 usb3-port2
# /etc/rc.local ... if [ -d /sys/class/leds/nsa325:green:usb ]; then # echo usb-host > /sys/class/leds/nsa325\:green\:usb/trigger # Initial config echo usbport > /sys/class/leds/nsa325\:green\:usb/trigger echo 0 > /sys/class/leds/nsa325\:green\:usb/ports/1-1-port1 # Back, near the fan echo 1 > /sys/class/leds/nsa325\:green\:usb/ports/1-1-port2 # Back, farthest from the fan # echo 0 > /sys/class/leds/nsa325\:green\:usb/ports/usb1-port1 # echo 1 > /sys/class/leds/nsa325\:green\:usb/ports/usb1-port2 echo 1 > /sys/class/leds/nsa325\:green\:usb/ports/usb3-port1 # Front fi ...
Re: LEDs on NSA325v2 December 28, 2021 03:38PM |
Admin Registered: 13 years ago Posts: 18,997 |
diff -Naur --no-dereference a/arch/arm/boot/dts/kirkwood-nsa325.dts b/arch/arm/boot/dts/kirkwood-nsa325.dts
Re: LEDs on NSA325v2 February 10, 2022 02:20AM |
Registered: 6 years ago Posts: 56 |
#For testing #KEY_116:/usr/bin/logger -s -i "POWER button pushed" #RESTART:/usr/bin/logger -s -i "RESTART button pushed" #KEY_133:/usr/bin/logger -s -i "COPY Button pushed" #The real stuff KEY_116:/root/run_when_button_power_is_used.sh KEY_133:/root/run_when_button_copy_is_used.sh
#!/bin/bash # # First all LEDs on, and wait 1 second echo default-on > /sys/class/leds/nsa326:white:sys/trigger echo default-on > /sys/class/leds/nsa326:red:sys/trigger echo default-on > /sys/class/leds/nsa326:white:sata1/trigger echo default-on > /sys/class/leds/nsa326:white:sata2/trigger echo default-on > /sys/class/leds/nsa326:white:usb/trigger sleep 1 # Turn LEDs off one at a time, from down to up, wait 0.5 seconds between echo none > /sys/class/leds/nsa326:white:usb/trigger sleep 0.5 echo none > /sys/class/leds/nsa326:white:sata2/trigger sleep 0.5 echo none > /sys/class/leds/nsa326:white:sata1/trigger sleep 0.5 echo none > /sys/class/leds/nsa326:white:sys/trigger sleep 1 # Set all LEDs but red to normal and then shut down echo default-on > /sys/class/leds/nsa326:white:sys/trigger #echo none > /sys/class/leds/nsa326:red:sys/trigger echo ide-disk1 > /sys/class/leds/nsa326:white:sata1/trigger echo ide-disk2 > /sys/class/leds/nsa326:white:sata2/trigger echo usb-host > /sys/class/leds/nsa326:white:usb/trigger /sbin/shutdown -h now/root/run_when_button_copy_is_used.sh is almost the same as for power button above, but with the change that /sbin/shutdown with copy button restarts at the end
/sbin/shutdown -r now
Re: LEDs on NSA325v2 February 10, 2022 04:19PM |
Admin Registered: 13 years ago Posts: 18,997 |