I'm working on a Java project for the raspberry pi that requires some networking functionality. For this I use nmcli through a Process. However, I noticed that when trying to create a new connection (with a wrong password) sometimes the error message would be:
Error: No network with SSID <nameofSSID> found.
I tracked this down to the fact that if you call:
sudo iwlist wlan0 scanning
Shortly after trying to create a connection it will return:
wlan0 Interface doesn't support scanning : Device or resource busy
To solve this I figured I could just check if the device was busy before creating a new connection, however I have not been able to find the appropriate command.
The closest I could come was:
Sadly this is a mix of a number and text, but still requires minimal processing.