Page 1 of 1

Configure WIFI module as AP for 60 seconds, and then switch to STA

Posted: 2025-01-27 9:33
by keens312@hotmail.com
Hi team,
How can my application configure the Ulatra W's WIFI module as AP for a period of time, and then switch to STA?
Can these operations be done by the application or scripts.

Re: Configure WIFI module as AP for 60 seconds, and then switch to STA

Posted: 2025-02-05 3:55
by Ryand
This idea is feasible.
1.You can create a separate configuration file, such as/etc/wpa_supplementant.ap.conf,with the following content:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant
ap_scan=1

network={
    ssid="YourAPSSID"
    mode=2
    frequency=2412
    key_mgmt=NONE
}
Here mode=2 means creating an AP, frequency=2412 means the frequency is 2.4G.
2.Reference link https://wiki.luckfox.com/zh/Luckfox-Pic ... E%A5-wifi.,modify the WiFi configuration file in/etc/wpa_supplicant.conf.
3.Write shell file:

Code: Select all

killall -9 wpa_supplicant 
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant_ap.conf
sleep 60
killall -9 wpa_supplicant 
killall -9 wpa_supplicant 
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf 
udhcpc -i wlan0