I have a Nano Pi R2S on Ubuntu 20.04 and I am trying to configure the WAN and LAN led of the unit. Please excuse my low skill set. According to the guide (https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R2S#Config_status_LEDs) I need to put the following into a auto run script.
echo netdev > /sys/class/leds/wan_led/trigger
echo eth0 > /sys/class/leds/wan_led/device_name
echo 1 > /sys/class/leds/wan_led/link
echo netdev > /sys/class/leds/lan_led/trigger
echo eth1 > /sys/class/leds/lan_led/device_name
echo 1 > /sys/class/leds/lan_led/link
Here is my ledstatus.sh
#!/bin/bash
echo netdev > /sys/class/leds/wan_led/trigger
echo eth0 > /sys/class/leds/wan_led/device_name
echo 1 > /sys/class/leds/wan_led/link
echo netdev > /sys/class/leds/lan_led/trigger
echo eth1 > /sys/class/leds/lan_led/device_name
echo 1 > /sys/class/leds/lan_led/link
This is my errors.
./statusled.sh: line 3: echo: write error: Invalid argument
./statusled.sh: line 4: /sys/class/leds/wan_led/device_name: Permission denied
./statusled.sh: line 5: /sys/class/leds/wan_led/link: Permission denied
./statusled.sh: line 7: echo: write error: Invalid argument
./statusled.sh: line 8: /sys/class/leds/lan_led/device_name: Permission denied
./statusled.sh: line 9: /sys/class/leds/lan_led/link: Permission denied
Same issue but fixed, invalid argument here is not invalid for
echo
, but for the file/sys/class/leds/wan_led/trigger
. Thetrigger
needs a specific value, you can runcat /sys/class/leds/wan_led/trigger
to see all valid value, as for the output ofcat
: the [value] is selected, and the others are options,you must echo one of them, or you got "invalid "