Onion Omega 2 WiFi connection. What if wrong Password?



  • Hi community,

    I'm currently trying out some scenarios on the Onion's WiFi manager. My onion is connected to a Touch Screen on which users can select an available WiFi and connect to it or disconnect from it. Pretty similar to any WiFi Manager you would find on your Smartphone.

    However, the 'wifisetup' documentation is pretty scarce: https://docs.onion.io/omega2-docs/connecting-to-wifi-networks-command-line.html

    I have 2 questions, remaining unanswered:

    1 - If I run wifisetup -list, I get a dictonnnary output looking like this:
    {"result": [ {"enabled": true/false, "ssid":"wifi name", "encryption": "psk2 etc...", "password": "network password"}, etc..., ]"success": true/false]
    What is the "success" key meaning. It is not described anywhere.

    2- If I try to connect to a Wifi but enter the wrong password I get this:
    {"result": [ {"enabled": true, "ssid":"wifi name", "encryption": "", "password": ""}, etc..., ]"success": true]
    I'm quite confused, that success goes to true, and that this wifi appears in the list as "enabled": true but with empty encryption and password keys....

    This doens't make any sense to me... Any hints on the meanings of this?

    Best,

    MK



  • @MK The result is reported by UCI (Unified Configuration Interface) indicating the changes were successfully comitted. So it indicates the JSON structure is correct and that you have the required pemissions to make those changes. It does not validate that the wifi configuration itself is correct.



  • Thanks for this. Hadn't this in mind. Do you have any hint regarding the second point?



  • @MK Sorry I missed the second point. wfifsetup is a script in /usr/bin so you can look at the specifics there but to troubleshoot this I would issue the command: uci show wireless.sta and see what it reports. My guess is that there is an issue with a delimiter or something in your key/password that is confusing uci.

    You can also add parameters to the wifisetup commandline to assist in troubleshooting, wifisetup -debug -v <list | add | remove etc> this will provide more details and dump a log to /tmp/wifidebug.log



  • @crispyoz Great hint! I'll check what I see in the log. Just to get things right: I'm explicitely testing the use case where a user enters a wrong Password. This case has a strange behaviour as even if a wrong password is entered, the network is added to the registered wifi list and is set to "enabled" = True....



  • @MK it's important to understand that wifisetup simply uses UCI to modify the WiFi setup and then bring the interface up, it has no functionality to check the WiFi subsequently is connected, only that it is enabled.

    If you bring the WiFi interface up (wifisetup does this) if the SID/encryption/passphrase are rejected by the router the interface goes down then up, then down. A little like playing on a pogo stick.

    The solution I use in my own app is to wait 15 seconds after the interface comes up then ping a known good ip. 8.8.8.8 and 8.8.4.4 a good bets as they're Google's DNS servers.

    I don't do this in scripts, I wrote it into my app, but you can also use a script accessible via UBUS directly or using mod-ubus (see docs)



Looks like your connection to Community was lost, please wait while we try to reconnect.