Toggle wifi with cron

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Author Message
apacheguy
DD-WRT User


Joined: 26 Jun 2008
Posts: 88

PostPosted: Wed Mar 15, 2023 1:36    Post subject: Toggle wifi with cron Reply with quote
Netgear XR500
Build 51855

I am familiar with the radio scheduling feature available in the GUI. However, I need to disable wifi at 4 am on Saturday only. Thus, the radio scheduler does not work for me.

How do I disable wifi on the XR500 via the command line? The suggestions in the below thread do not work on the XR500.

https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=286300&postdays=0&postorder=asc&start=0

The most I can accomplish by following that thread is to have the Wifi Status show "Inactive" but the wifi radio temperature remains hot.


Last edited by apacheguy on Tue Mar 21, 2023 4:32; edited 2 times in total
Sponsor
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6410
Location: UK, London, just across the river..

PostPosted: Wed Mar 15, 2023 7:43    Post subject: Reply with quote
Radio scheduling feature available in the GUI for me its working as it should...

in the past i used one of those but dont remember which Smile
bear in mind may be non of those is working now or those need adapting
may be someone else will give better light on the subject...
now tea its time for me...

p.s. you can set the radio scheduling feature on off and monitor via top what is executed to bring it down and than use this a base to adapt the cron job for it... Cool

0 18 * * * root wl -i wlan0 radio off
0 6 * * * root wl -i wlan0 radio on

or those instead the wl line

disable : startservice radio_off_0 -f
enable : startservice radio_on_0 -f

for 2,4Ghz
0 18 * * 1,2,3,4,5 root startservice radio_off_0 -f
0 6 * * 1,2,3,4,5 root startservice radio_on_0 -f

for 5Ghz
0 18 * * 1,2,3,4,5 root startservice radio_off_1 -f
0 6 * * 1,2,3,4,5 root startservice radio_on_1 -f

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 55179 WAP
TP-Link WR1043NDv2 -DD-WRT 55303 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 55460 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55460 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55363 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
matjazk
DD-WRT User


Joined: 21 Aug 2019
Posts: 120
Location: Here, There And Everywhere

PostPosted: Wed Mar 15, 2023 15:20    Post subject: Reply with quote
Interesting. I tried this on R9000, R7800 and WRT1200v1 (Marvell).
Neither has wl command, however

service | grep radio

produces this:

radio_off [start] [stop] [restart] (emulated)
radio_off_0 [start] [stop] [restart] (emulated)
radio_off_1 [start] [stop] [restart] (emulated)
radio_off_2 [start] [stop] [restart] (emulated)
radio_on [start] [stop] [restart] (emulated)
radio_on_0 [start] [stop] [restart] (emulated)
radio_on_1 [start] [stop] [restart] (emulated)
radio_on_2 [start] [stop] [restart] (emulated)
radio_timer [start] [stop] [restart] (emulated)

So the second option is viable. And it works, at least on my routers. Do radio_on and radio_off perform the same operation on all radios?
apacheguy
DD-WRT User


Joined: 26 Jun 2008
Posts: 88

PostPosted: Thu Mar 16, 2023 1:17    Post subject: Reply with quote
I ran this command which appears to apply to all wifi radios:

Code:
service radio_off start


The Radio Status showed "Inactive" and all clients were disconnected.

However, the wlan0 temperature still reads 45 °C. This indicates that the radio remains powered. I want to completely disable (i.e., depower) the radio.
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2927
Location: Germany

PostPosted: Thu Mar 16, 2023 7:27    Post subject: Reply with quote
then you have to take a soldering iron and desolder the radio or how do you think this should work?
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1899

PostPosted: Thu Mar 16, 2023 14:05    Post subject: Reply with quote
"I don't think it works how you think or expect it should work." There is no code in the binaries to remove electrical power to any part of the SoC, including wifi radios. Your only options are to power down the entire router, remove the radio chip with soldering equipment as sir ho1Aetoo so eloquently alluded to, or add a fan to draw air through and out of the router case. Those temps are fairly benign if you're that worried, and it seems as if you already are using a fan of some sort(?) ,,,
_________________
"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

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
apacheguy
DD-WRT User


Joined: 26 Jun 2008
Posts: 88

PostPosted: Thu Mar 16, 2023 16:02    Post subject: Reply with quote
No desoldering is needed. If the network mode is “disabled” then the radio is off and the temperature is not displayed in the GUI. Case in point, I don’t see the 2.4 ghz radio temp since I have 2.4 ghz disabled. I can only see the wlan0 5 ghz radio temperature.
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1899

PostPosted: Thu Mar 16, 2023 20:23    Post subject: Reply with quote
Which is a completely different function than the previous radio_off / radio_on.
_________________
"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

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
mac913
DD-WRT Guru


Joined: 02 May 2008
Posts: 1848
Location: Canada

PostPosted: Thu Mar 16, 2023 21:22    Post subject: Reply with quote
apacheguy wrote:
No desoldering is needed. If the network mode is “disabled” then the radio is off and the temperature is not displayed in the GUI. Case in point, I don’t see the 2.4 ghz radio temp since I have 2.4 ghz disabled. I can only see the wlan0 5 ghz radio temperature.


Just because the The temperature is not shown when "disabled" is selected it doesn't mean the radio is powered off. It's still drawing power to respond to CLI or GUI commands.

