connmanctl Wi-Fi automation

We are upgrading our product from the BeagleBone Black to BeagleBone Black Wireless and have had a really tough with automating a connection using connmanctl. In our current product’s commissioning process, a customer logs into their BB via either USB or AP mode (which is hosting a wifi configuration page) and is able to enter their Wi-Fi SSID/password which is then passed onto a script to establish a connection with their network. The original implementation simply modified the /etc/network/interfaces file and with ifup/ifdown established a connection with their wireless network. However, we have had zero luck automating this connection using connmanctl as it launches an interactive shell which makes it impossible for scripts to enter user passwords. Any thoughts??

Started investigating /var/lib/connman/settings today but was hoping someone had success with this. Would hate to revert to our old method by uninstalling connmanctl… Thanks.

2 options:

You don't need to use the connman interactive shell, all connections
are stored under:

/var/lib/connman/

debian@bbgw-pwr15-ser23:~$ sudo cat
/var/lib/connman/wifi_209148c9516a_584131302d576946692d5831_managed_psk/settings
[wifi_209148c9516a_584131302d576946692d5831_managed_psk]
Name=XA10-WiFi-X1
SSID=584131302d576946692d5831
Frequency=2412
Favorite=true
AutoConnect=true
Modified=2020-04-16T19:16:41.218495Z
Passphrase=******
IPv4.method=dhcp
IPv4.DHCP.LastAddress=192.168.1.155
IPv6.method=auto
IPv6.privacy=disabled

2nd, you don't "have" to use connman, we just use it by default it as
it works pretty decent for out of box..

sudo apt remove connman --purge

Then go back to /etc/network/interfaces...

Regards,

The other option is to use connmanctl via command line in your scripts:

 $connmanctl config <service> --ipv4 manual <ip address> <netmask> <gateway>

https://www.mankier.com/1/connmanctl

http://variwiki.com/index.php?title=Static_IP_Address

Cheers,

Jon

Thank you Robert and Jon. Will test those methods tomorrow.

Regards,

Rob