OpenWrt Forum Archive

Topic: How to turn off all LEDs on AR8327N switch (WDR3600/43x0, 1043NDv2)

The content of this topic has been archived on 21 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Thank you pepe2k
Your patch is very usefull.
i will use it to turn-off all the leds before the night.
Then power them again in the morning.

It's nice to hear that someone found it useful! smile

Good patch, pepe2k. Good work after UBOOT.

I wonder what can I do to turn off all the lights in a UBNT rocket m2 flashed with openwrt. Little info.

Hi pepe2k,

I have applied you patch file to my r39211 sources
I have rebuilt swconfig utility.
Then i have upgraded the package in my WDR3600
But when i try the command:  swconfig dev switch0 set disable_all_leds 1
i receive the error:

Unknown attribute "disable_all_leds"

What's wrong?

ramponis wrote:

Hi pepe2k,

I have applied you patch file to my r39211 sources
I have rebuilt swconfig utility.
Then i have upgraded the package in my WDR3600
But when i try the command:  swconfig dev switch0 set disable_all_leds 1
i receive the error:

Unknown attribute "disable_all_leds"

What's wrong?

You need to rebuild and upgrade whole image.
This functionality is inside AR8216 driver.

Done, now it works!

Thank you

Hi pepe2k,

Your patch works good, but it turns off the ethernet leds.
I want ask you if it possible also to turn-off the other leds: wi-fi, power and system.
I would like to have ALL leds off during the night.

Thank you

ramponis wrote:

Hi pepe2k,

Your patch works good, but it turns off the ethernet leds.

Let me quote myself:

"This patch adds an option in swconfig which allows to disable all leds in AR8327N switch [...]".

ramponis wrote:

I want ask you if it possible also to turn-off the other leds: wi-fi, power and system.
I would like to have ALL leds off during the night.

In most cases (including TL-WDR3600), there is no way to turn off the power LED using software. It's connected directly to some of the power supply lines.

For other LEDs (Wi-Fi, system, etc.), use uncle Google or OpenWrt Wiki smile

Found solution:

This is my script:

SwitchMode=$1 #on/off
if [ "$SwitchMode" == "on" ]; then
    logger leds turning on
    leds="0"
    brightness="255"
else
    logger leds turning off
    leds="1"
    brightness="0"
fi
swconfig dev switch0 set disable_all_leds $leds
echo $brightness > /sys/class/leds/tp-link\:blue\:system/brightness
echo $brightness > /sys/class/leds/tp-link:green:usb1/brightness
echo $brightness > /sys/class/leds/tp-link:green:usb1/brightness
echo $brightness > /sys/class/leds/tp-link:blue:wlan2g/brightness
echo $brightness > /sys/class/leds/ath9k-phy1/brightness

great patch - great work pepe2k!

I tested it on an TP-Link Archer C7 and it works (it has a 8327N switch, too)

one minor issue:
I get a warning about line 78 when I do "git am < (patch)"
There seems to be a whitespace before the TAB wink

Is it possible to have the patch sent to the mailing list so it will be integrated into OpenWrt trunk please ? (basically sent the patch inline with a Sign-off , according to https://dev.openwrt.org/wiki/SubmittingPatches )

"Night Mode" / deactivate all LEDS would be nice to have in the UI smile

zloop wrote:

one minor issue:
I get a warning about line 78 when I do "git am < (patch)"
There seems to be a whitespace before the TAB wink

OK, thanks, i see it.

zloop wrote:

Is it possible to have the patch sent to the mailing list so it will be integrated into OpenWrt trunk please ? (basically sent the patch inline with a Sign-off , according to https://dev.openwrt.org/wiki/SubmittingPatches )

"Night Mode" / deactivate all LEDS would be nice to have in the UI smile

I will correct it, add missing definitions (at this time, I'm using magic values tongue) and send it to the dev ml.

ramponis wrote:

Found solution:

This is my script:

SwitchMode=$1 #on/off
if [ "$SwitchMode" == "on" ]; then
    logger leds turning on
    leds="0"
    brightness="255"
else
    logger leds turning off
    leds="1"
    brightness="0"
fi
swconfig dev switch0 set disable_all_leds $leds
echo $brightness > /sys/class/leds/tp-link\:blue\:system/brightness
echo $brightness > /sys/class/leds/tp-link:green:usb1/brightness
echo $brightness > /sys/class/leds/tp-link:green:usb1/brightness
echo $brightness > /sys/class/leds/tp-link:blue:wlan2g/brightness
echo $brightness > /sys/class/leds/ath9k-phy1/brightness

Can this script could be further improved by setting time, say 23:00-08:00, LEDs are off, 08:01-22:59, LEDs are on?

eeff11 wrote:

Can this script could be further improved by setting time, say 23:00-08:00, LEDs are off, 08:01-22:59, LEDs are on?

Just add two crontab jobs to run this script with "on" argument at 08:00 and with "off" argument at 23:00.

Today couple of patches, related with LEDs in AR8327 switch, were added (take a look at this changeset: https://dev.openwrt.org/changeset/39338).

So, my solution isn't needed anymore, you may control all switch LEDs using /sys/class/leds/.
For example, to turn off WAN LED in WDR3600/4300:

echo 0 > /sys/class/leds/tp-link\:blue\:wan/brightness

You can now even use those LEDs with various system events (using trigger option).

So, enjoy and give thanks to the developer/s! smile

Your patch is still needed for TP-Link WDR4900, for example.
Those patches in trunk include support for ar71xx-based devices, ppc85xx-based WDR4900 isn't included.

eximido wrote:

Your patch is still needed for TP-Link WDR4900, for example.
Those patches in trunk include support for ar71xx-based devices, ppc85xx-based WDR4900 isn't included.

Yes, you're right.

pepe2k wrote:
eximido wrote:

Your patch is still needed for TP-Link WDR4900, for example.
Those patches in trunk include support for ar71xx-based devices, ppc85xx-based WDR4900 isn't included.

Yes, you're right.

As it was mentioned WDR4900 also has Atheros AR8327
root@client:~# dmesg | grep AR8327
[    1.352498] switch0: Atheros AR8327 rev. 2 switch registered on mdio@ffe24000

What is needed to port https://dev.openwrt.org/changeset/39338 so WDR4900 can use it?
Thanks!

The discussion might have continued from here.