lagrangersf DD-WRT Novice
Joined: 01 Mar 2013 Posts: 21
|
Posted: Wed Nov 02, 2016 16:57 Post subject: GLi GL-MT300N - Use GPIO switch to toggle wireless on/off |
|
Greetings. I just recently purchased a GLi GL-MT300N mini travel router from Amazon. It supposedly has identical hardware to the Buffalo WHR-300HP2, as this is the version of dd-wrt that their official "how to flash dd-wrt" instructions recommend. Indeed, I was able to flash and configure dd-wrt with no issues whatsoever using the recommended Buffalo firmware (v3.0-r29218 03/07/16), and it is working beautifully (Note: I did skip the startup commands because in our setup WAN is disabled and the WAN port is assigned to the LAN switch).
This router has a small three-position toggle switch on the side that, according to the sparse instruction manual it came with, can be configured to perform different functions depending on what position it is in (But of course, it neglects to mention HOW to configure the switch). Since the router originally shipped with an OpenWRT-based firmware, I was wondering if there is a way in dd-wrt to configure this switch so that it can be used to toggle the wireless on or off. I ask because the intended purpose of this router is an as-needed WAP for guest access in a business, and we desire the ability to disable the wireless when needed without having to power down or disconnect the router entirely (To avoid having to wait for the router to boot back up when the wireless is needed), or enable/disable the wireless via the dd-wrt UI (Which my less-technical coworkers could never figure out how to do). A simple "flip the switch to turn the wifi on or off" is what I desire.
I am presuming this can be done using GPIO polling, as this image shows how GPIO is affected by the various switch settings. However, configuring dd-wrt to poll GPIO and run scripts based on the returned results is something I have never done before. Honestly, beyond flashing and basic configuration, anything more advanced like that is beyond my knowledge.
So, assuming it is somehow possible, how would I go about achieving this? Thank you for any assistance. |
|
lagrangersf DD-WRT Novice
Joined: 01 Mar 2013 Posts: 21
|
Posted: Fri Nov 04, 2016 16:24 Post subject: |
|
Perhaps another question I should be asking: does dd-wrt support exporting GPIO nodes? I've identified the GPIO number I want to use for the switch in question (42), and I added the following commands to Startup in the GUI:
Code: | echo 42 > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio42/direction |
Problem is, the gpio42 path is never created, therefore I'm not able to then query the value with the cat command (returns nothing). Am I doing this wrong (possible since I've never done this before), or as previously asked does dd-wrt simply not support this?
If it is possible, my goal is to eventually create a script that runs every ~30sec or so (to limit CPU usage), polls the state of GPIO 42, and enables or disables the wireless depending on the state of the switch. |
|