I have an IMX8MP board running a Yocto Poky build image. It's running a small HTTP server in order for a user to input an SSID_NAME and a PASSPHRASE. Once the server receives those, I want to connect to the Wi-Fi that the user inputs. I tried creating the file in /var/lib/connman/wifi_XXXXX_YYYYY_managed_psk/settings. The content of the file is:
[wifi_XXXXX_YYYYY_managed_psk]
SSID=YYYYY
Name=SSID_NAME
Passphrase=PASSPHRASE
AutoConnect=true
However, I get an error when I try to connect by doing connmanctl connect wifi_XXXXX_YYYYY_managed_psk:
Error /net/connman/service/wifi_XXXXX_YYYYY_managed_psk: Not registered
The reason why I'm creating the file and then executing the connect command, is because the connmanctl connect wifi_XXXXX_YYYYY_managed_psk asks for a Passphrase, and I don't know how to pass it with a script.
This is the script I'm using to connect
#!/bin/sh
NAME=$1
PASSWORD=$2
mac=$(ifconfig wlan0 | grep ether | awk '{print $2}' | sed 's/://g')
connmanctl scan wifi
# Match the wifi network with the given NAME and mac address
ssid=$(connmanctl services | grep -E "^\s*$NAME\s+wifi_$mac" | grep -o 'wifi_[0-9a-fA-F]*_[0-9a-fA-F]*_managed_psk')
path=/var/lib/connman/$ssid
echo "Setting up configuration for wifi network $NAME, $mac, $ssid"
mkdir -p $path
configuration_file=$path/settings
touch $configuration_file
cat >$configuration_file <<_EOF
[$ssid]
SSID=$ssid
Name=$NAME
Passphrase=$PASSWORD
AutoConnect=true
_EOF
connmanctl config $ssid
connmanctl connect $ssid
exit 0
I also tried using connmanctl config wifi_XXXXX_YYYYY_managed_psk --passphrase PASSPHRASE instead of creating the file. Got the exact same error.
Hi @dvega!
Thank you for contacting NXP Support!
What board are yiou using?
What wifi mofule are you using?
You can refer to our LINUX USERS GUIDE on chapter 11 we provide the correct steps to connect the wifi module using connman.
Best Regards!
Chavira
I'm using an Axon Wizard IMX8MP it uses the "ar6k_wlan" driver. It seems that the wifi device is a "Qualcomm Atheros QCA9377 802.11 a/b/g/n/ac + Bluetooth". The script I created is based on the docs you sent. One thing to note here is: The final user of this board will not have access to the console. It will have only a web portal. One thing to note. If I manually execute the commands described in the docs. The board actually connects. Once connected if I reboot I only need to execute connmanctl config wifi_XXXXX_YYYYY_managed_psk and it will connect no problem. That's how I though about creating the files and then execute the connect command. However I get that error and I'm not sure how to fix it.
Hi @dvega!
Unfortunately we don't have the wifi module available to replicate the issue by our side.
Also you are using a development board that we don't provide the OS for that board.
For this case I recomend contacting TechNexion Support to get the proper steps for your board.
Best Regards!
Chavira