From b41d2250c5761ca69d383ecfea1cd95fb148ae61 Mon Sep 17 00:00:00 2001 From: Viktor <35473052+viktorxda@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:32:32 +0200 Subject: [PATCH] Overlay: update wireless-settings --- general/overlay/etc/init.d/S30wireless | 8 ++--- .../overlay/etc/network/interfaces.d/wlan0 | 6 ++-- general/overlay/etc/wireless | 36 ++++++++++++------- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/general/overlay/etc/init.d/S30wireless b/general/overlay/etc/init.d/S30wireless index 345c082c..e5acd7eb 100755 --- a/general/overlay/etc/init.d/S30wireless +++ b/general/overlay/etc/init.d/S30wireless @@ -3,10 +3,10 @@ device=$(fw_printenv -n wlandevice) if [ "$1" = "start" ] && [ ! -z "$device" ]; then if /etc/wireless "$device"; then - sed -i "s|^auto|#auto|g" /etc/network/interfaces.d/eth0 - sed -i "s|^#auto|auto|g" /etc/network/interfaces.d/wlan0 + sed -i "s/^auto/#auto/g" /etc/network/interfaces.d/eth0 + sed -i "s/^#auto/auto/g" /etc/network/interfaces.d/wlan0 else - sed -i "s|^#auto|auto|g" /etc/network/interfaces.d/eth0 - sed -i "s|^auto|#auto|g" /etc/network/interfaces.d/wlan0 + sed -i "s/^#auto/auto/g" /etc/network/interfaces.d/eth0 + sed -i "s/^auto/#auto/g" /etc/network/interfaces.d/wlan0 fi fi diff --git a/general/overlay/etc/network/interfaces.d/wlan0 b/general/overlay/etc/network/interfaces.d/wlan0 index 9faac3bb..ee60684a 100644 --- a/general/overlay/etc/network/interfaces.d/wlan0 +++ b/general/overlay/etc/network/interfaces.d/wlan0 @@ -1,6 +1,6 @@ #auto wlan0 iface wlan0 inet dhcp - post-up wpa_passphrase $(fw_printenv -n wlanssid || echo openipc) $(fw_printenv -n wlanpass || echo openipc12345) > /etc/wpa_supplicant.conf - post-up sed -i '2i \\tscan_ssid=1' /etc/wpa_supplicant.conf - post-up wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf + post-up wpa_passphrase "$(fw_printenv -n wlanssid || echo OpenIPC)" "$(fw_printenv -n wlanpass || echo OpenIPC12345)" > /tmp/wpa_supplicant.conf + post-up sed -i '2i \\tscan_ssid=1' /tmp/wpa_supplicant.conf + post-up wpa_supplicant -B -i wlan0 -D nl80211,wext -c /tmp/wpa_supplicant.conf post-down killall -q wpa_supplicant diff --git a/general/overlay/etc/wireless b/general/overlay/etc/wireless index 0c393d5e..05dea7a4 100755 --- a/general/overlay/etc/wireless +++ b/general/overlay/etc/wireless @@ -1,12 +1,16 @@ #!/bin/sh +set_gpio() { + echo $1 > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio$1/direction + echo $2 > /sys/class/gpio/gpio$1/value + sleep 1 +} + # HI3516EV300 CamHi if [ "$1" = "mt7601u-hi3516ev300-camhi" ]; then devmem 0x100C0080 32 0x530 - echo 7 > /sys/class/gpio/export - echo out > /sys/class/gpio/gpio7/direction - echo 0 > /sys/class/gpio/gpio7/value - sleep 1 + set_gpio 7 0 modprobe mt7601u exit 0 fi @@ -19,22 +23,30 @@ fi # SSC337DE Foscam if [ "$1" = "8188fu-ssc337de-foscam" ]; then - echo 15 > /sys/class/gpio/export - echo out > /sys/class/gpio/gpio15/direction - echo 0 > /sys/class/gpio/gpio15/value - sleep 1 + set_gpio 15 0 modprobe 8188fu exit 0 fi # T21 BJS if [ "$1" = "8188fu-t21-bjs" ]; then - echo 50 > /sys/class/gpio/export - echo out > /sys/class/gpio/gpio50/direction - echo 0 > /sys/class/gpio/gpio50/value - sleep 1 + set_gpio 50 0 modprobe 8188fu exit 0 fi +# T21 Smartwares +if [ "$1" = "8188fu-t21-smartwares" ]; then + set_gpio 49 1 + modprobe 8188fu + exit 0 +fi + +# T31 CamHi +if [ "$1" = "mt7601u-t31-camhi" ]; then + set_gpio 61 0 + modprobe mac80211 + exit 0 +fi + exit 1