Unable to connect open Wi-Fi #105

Open
opened 2025-10-16 23:26:03 -04:00 by Kinthur · 0 comments
Kinthur commented 2025-10-16 23:26:03 -04:00 (Migrated from github.com)

I found in "buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30wifi", the current Wi-Fi setup logic uses wpa_passphrase to generate the network block. However, wpa_passphrase requires a password and cannot be used for open Wi-Fi networks.
As a result, if a user tries to connect to an open SSID (where pass is empty), the script skips configuration entirely, and the device cannot connect.

start() {
	if [ -e /boot/wifi.sta ]
	then
		echo "wifi mode: sta"
		if [ -e /boot/wpa_supplicant.conf ]
		then
			cp /boot/wpa_supplicant.conf /etc/wpa_supplicant.conf
		else
			ssid=""
			pass=""
			if [ -e /boot/wifi.ssid ]
			then
				echo -n "ssid: "
				cat /boot/wifi.ssid
				ssid=`cat /boot/wifi.ssid`
			fi
			if [ -e /boot/wifi.pass ]
			then
				echo -n "wifi.pass: "
				cat /boot/wifi.pass
				pass=`cat /boot/wifi.pass`
			fi
			if [ ! -z "${ssid}${pass}" ]
			then
				echo "ctrl_interface=/var/run/wpa_supplicant" > /etc/wpa_supplicant.conf
				wpa_passphrase "$ssid" "$pass" >> /etc/wpa_supplicant.conf
			fi

Therefore, the following changes may be needed:

start() {
	if [ -e /boot/wifi.sta ]
	then
		echo "wifi mode: sta"
		if [ -e /boot/wpa_supplicant.conf ]
		then
			cp /boot/wpa_supplicant.conf /etc/wpa_supplicant.conf
		else
			ssid=""
			pass=""
			if [ -e /boot/wifi.ssid ]
			then
				echo -n "ssid: "
				cat /boot/wifi.ssid
				ssid=`cat /boot/wifi.ssid`
			fi
			if [ -e /boot/wifi.pass ]
			then
				echo -n "wifi.pass: "
				cat /boot/wifi.pass
				pass=`cat /boot/wifi.pass`
			fi
			if [ ! -z "${ssid}${pass}" ]
			# then
			# 	echo "ctrl_interface=/var/run/wpa_supplicant" > /etc/wpa_supplicant.conf
			# 	wpa_passphrase "$ssid" "$pass" >> /etc/wpa_supplicant.conf
			# fi
			# Generate network block manually
			if [ ! -z "${ssid}" ]; then
				echo "ctrl_interface=/var/run/wpa_supplicant" > /etc/wpa_supplicant.conf
				if [ ! -z "${pass}" ]; then
					wpa_passphrase "$ssid" "$pass" >> /etc/wpa_supplicant.conf
				else
					echo "network={" >> /etc/wpa_supplicant.conf
					echo "    ssid=\"${ssid}\"" >> /etc/wpa_supplicant.conf
					echo "    key_mgmt=NONE" >> /etc/wpa_supplicant.conf
					echo "}" >> /etc/wpa_supplicant.conf
				fi
			fi
		fi
I found in "buildroot/board/cvitek/SG200X/overlay/etc/init.d/S30wifi", the current Wi-Fi setup logic uses wpa_passphrase to generate the network block. However, wpa_passphrase requires a password and cannot be used for open Wi-Fi networks. As a result, if a user tries to connect to an open SSID (where pass is empty), the script skips configuration entirely, and the device cannot connect. ``` start() { if [ -e /boot/wifi.sta ] then echo "wifi mode: sta" if [ -e /boot/wpa_supplicant.conf ] then cp /boot/wpa_supplicant.conf /etc/wpa_supplicant.conf else ssid="" pass="" if [ -e /boot/wifi.ssid ] then echo -n "ssid: " cat /boot/wifi.ssid ssid=`cat /boot/wifi.ssid` fi if [ -e /boot/wifi.pass ] then echo -n "wifi.pass: " cat /boot/wifi.pass pass=`cat /boot/wifi.pass` fi if [ ! -z "${ssid}${pass}" ] then echo "ctrl_interface=/var/run/wpa_supplicant" > /etc/wpa_supplicant.conf wpa_passphrase "$ssid" "$pass" >> /etc/wpa_supplicant.conf fi ``` Therefore, the following changes may be needed: ``` start() { if [ -e /boot/wifi.sta ] then echo "wifi mode: sta" if [ -e /boot/wpa_supplicant.conf ] then cp /boot/wpa_supplicant.conf /etc/wpa_supplicant.conf else ssid="" pass="" if [ -e /boot/wifi.ssid ] then echo -n "ssid: " cat /boot/wifi.ssid ssid=`cat /boot/wifi.ssid` fi if [ -e /boot/wifi.pass ] then echo -n "wifi.pass: " cat /boot/wifi.pass pass=`cat /boot/wifi.pass` fi if [ ! -z "${ssid}${pass}" ] # then # echo "ctrl_interface=/var/run/wpa_supplicant" > /etc/wpa_supplicant.conf # wpa_passphrase "$ssid" "$pass" >> /etc/wpa_supplicant.conf # fi # Generate network block manually if [ ! -z "${ssid}" ]; then echo "ctrl_interface=/var/run/wpa_supplicant" > /etc/wpa_supplicant.conf if [ ! -z "${pass}" ]; then wpa_passphrase "$ssid" "$pass" >> /etc/wpa_supplicant.conf else echo "network={" >> /etc/wpa_supplicant.conf echo " ssid=\"${ssid}\"" >> /etc/wpa_supplicant.conf echo " key_mgmt=NONE" >> /etc/wpa_supplicant.conf echo "}" >> /etc/wpa_supplicant.conf fi fi fi ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
maxpeterkaya/LicheeRV-Nano-Build#105
No description provided.