mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 12:33:02 +02:00
udev: Rename all wlan interfaces wifiN and start scanning
This since the feature is called 'wifi' in Infix, this makes the naming consistent over the system. Also trigger start of a wpa_supplicant, for scanning in the background. The scanning results is available operational.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
SUBSYSTEM=="net", ACTION=="add", TEST=="/sys/class/net/$name/wireless", NAME="wifi%n"
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -e "/etc/wpa-supplicant-${INTERFACE}.conf" ]; then
|
||||
cat <<EOF > /etc/wpa-supplicant-${INTERFACE}.conf
|
||||
ctrl_interface=/run/wpa_supplicant
|
||||
update_config=0
|
||||
autoscan=periodic:10
|
||||
disable_scan_offload=1
|
||||
ap_scan=1
|
||||
# Empty network block to enable scanning without connecting
|
||||
bgscan="simple: 30:-45:300"
|
||||
|
||||
EOF
|
||||
cat <<EOF > /etc/finit.d/available/wpa-supplicant-${INTERFACE}.conf
|
||||
# Generated by Infix wifi interface detected
|
||||
service <!> name:wpa_supplicant :${INTERFACE} <> \
|
||||
[2345] wpa_supplicant -s -i ${INTERFACE} -c /etc/wpa-supplicant-${INTERFACE}.conf \
|
||||
-- WPA supplicant @${INTERFACE} (scanning only)
|
||||
|
||||
EOF
|
||||
initctl -bfqn enable wpa-supplicant-${INTERFACE}
|
||||
initctl reload
|
||||
TIMEOUT=300
|
||||
status=$(wpa_cli -i ${INTERFACE} scan)
|
||||
while [ "$status" != "OK" ]; do
|
||||
status=$(wpa_cli -i ${INTERFACE} scan)
|
||||
TIMEOUT=$((TIMEOUT-1))
|
||||
[ $TIMEOUT -eq 0 ] && logger -t wifi-detect "Failed to start scanning on $INTERFACE" && break
|
||||
sleep 0.5
|
||||
done
|
||||
fi
|
||||
Reference in New Issue
Block a user