If you open the router and measure the temperature of the radio chip with an Infrared Gun when it is disabled or radio off will more likely have the same temperature.

_________________
Home Network on Telus 1Gb PureFibre - 10GbE Copper Backbone
2x R7800 - Gateway & WiFi & 3xWireGuard - DDWRT r53562 Std k4.9

Off Site 1

R7000 - Gateway & WiFi & WireGuard - DDWRT r54517 Std
E3000 - Station Bridge - DDWRT r49626 Mega K4.4

Off Site 2

R7000 - Gateway & WiFi - DDWRT r54517 Std
E2000 - Wired ISP IPTV PVR Blocker - DDWRT r35531


YAMon 3.4.6 | DNSCrypt-Proxy V2
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2927
Location: Germany

PostPosted: Thu Mar 16, 2023 23:15    Post subject: Reply with quote
radio_off does exactly what "radio scheduling" does, it terminates the hostapd process and without this the radio is without function.

The radios remain hot either way because they are both directly connected to the processor via the same heat sink.

I also doubt that the network mode "disabled" will make the whole card powerless, it will simply disable the card.

The devices powerstats can actually also be read out via "lspci".

Quote:
D0 or Fully On is the operating state.
As with S0ix, Intel has D0ix states for intermediate levels on the SoC.[40]
D1 and D2 are intermediate power-states whose definition varies by device.
D3: The D3 state is further divided into D3 Hot (has auxiliary power), and D3 Cold (no power provided)


When I set the network mode to "disabled" in my R7800, "lscpi" still shows me D0 for the WLAN cards.

Code:
0000:01:00.0 Network controller: Qualcomm Atheros QCA9984 802.11ac Wave 2 Wireless Network Adapter
   Subsystem: Qualcomm Atheros Device cafe
   Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR+ FastB2B- DisINTx+
   Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort+ <MAbort- >SERR- <PERR- INTx-
   Latency: 0, Cache Line Size: 64 bytes
   Interrupt: pin A routed to IRQ 105
   Region 0: Memory at 08000000 (64-bit, non-prefetchable) [size=2M]
   Capabilities: [40] Power Management version 3
      Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
      Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-


Status: D0

The same in my PC, when I deactivate my WLAN cards via rfkill, it still shows D0.

Code:
:~$ rfkill
ID TYPE      DEVICE      SOFT      HARD
 1 wlan      phy2   blockiert entsperrt
 2 wlan      phy0   blockiert entsperrt
 3 wlan      phy1   blockiert entsperrt


Code:
:~$ cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:03.0/0000:03:00.0/power_state
D0
:~$ cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/0000:02:07.0/0000:04:00.0/power_state
D0


Code:
03:00.0 Network controller: Qualcomm Atheros QCA9984 802.11ac Wave 2 Wireless Network Adapter
   Subsystem: Qualcomm Atheros QCA9984 802.11ac Wave 2 Wireless Network Adapter
   Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
   Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
   Latency: 0, Cache Line Size: 64 bytes
   Interrupt: pin A routed to IRQ 143
   Region 0: Memory at df200000 (64-bit, non-prefetchable) [size=2M]
   Capabilities: [40] Power Management version 3
      Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
      Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-


Code:
04:00.0 Network controller: Qualcomm Atheros QCA9984 802.11ac Wave 2 Wireless Network Adapter
   Subsystem: Qualcomm Atheros QCA9984 802.11ac Wave 2 Wireless Network Adapter
   Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
   Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
   Latency: 0, Cache Line Size: 64 bytes
   Interrupt: pin A routed to IRQ 144
   Region 0: Memory at df000000 (64-bit, non-prefetchable) [size=2M]
   Capabilities: [40] Power Management version 3
      Flags: PMEClk- DSI- D1- D2- AuxCurrent=375mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
      Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-


the cards also do not show temperature when disabled

Code:
ath10k_hwmon-pci-0300
Adapter: PCI adapter
temp1:            N/A 

ath10k_hwmon-pci-0400
Adapter: PCI adapter
temp1:            N/A 


But according to sysfs they run in D0 and are fully operational.....

An alternative to soldering would be to turn off the router then the wifi is also guaranteed powerless Smile


Last edited by ho1Aetoo on Fri Mar 17, 2023 9:51; edited 1 time in total
apacheguy
DD-WRT User


Joined: 26 Jun 2008
Posts: 88

PostPosted: Fri Mar 17, 2023 1:10    Post subject: Reply with quote
This is interesting since with my BCM router it would not show the temperature in the GUI after disabling the radio and I also measured 2 watts lower power consumption with a Kill a Watt meter. I haven’t had a chance to do the Kill a Watt test with the XR500 but I guess Atheros chipsets behave differently than BCM which is why I assumed it wasn’t working.
apacheguy
DD-WRT User


Joined: 26 Jun 2008
Posts: 88

PostPosted: Tue Mar 21, 2023 4:30    Post subject: Reply with quote
After disabling wifi radios vía cron, I can’t get de-wrt to enable them again by pressing the wifi button on the XR500. It seems to think that it needs to turn the radios off even though they are already off and I actually want to turn them on.

Code:
 Mar 20 21:17:28 DD-WRT user.debug : Wifi Button: turning radio(s) off
Mar 20 21:17:28 DD-WRT user.debug : Wifi Button: turning radio(s) off
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum