Prefacing this post with a caveat: certain GPIO toggles will erase the NVRAM and reset the device. This is normal, but it is not standardized across models. IIRC it is GPIO 6 on some and 5 on others, or even 10 or 11, so some experimentation is necessary for what I describe below, and no guarantees are made that taking what is presented verbatim won’t brick or reset your device if the triggers are different.
I don’t know about the R7000P’s specific GPIO toggles, but the “et” binary from the above referenced thread was useful on my R8000 to get the LAN LEDs to turn off. The in-built “et,” if it’s even still part of the firmware, will not perform that function.
I was able to also poll /dev/gpio/in to watch for the specific bytes when toggling the LED on / off hardware switch on the R8000, and tying it to GPIO 19 to have the switch function like stock firmware makes it.
The code for the switch script is below. I have Optware installed, for “bash,” and it’s loopback mounted on /jffs and /opt (but resides on jffs), so doesn’t need an extra thumb drive. You might be able to get these to work with the in-built shell, but if you need “bash,” then you also need to install Optware, somewhere.
(stealth.sh)
Code:
#!/bin/bash
# close all input and output so we can run as a background process
exec 0>&- # close stdin
exec 1>&- # close stdout
exec 2>&- # close stderr
if [ "$1" != "-s" ]
then
silent=0
else
silent=1
fi
init() {
# assume inital state of off
old=00
if [ "$silent" = "0" ]
then
/usr/bin/logger -t "LED INFO" -p user.info "Starting Stealth LED script /opt/etc/stealth.sh"
/usr/bin/logger -t "LED INFO" -p user.info "Stealth LED script /opt/etc/stealth.sh GPIO 19: disabled (Off)"
fi
if [ $usb ]
then
noop=1
#
# leave the USB leds disabled as plugging in a
# device will turn them back on
#
# should really test the state of the USB port
# so that the leds only get enabled if there is
# device plugged in on that port
#
#gpio disable 17
#gpio disable 18
#
fi
I have noticed that sometimes the stealth (switch) script will exit or abort, so have a cron job that calls the following script every minute to watch for the script aborting and restart it if necessary.
(cron script fragment)
Code:
#!/bin/sh
if [ -z "`/bin/pidof stealth.sh`" ]; then
/bin/bash -c "/opt/etc/stealth.sh" > /dev/null 2>&1 &
fi
Since it runs from cron, when the router boots, it will start the script shortly after and ensure it stays running.
Joined: 16 Nov 2015 Posts: 6437 Location: UK, London, just across the river..
Posted: Tue Aug 02, 2022 6:50 Post subject:
yep some of the LED scripts behave funny on hit apply button or reboots...my experience
that's the one i use on my R7000, but it gets funny if you set your radio to turn on off by time, the wifi led appears and stays on after.....or you hit apply button and it re executes...it also slows down the boot time for some reason...
for i in 2 3 8 9 12 13 17 18 ; do gpio enable $i ; done
for i in 14 15 ; do gpio disable $i ; done
for best results, just use a black scotch tape _________________ Atheros
TP-Link WR740Nv1 ---DD-WRT 55630 WAP
TP-Link WR1043NDv2 -DD-WRT 55723 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55779 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55819 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55779 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
Joined: 31 Jul 2021 Posts: 2146 Location: All over YOUR webs
Posted: Tue Aug 02, 2022 7:59 Post subject:
@Hapi12021
Regarding gpio which resets device, no experimentation required, if you run nvram show |grep gpio it will tell you which gpio is assigned to reset from the list shown, so yu only need to read.
Also keep in mind polarity, some gpios have reversed polarity, so enabling them will disable them and vice versa, now that requires experimentation.
Regarding gpio which resets device, no experimentation required, if you run nvram show |grep gpio it will tell you which gpio is assigned to reset from the list shown, so yu only need to read.
Apparently not. Maybe I need to flash a newer build, I'm about a month behind current.
the-joker wrote:
also, saving script as firewall on commands sub tab will execute when APPLY button is clicked and services restart, also it will run at every boot.
I have a firewall script running there already, and the switch script runs as a continual process, so in my case I would probably just add another cron entry to run the LED script at around the same time I would turn the radio on / off.
I generally don't "Apply" settings, only save and reboot, which is the safer method when testing. Otherwise, I'm not in the settings very often and the scripts do exactly as needed, no black-tape required.
So I guess we know at least one difference between r7000P and asus RT-AC68U which technically are identically except for CFE.
So much for things common sense then, So, in that case, experimentation needed or check the sysinit file on source code.
Well certainly APPLY clicking isn't necessary, if you save and reboot (as you do), if you dont for instance changing interfaces settings then settings dont reload, but reboot is a long way around it, each to their own whatever works I guess.
Some GPIOs were probably never mapped when devices were ported to DD-WRT. OR, they may be hidden elsewhere besides nvram variables. _________________ "The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost
"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio