I am using an Onion Omega 2S+ module which runs on OpenWrt from what I can gather. My request is pretty simple. I want to use a GPIO on the Onion(GPIO19) to toggle WiFi On and Off. I have set GPIO19 to be an input, pulled it high to 3.3VDC and have a button to pull it down(Active-Low). It appears that Hotplug has the capabilities I'm looking for as documented here: https://oldwiki.archive.openwrt.org/doc/howto/wifitoggle
My only problem is that this example assumes a button called "ses" which I do not have access to. My question is how can I register GPIO19 as a button on the system so hotplug can monitor it? Is this even possible? I've been looking most of the day and cannot find the answer I'm looking for.
Setting up a GPIO line as an input "key" generally requires a change to the kernel. Otherwise it is a "tree falling in the forest" that nobody is there to hear.
If you've successfully set up your device running Onion firmware to be able to read the GPIO line, then I'd suggest polling that line with a script. The wifi command can be used in that script to enable or disable the 802.11 wireless.
If you wanted to use the built-in "key handler", then you'd probably need to set up that GPIO as a "key" in the DTS and build from source. I'm not very familiar with their code, but I'd start by looking at
I was afraid it wouldn't be all that simple. I wanted to avoid running another script if possible, it's always been my opinion that the less things you have running the less there is to go wrong. This is not a hobby application, it's a product that end users will need to be able to interact with so reliability is key.
I'll look into initializing a script to monitor the input on boot and turn wifi on/off accordingly. I'm certainly in no position to be rebuilding the Kernal, I'm way to green with the Onion module at this point. Perhaps I'll investigate that later down the line.