mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-07-12 18:19:42 -07:00
wifi: robust dongle connects and visible feedback while connecting
Bug report 1: an Edimax USB dongle sees the network but the connect fails with a generic error (works on dArkOS). Bug report 4: pressing B after typing the passphrase looks like a freeze while the console is silently trying to connect. wifictl: scan until the target SSID actually shows up in iwd's results (up to 12s) instead of a fixed 2s sleep; slow USB dongles were reaching iwctl connect before the network existed in the scan cache, which fails immediately. Extend the association wait from 15s to 30s and log the real iwctl connect output plus the outcome to /var/log/wifictl.log so failures (wrong passphrase, WPA1/TKIP networks that iwd does not support, timeouts) stop being an indistinguishable "network error". emulationstation: bump to 8a257e1fa, which wraps both WiFi connect call sites in a GuiLoading busy spinner instead of blocking the UI thread. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -119,15 +119,35 @@ connect_wifi() {
|
||||
printf '[Security]\n' > "${IWD_DIR}/${IWD_NAME}.open"
|
||||
fi
|
||||
|
||||
# Scan and connect
|
||||
iwctl station ${WIFI_DEV} scan 2>/dev/null
|
||||
sleep 2
|
||||
iwctl station ${WIFI_DEV} connect "${SSID}" 2>/dev/null
|
||||
# Scan até o SSID aparecer na lista do iwd. O sleep fixo de 2s falhava
|
||||
# em dongles USB lentos (o iwctl connect retorna "network not found" se
|
||||
# a rede ainda não está nos resultados de scan) e o usuário via só um
|
||||
# "network error" genérico no ES. Até ~12s de scan antes de desistir;
|
||||
# tenta conectar mesmo assim (a rede pode ser oculta).
|
||||
SSID_SEEN=0
|
||||
for i in $(seq 1 6); do
|
||||
iwctl station ${WIFI_DEV} scan 2>/dev/null
|
||||
sleep 2
|
||||
if /usr/bin/iwd_get-networks 2>/dev/null | grep -qF "${SSID}"; then
|
||||
SSID_SEEN=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Loga a saída real do iwctl connect: é a única evidência de POR QUE a
|
||||
# associação falhou (senha errada, rede WPA1/TKIP sem suporte no iwd,
|
||||
# timeout...). Sem isso todo erro vira "network error" indistinguível.
|
||||
CONNECT_LOG="/var/log/wifictl.log"
|
||||
{
|
||||
echo "== $(date '+%F %T') connect ssid='${SSID}' dev=${WIFI_DEV} seen_in_scan=${SSID_SEEN}"
|
||||
iwctl station ${WIFI_DEV} connect "${SSID}" 2>&1
|
||||
} >> "${CONNECT_LOG}"
|
||||
|
||||
# Wait for connection. O "state=connected" sozinho não basta: se a
|
||||
# estação já estava em outra rede o teste retornaria sucesso falso.
|
||||
# Comparar também o "Connected network" com o SSID solicitado.
|
||||
for i in $(seq 1 15); do
|
||||
# Comparar também o "Connected network" com o SSID solicitado. 30s:
|
||||
# dongles lentos levam mais que os 15s antigos para associar + 4-way.
|
||||
for i in $(seq 1 30); do
|
||||
SHOW=$(iwctl station ${WIFI_DEV} show 2>/dev/null)
|
||||
STATE=$(printf '%s\n' "${SHOW}" | awk '/^[[:space:]]*State[[:space:]]/ {print $NF}')
|
||||
NET=$(printf '%s\n' "${SHOW}" | sed -n 's/^[[:space:]]*Connected network[[:space:]]*//p')
|
||||
@@ -135,10 +155,12 @@ connect_wifi() {
|
||||
NET="${NET#"${NET%%[![:space:]]*}"}"
|
||||
NET="${NET%"${NET##*[![:space:]]}"}"
|
||||
if [ "${STATE}" = "connected" ] && [ "${NET}" = "${SSID}" ]; then
|
||||
echo "== $(date '+%F %T') connected to '${SSID}'" >> "${CONNECT_LOG}"
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
echo "== $(date '+%F %T') FAILED to connect to '${SSID}' (state=${STATE:-?})" >> "${CONNECT_LOG}"
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Copyright (C) 2026 ArchR (https://github.com/archr-linux/Arch-R)
|
||||
|
||||
PKG_NAME="emulationstation"
|
||||
PKG_VERSION="715ea4b6f659c6041370930964f459fe50f65a58"
|
||||
PKG_VERSION="8a257e1fa996c40f29c7ddfb7d0a913bfd814748"
|
||||
PKG_GIT_CLONE_BRANCH="master"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="https://github.com/archr-linux/emulationstation-next"
|
||||
|
||||
Reference in New Issue
Block a user