@crispyoz I will try this command when "pending" happens again.
Thank you
Pavel Negrobov
@Pavel Negrobov
Best posts made by Pavel Negrobov
Latest posts made by Pavel Negrobov
-
RE: Wifi connection is in "pending" state. What does it mean?
-
Wifi connection is in "pending" state. What does it mean?
Hello, guys!
I have Omega2+, last firmware
I am setting up Wifi connection using command/usr/bin/wifisetup add -ssid xxx -encr psk2 -password yyy
AP name and password are valid.
Very often after send connection command I have situation:- Omega does not receive IP address, so connection absent.
# /usr/bin/wifisetup list { "results": [ { "enabled": true, "ssid": "xxx", "encryption": "psk2", "password": "yyy" } ], "success": true }
# /bin/ubus call network.interface.wwan status { "up": false, "pending": true, "available": true, "autostart": true, "dynamic": false, "proto": "dhcp", "device": "apcli0", "data": { } }
# cat /etc/config/wireless config wifi-device 'radio0' option type 'ralink' option variant 'mt7628' option country 'US' option hwmode '11g' option htmode 'HT40' option channel 'auto' option disabled '0' option device_mode 'apsta' option op_mode 'preference' config wifi-iface 'ap' option device 'radio0' option mode 'ap' option network 'wlan' option ifname 'ra0' option encryption 'psk2' option key '12345678' option disabled '0' option ssid 'Omega-3079' config wifi-iface 'sta' option device 'radio0' option mode 'sta' option ifname 'apcli0' option encryption 'psk2' option network 'wwan' option led 'omega2p:blue:wifi' option disabled '0' option ssid 'xxx' option key 'yyy' config wifi-config option key 'xxx' option ssid 'yyy' option encryption 'psk2'
If I am rebooting Omega in this state, it succesfully connects to xxx, receives IP and all work good.
Command for disconnect:
/usr/bin/wifisetup remove -ssid xxx
removes section "config wifi-config", "config wifi-iface 'sta'" stays. Is this correct?
Main questions:
Why connection in pending state? What does it mean? How to avoid this? Or force connection?In documentation https://docs.onion.io/omega2-docs/adjusting-ap-network-through-command-line.html I found command for restart WiFi driver "/etc/init.d/wireless restart". But it is invalid:
/# /etc/init.d/wireless restart /bin/ash: /etc/init.d/wireless: not found
What is valid command?
Thanks
-
RE: Omega2+ Wifi API
@crispyoz said in Omega2+ Wifi API:
@Pavel-Negrobov I don't know any way of actually checking the WiFi is successfully connected since UCI just changes the configuration. I just try to programatically open a connection to a known good host and check the response code.
I think to call something like '/bin/ubus call network.interface.wwan status' and check result during some timeout. For example 30 sec.
-
RE: Omega2+ Wifi API
Hi, guys again.
One question stay unresolved. If I am trying to add AP with invalid password, all commands finished successfully, but connection process isroot@Omega-3079:~# curl -d '{"jsonrpc": "2.0", "id": 1, "method": "call", "param s": ["03ca3d0dd751363549c11eb3aabe2f58", "network", "restart", {}]}' http://loca lhost/ubus [ 369.968407] br-wlan: port 1(ra0) entered disabled state [ 369.998913] device ra0 left promiscuous mode [ 370.003511] br-wlan: port 1(ra0) entered disabled state [ 370.042661] br-wlan: port 1(ra0) entered blocking state [ 370.047976] br-wlan: port 1(ra0) entered disabled state [ 370.053844] device ra0 entered promiscuous mode [ 370.088398] br-wlan: port 1(ra0) entered blocking state [ 370.093775] br-wlan: port 1(ra0) entered forwarding state {"jsonrpc":"2.0","id":1,"result":[0]}root@Omega-3079:~# [ 381.118681] br-wlan: port 1(ra0) entered disabled state [ 381.131892] device ra0 left promiscuous mode [ 381.136358] br-wlan: port 1(ra0) entered disabled state [ 381.211446] IPv6: ADDRCONF(NETDEV_UP): br-wlan: link is not ready [ 386.173252] br-wlan: port 1(ra0) entered blocking state [ 386.178567] br-wlan: port 1(ra0) entered disabled state [ 386.184303] device ra0 entered promiscuous mode [ 386.189068] br-wlan: port 1(ra0) entered blocking state [ 386.194420] br-wlan: port 1(ra0) entered forwarding state [ 386.201707] IPv6: ADDRCONF(NETDEV_CHANGE): br-wlan: link becomes ready [ 388.425631] Interface apcli0 link up! (WPA2PSK AES) [ 403.545858] Interface apcli0 link up! (WPA2PSK AES) [ 418.665958] Interface apcli0 link up! (WPA2PSK AES) [ 434.426001] Interface apcli0 link up! (WPA2PSK AES) [ 444.430108] Interface apcli0 link up! (WPA2PSK AES) [ 449.148040] Interface apcli0 link up! (WPA2PSK AES) [ 464.027064] Interface apcli0 link up! (WPA2PSK AES) ..................
This is сontinues endlessly until I am shuts down wifi or delete AP.
How to check Wifi connection errors?
-
RE: enable uart2 is posiible on Omega2+??
I am using UART1 (pins 45, 46) with python pyserial library without any utilities. All works good.
-
RE: Omega2+ Wifi API
Thanks to all. I put all of this to my Python soft and write results here.
-
RE: Omega2+ Wifi API
No, /etc/config/wireless is clean:
# cat /etc/config/wireless config wifi-device 'radio0' option type 'ralink' option variant 'mt7628' option country 'US' option hwmode '11g' option htmode 'HT40' option channel 'auto' option disabled '0' option device_mode 'apsta' option op_mode 'preference' config wifi-iface 'ap' option device 'radio0' option mode 'ap' option network 'wlan' option ifname 'ra0' option encryption 'psk2' option key '12345678' option disabled '0' option ssid 'Omega-3079' config wifi-iface 'sta' option device 'radio0' option mode 'sta' option ifname 'apcli0' option encryption 'psk2' option ssid 'YourSsidHere' option key 'YourPasswordHere' option network 'wwan' option disabled '1' option led 'omega2p:blue:wifi'
okay, I can call
uci set wireless.sta.disabled='1'; uci commit wireless; wifi uci set wireless.sta.disabled='0'; uci commit wireless; wifi
as György Farkas said.
PS.
On latest 242 build all the same. -
RE: Omega2+ Wifi API
@crispyoz said in Omega2+ Wifi API:
@Pavel-Negrobov Use network reload instead of restart, the methods stop and start don't exist, hence the error 3 response.
Restart has no effect:
# curl -d '{"jsonrpc": "2.0", "id": 1, "method": "call", "params": ["3f116f85f4e1ad269f7b22ac539443b3", "uci", "delete", "config": "wireless", "type": "wifi-config", "values": {"ssid": "ZyXEL_GIGA_III" } }] }' http://localhost/ubus {"jsonrpc":"2.0","id":1,"result":[0]} # curl -d '{"jsonrpc": "2.0", "id": 1, "method": "call", "params": ["3f116f85f4e1ad269f7b22ac539443b3", "uci", "commit", {"config": "wireless"}]}' http://localhost/ubus {"jsonrpc":"2.0","id":1,"result":[0]} # curl -d '{"jsonrpc": "2.0", "id": 1, "method": "call", "params": ["3f116f85f4e1ad269f7b22ac539443b3", "network", "reload", {}]}' http://localhost/ubus {"jsonrpc":"2.0","id":1,"result":[0]}
Thats all. Wifi restart process does not started.
My firmware version is 0.3.2 b240. Today I will try to set the last 242 build. -
RE: Omega2+ Wifi API
@crispyoz said in Omega2+ Wifi API:
@Pavel-Negrobov if you post the JSON response I can see what the issue is. Error 3 doesn't seem correct.
Here full output without any reduction (Wifi Connection is active at start):
root@Omega-3079:/# curl -d '{ "jsonrpc":"2.0", "id":1, "method": "call", "params ": [ "00000000000000000000000000000000", "session", "login", { "username":"root" , "password":"redhat" } ] }' http://localhost/ubus {"jsonrpc":"2.0","id":1,"result":[0,{"ubus_rpc_session":"213ac1e069ca85b390c70570a6a58197","timeout":300,"expires":299,"acls":{"access-group":{"onion-os":["read","write"],"superuser":["read","write"],"unauthenticated":["read"]},"cgi-io":{"*":["write"],"upload":["write"]},"file":{"*":["*"]},"ubus":{"*":["*"],"file":["list","read","exec","write","stat"],"i2c_exp":["pwm-exp","relay-exp","oled-exp"],"iwinfo":["assoclist"],"network.device":["status"],"network.interface":["dump"],"network.interface.wwan":["status"],"onion":["wifi-scan","oupgrade","wifi-setup","omega-led","gpio"],"onion-console":["app-list"],"onion-helper":["*"],"onion-os":["app-list"],"rpc-sys":["reboot","password_set"],"service":["list"],"session":["access","login"],"system":["info","hostname","board"],"uci":["*"]},"uci":{"*":["read","write"],"commit":["write"],"delete":["read","write"],"get":["read","write"],"mjpg-streamer":["read","write"],"network":["read","write"],"onion":["read","write"],"rpcd":["read","write"],"set":["write"],"system":["read","write"],"wireless":["read","write"]}},"data":{"username":"root"}}]}root@Omega-3079:/# root@Omega-3079:/# root@Omega-3079:/# root@Omega-3079:/# curl -d '{"jsonrpc": "2.0", "id": 1, "method": "call", "param s": ["213ac1e069ca85b390c70570a6a58197", "uci", "delete", {"config": "wireless", "type": "wifi-config", "values": {"ssid": "ZyXEL_GIGA_III" } }] }' http://local host/ubus {"jsonrpc":"2.0","id":1,"result":[0]}root@Omega-3079:/# root@Omega-3079:/# root@Omega-3079:/# curl -d '{"jsonrpc": "2.0", "id": 1, "method": "call", "param s": ["213ac1e069ca85b390c70570a6a58197", "uci", "commit", {"config": "wireless"} ]}' http://localhost/ubus {"jsonrpc":"2.0","id":1,"result":[0]}root@Omega-3079:/# root@Omega-3079:/# curl -d '{"jsonrpc": "2.0", "id": 1, "method": "call", "param s": ["213ac1e069ca85b390c70570a6a58197", "network", "restart", {}]}' http://loca lhost/ubus [ 916.850259] br-wlan: port 1(ra0) entered disabled state [ 916.869218] device ra0 left promiscuous mode [ 916.873758] br-wlan: port 1(ra0) entered disabled state [ 916.922481] br-wlan: port 1(ra0) entered blocking state [ 916.927796] br-wlan: port 1(ra0) entered disabled state [ 916.933541] device ra0 entered promiscuous mode [ 916.977410] br-wlan: port 1(ra0) entered blocking state [ 916.982786] br-wlan: port 1(ra0) entered forwarding state {"jsonrpc":"2.0","id":1,"result":[0]}root@Omega-3079:/# root@Omega-3079:/# [ 928.118990] br-wlan: port 1(ra0) entered disabled state [ 928.132213] device ra0 left promiscuous mode [ 928.136762] br-wlan: port 1(ra0) entered disabled state [ 928.220242] IPv6: ADDRCONF(NETDEV_UP): br-wlan: link is not ready [ 935.131816] br-wlan: port 1(ra0) entered blocking state [ 935.137170] br-wlan: port 1(ra0) entered disabled state [ 935.142880] device ra0 entered promiscuous mode [ 935.147650] br-wlan: port 1(ra0) entered blocking state [ 935.153001] br-wlan: port 1(ra0) entered forwarding state [ 935.159845] IPv6: ADDRCONF(NETDEV_CHANGE): br-wlan: link becomes ready root@Omega-3079:/# curl -d '{"jsonrpc": "2.0", "id": 1, "method": "call", "param s": ["213ac1e069ca85b390c70570a6a58197", "network", "stop", {}]}' http://localho st/ubus {"jsonrpc":"2.0","id":1,"result":[3]}root@Omega-3079:/# root@Omega-3079:/# curl -d '{"jsonrpc": "2.0", "id": 1, "method": "call", "param s": ["213ac1e069ca85b390c70570a6a58197", "network", "start", {}]}' http://localh ost/ubus {"jsonrpc":"2.0","id":1,"result":[3]}root@Omega-3079:/# root@Omega-3079:/#
My router is ZyXEL Keenetic GIGA 3
-
RE: Omega2+ Wifi API
@crispyoz said in Omega2+ Wifi API:
@Pavel-Negrobov please post the JSON response for the restart command. If it is returning 0 ie success, instead send network stop, pause 10 seconds, then send network start. I have seen similar issue on non-omega device where connection is maintained despite network restart when connecting to Netgear router.
Restart:
/# curl -d '{"jsonrpc": "2.0", "id": 1, "method": "call", "param s": ["932408e95d88194879428f3b5c75ba68", "network", "restart", {}]}' http://loca lhost/ubus {"jsonrpc":"2.0","id":1,"result":[0]}
but network stop and network start both returns {"jsonrpc":"2.0","id":1,"result":[3]} and happens nothing.
But thank you for the previous help. Login, scan and AP add (connect) works correctly.
@György-Farkas said in Omega2+ Wifi API:
@Pavel-Negrobov If your Omega2 is running one of recent official firmwares (ie. Onion Warp Core is its WiFi driver) and connected to a WiFi network then
- disconnect from that WiFi network:
uci set wireless.sta.disabled='1'; uci commit wireless; wifi
- (re)connect to that WiFi network:
uci set wireless.sta.disabled='0'; uci commit wireless; wifi
Thanks. These commands are help, omega disconnects from AP after that.
- disconnect from that WiFi network: