Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several networks in wpa_supplicant #948

Open
ivanfor opened this issue Oct 12, 2024 · 7 comments
Open

Several networks in wpa_supplicant #948

ivanfor opened this issue Oct 12, 2024 · 7 comments
Labels

Comments

@ivanfor
Copy link

ivanfor commented Oct 12, 2024

Hi @roleoroleo.
Is it possible to add several networks to wpa_supplicant.conf file? I guess it's a temporary file created on boot.
I have several APs with the same SSID and I would like to establish priorities as the camera frequently connects to one with low signal quality.
Would it be possible?
Thanks in advance!

@roleoroleo
Copy link
Owner

wpa_supplicant.conf is created by Yi processes.
I don't know how and when it's created.
Sorry...

@ivanfor
Copy link
Author

ivanfor commented Oct 14, 2024

Thanks for the info.
Do YI processes have some sort of log file that can help hint how it is created?
Anyway, I guess it could be changed with startup.sh script. I'll try to investigate a bit, do some tests and share the results back here.

@roleoroleo
Copy link
Owner

Do YI processes have some sort of log file that can help hint how it is created?

Usually Yi processes print log to stdout.

@floronxt
Copy link

Maybe a secondary "/Factory/wpa_supplicant.conf" could help?

@ivanfor
Copy link
Author

ivanfor commented Oct 18, 2024

Hi.
I have finally done it by using the following script (done quickly and probably with mistakes) in startup.sh.
Maybe it can help somebody. Seems to be working so far ....

#!/bin/sh
CFG="/tmp/wpa_supplicant.conf"
bssid1="xx:xx:xx:xx:xx:xx"
cat $CFG | grep update_config >/dev/null || echo "update_config=1" >> $CFG
wpa_pid=$(ps | grep wpa_supplicant | grep -v grep | awk '{print $1}')
[ -z $wpa_pid ] && echo "Error al obtener el PID" && exit 1
kill -HUP $wpa_pid
sleep 5

cat << EOF | wpa_cli
remove_network 1
remove_network 2
remove_network 3
set_network 0 bssid $bssid1
set_network 0 priority 2
add_network
set_network 1 ssid "WiOT"
set_network 1 key_mgmt WPA-PSK
set_network 1 psk "password"
set_network 1 scan_ssid 1
set_network 1 priority 0
enable_network 1
save_config
EOF

@floronxt
Copy link

Brilliant, thank you so much for sharing! I've always wished for a function like this.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants