CLI control of LED on mt300n

Thanks for the input.
I can see how the echo command is being used to turn something on and off but the next trick I’d like to see is how to make the LED blink at a certain rate without using a script to turn it on and off repeatedly. Meaning, one command to start the LED flashing at a s certain rate, one more command to stop it or change it to another rate.

From what I have read, the kmod-ledtrig-timer is the package I need to do blinking LEDs.

I am not a programmer so am trying to avoid writing a script unless there is something very simple to be found on the Internet somewhere.

I find this on the openwrt site but no idea how to use it.

opkg install kmod-ledtrig-timer

Name Type Required Default Description
default integer no 0 LED state before trigger: 0 means OFF and 1 means ON
delayoff integer yes (none) How long (in milliseconds) the LED should be off.
delayon integer yes (none) How long (in milliseconds) the LED should be on.
sysfs string yes (none) LED device name
trigger string yes (none) timer

If you mean this page:

Then it is at the bottom.
You edit the /etc/config/system file and set the options you need.

config 'led'
	option 'sysfs'		'gl-mt300n:wlan'
	option 'trigger'	'timer'
	option 'delayon'	'500'
	option 'delayoff'	'500'

try that :slight_smile:

How to set it on the fly, well you need to follow these sets of commands:

https://wiki.teltonika.lt/index.php?title=UCI_command_usage¨

Something like this:

uci set system.led.trigger='default-on'
uci system commit

Have fun :smiley:

oops! It is easy to control led flash.

echo timer >  /sys/class/leds/gl-mt300n:wlan/trigger
cat /sys/class/leds/gl-mt300n:wlan/delay_off
cat /sys/class/leds/gl-mt300n:wlan/delay_on

Changing delay_off and delay_on to control flashing frequency.

I am able to make the wlan LED flash but only at one rate.

echo “none” > /sys/class/leds/gl-mt300n:wlan/trigger
echo “timer” > /sys/class/leds/gl-mt300n:wlan/trigger

Then back to ‘none’ to stop it but that’s not what I am looking for. I want to flash the LED at different speeds, have it remain flashing until I stop it using ‘none’ again, for example.

I’ll try your delay suggestion next :).

Now I am seeing what you mean.
Changing the delay is all I need to do. I don’t need to have a script turning it on and over repeatedly.

Send the ‘timer’ to the trigger file then the following to set the rate.

echo 1 /sys/class/leds/gl-mt300n:wlan/delay_on
echo 128 /sys/class/leds/gl-mt300n:wlan/delay_off

1 and 128 seems to be the max rate.

This is exactly what I was interested in, something that doesn’t require a bunch of programming, nice and simple.

For anyone that finds this.

Disable timer mode
echo “none” > /sys/class/leds/gl-mt300n:wlan/trigger

Enable timer mode
echo “timer” > /sys/class/leds/gl-mt300n:wlan/trigger

Set on/off flash rate that you would like.
echo 1 > /sys/class/leds/gl-mt300n:wlan/delay_on
echo 255 > /sys/class/leds/gl-mt300n:wlan/delay_off

Thank you for your help everyone. Hope someone that needs this will find it useful.

You can check this:

And the delay is an integer, so max is 2147483647. You won’t have much use then a few seconds, but you can set longer. They use 2 seconds in the example above, 2000ms.

Yes, I just realized this :).
I thought the limit was 1-255 but now I see there is more.
Now I’m trying to figure out how to change the brightness. Maybe the LED script has to be restarted for that since it doesn’t work like the others.

There is one interesting problem. I have not confirmed when/what causes this but when dealing with the files directly, meaning using echo to send into delay_on/off for example, the files eventually disappear. I have tested this on both tp-link and glinet to be true so far.

No idea what condition causes this to happen and only a reboot resets this. I’ll try restarting the led program next time.

Found the condition. When I sent a reset to the trigger file
echo “none” > /sys/class/leds/gl-mt300n:wlan/trigger

that removes the delay files.