Hi,
So far we used wifi on Toradex iMX6 via the “connmanctrl” by manually set:
enable wifi
agent on
scan wifi
services
connect
However we need to predefine SSID and password to automatic wifi connection into the Linux Image build, so don’t have to do that manually after flash the Image to the board.
We tried by setting file of the “connamnctrl” to add new connection into the “/var/lib/connman” used previously from manual set.
Unfortunately “connmanctrl> enable wifi” and “connmanctrl> agent on” and rest of the manual setup is still needed.
How to add to Yocto Build configuration for “connmanctrl” with all predefined setup wifi enabled, agent on, wifi ssid and wifi password so after reflashing to automatically connect to desired wifi network?
I expect that adding a service file to the rootfs can do what you want.
Please check the following man page.
You probably have to inject additionally a /var/lib/connman/settings file which has wifi enabled. Otherwise on first invocation connman will create one for you with wifi disabled.
It works here. If I add the attached two files to /var/lib/connman/ a Wi-Fi connection gets established using SSID/password from the my_wifi.config file.
What is in your files?
How did you inject them into the rootfs?
What looks differently in your files?
I assume your HW works, i.e. Can you connect to Wi-Fi if you enable Wi-Fi manually with connmanctl?
As I understood you want to flash your image so that afterwards no manual steps to configure Wi-Fi for your SSID/Password use case are needed.
The folder /var/lib/connman/wifi_5cf3703febf1_64642d777274_managed_psk/ is created by connman once it sees your Wi-Fi NIC, not at image creation time. So no, my_wifi.config is not one of those files, it would rather be used by connman when those files are created.
So the idea is to put the two files into the rootfs (in …/var/lib/connman/) before you flash them onto the modul. To add the files you could either:
Use a recipe which adds the files when bitbaking the image
Add them to an unpacked legacy image in rootfs/…
Add the files to a Toradex Easy Installer Image by untaring the rootfs.tar.xz, adding and taring again. Make sure that you do that under root to preserve file permissions / owners …
If the settings file is present on first boot then WiFi will be enabled, otherwise connman will create its default settings file with Wi-Fi disabled.
If (with Wi-Fi enabled) connman detects a Wi-Fi NIC it will take your credentials from the *.config file present and then create for said NIC the “wifi_5cf3703febf1_64642d777274_managed_psk” folder with whatever other information it wants to preserve for said NIC.