WLAN autoconfiguration through wpa_supplicant and mdev rules
This commit is contained in:
@@ -6,4 +6,7 @@
|
||||
/etc/ssh/ssh_host_rsa_key f 600 0 0 - - - - -
|
||||
|
||||
#rtl8821cu usb modeswitch script
|
||||
/lib/mdev/rtl8821cu_usb_modeswitch.sh f 755 0 0 - - - - -
|
||||
/lib/mdev/rtl8821cu_usb_modeswitch.sh f 755 0 0 - - - - -
|
||||
|
||||
# WLAN setup
|
||||
/lib/mdev/wlan_setup.sh f 755 0 0 - - - - -
|
||||
@@ -21,3 +21,17 @@
|
||||
# Add usb_modeswitch mdev rule
|
||||
grep -q "usb_modeswitch" "$TARGET_DIR/etc/mdev.conf" || \
|
||||
echo '$PRODUCT=bda/1a2b.* root:root 0660 */lib/mdev/rtl8821cu_usb_modeswitch.sh' >> "$TARGET_DIR/etc/mdev.conf"
|
||||
|
||||
# Add wlan_setup mdev rule
|
||||
grep -q "wlan_setup" "$TARGET_DIR/etc/mdev.conf" || \
|
||||
echo '$PRODUCT=bda/c820.* root:root 0660 */lib/mdev/wlan_setup.sh' >> "$TARGET_DIR/etc/mdev.conf"
|
||||
|
||||
# Add wlan0 configuration
|
||||
grep -q "iface wlan0" "$TARGET_DIR/etc/network/interfaces" || \
|
||||
cat >> "$TARGET_DIR/etc/network/interfaces" << 'EOF'
|
||||
|
||||
auto wlan0
|
||||
iface wlan0 inet dhcp
|
||||
pre-up ip link set wlan0 up
|
||||
pre-up wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
|
||||
EOF
|
||||
4
board/raspberrypi/rootfs-overlay/etc/wpa_supplicant.conf
Normal file
4
board/raspberrypi/rootfs-overlay/etc/wpa_supplicant.conf
Normal file
@@ -0,0 +1,4 @@
|
||||
network={
|
||||
ssid="Gabriel_2G"
|
||||
psk="gabrielwifi"
|
||||
}
|
||||
13
board/raspberrypi/rootfs-overlay/lib/mdev/wlan_setup.sh
Normal file
13
board/raspberrypi/rootfs-overlay/lib/mdev/wlan_setup.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
case "$ACTION" in
|
||||
add)
|
||||
[ -e /sys/class/net/wlan0 ] || exit 0
|
||||
ifdown wlan0 2>/dev/null
|
||||
killall wpa_supplicant 2>/dev/null
|
||||
ifup wlan0
|
||||
;;
|
||||
remove)
|
||||
ifdown wlan0 2>/dev/null
|
||||
killall wpa_supplicant 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user