[Feature][T8TSK-202][wifi] wifi6.so add support for with/without connman
Change-Id: Ie737adb2d4a0ca567b149d36184d7b3786b60aaf
diff --git a/src/lynq/lib/liblynq-wifi6/scripts/get_interface_name.sh b/src/lynq/lib/liblynq-wifi6/scripts/get_interface_name.sh
new file mode 100755
index 0000000..4dc8717
--- /dev/null
+++ b/src/lynq/lib/liblynq-wifi6/scripts/get_interface_name.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ "$1" == "0" ]; then
+ echo "wlan0"
+elif [ "$1" == "1" ]; then
+ echo "ap0"
+else
+ exit 1
+fi
+
diff --git a/src/lynq/lib/liblynq-wifi6/scripts/sta_status_change.sh b/src/lynq/lib/liblynq-wifi6/scripts/sta_status_change.sh
new file mode 100755
index 0000000..829303e
--- /dev/null
+++ b/src/lynq/lib/liblynq-wifi6/scripts/sta_status_change.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+
diff --git a/src/lynq/lib/liblynq-wifi6/scripts/start_stop_ap.sh b/src/lynq/lib/liblynq-wifi6/scripts/start_stop_ap.sh
new file mode 100755
index 0000000..25dd644
--- /dev/null
+++ b/src/lynq/lib/liblynq-wifi6/scripts/start_stop_ap.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+if [ "$1" == "start" ]; then
+ ifconfig ap0 192.168.15.1 netmask 255.255.255.240
+
+ if [ $? != 0 ]; then
+ exit 1
+ fi
+ mkdir -p /run/wg870/dnsmasq.d
+ conf_file="/run/wg870/dnsmasq.conf"
+ echo "port=0" > $conf_file
+ echo "interface=ap0" >> $conf_file
+ echo "listen-address=192.168.15.1" >> $conf_file
+ echo "bind-interfaces" >> $conf_file
+ echo "localise-queries" >> $conf_file
+ echo "dhcp-range=192.168.15.2,192.168.15.14,255.255.255.240,1h" >> $conf_file
+ echo "dhcp-option=3,192.168.15.1" >> $conf_file
+ echo "dhcp-option=6,192.168.15.1" >> $conf_file
+ echo "dhcp-range=192.168.15.2,192.168.15.14,255.255.255.240,1h" >> $conf_file
+ echo "dhcp-leasefile=/run/wg870/ap0.lease" >> $conf_file
+ ps -eo "%p %a" | grep "/usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid" | grep -v grep
+ if [ $? != 0 ]; then
+ /usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid -7 /run/wg870/dnsmasq.d --local-service -C $conf_file -r /run/wg870
+ fi
+
+elif [ "$1" == "stop" ]; then
+ ps -eo "%p %a" | grep "/usr/bin/dnsmasq -x /run/wg870/dnsmasq.pid" | grep -v grep | awk '{print "kill "$1}' | sh
+ ifconfig ap0 down
+ if [ $? != 0 ]; then
+ exit 1
+ fi
+else
+ exit 2
+fi
+
+exit 0
diff --git a/src/lynq/lib/liblynq-wifi6/scripts/start_stop_sta.sh b/src/lynq/lib/liblynq-wifi6/scripts/start_stop_sta.sh
new file mode 100755
index 0000000..25ab126
--- /dev/null
+++ b/src/lynq/lib/liblynq-wifi6/scripts/start_stop_sta.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+if [ "$1" == "start" ]; then
+ ifconfig wlan0 up
+ if [ $? != 0 ]; then
+ exit 1
+ fi
+ ps -eo "%p %a" | grep "dhcpcd wlan0" | grep -v grep
+ if [ $? != 0 ]; then
+ echo "" > /tmp/wlan0_dhcpcd_router
+ mkdir -p /run/wg870/
+ hook_script="/run/wg870/wlan0_dhcpcd_run_hooks.sh"
+ echo "#!/bin/sh" > $hook_script
+ echo "if [ \"\$reason\" == \"BOUND\" -o \"\$reason\" == \"RENEW\" -o \"\$reason\" == \"REBIND\" ]; then" >> $hook_script
+ echo " if [ \"\$new_routers\" != \"\" ]; then" >> $hook_script
+ echo " for x in \$new_routers; do" >> $hook_script
+ echo " echo \"new_router \$x\" > /tmp/wlan0_dhcpcd_router" >> $hook_script
+ echo " ping -c2 \$x &" >> $hook_script
+ echo " done" >> $hook_script
+ echo " fi" >> $hook_script
+ echo "fi" >> $hook_script
+ chmod +x $hook_script
+ dhcpcd wlan0 -t 0 -o domain_name_servers --noipv4ll -4 -B -G -c $hook_script &
+ fi
+elif [ "$1" == "stop" ]; then
+ ps -eo "%p %a" | grep "dhcpcd wlan0" | grep -v grep | awk '{print "kill "$1}' | sh
+ ifconfig wlan0 0.0.0.0
+ if [ $? != 0 ]; then
+ exit 1
+ fi
+else
+ exit 2
+fi
+
+exit 0
diff --git a/src/lynq/lib/liblynq-wifi6/scripts/start_wg870_service.sh b/src/lynq/lib/liblynq-wifi6/scripts/start_wg870_service.sh
new file mode 100755
index 0000000..fae9b34
--- /dev/null
+++ b/src/lynq/lib/liblynq-wifi6/scripts/start_wg870_service.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+for ((i=0; i < 10; i++)); do
+ state=`systemctl is-active wg870_drv_insmod.service`
+ if [ "$state" == "active" ]; then
+ break
+ elif [ "$state" != "activating" ]; then
+ echo "to start now"
+ systemctl start wg870_drv_insmod.service
+ fi
+ usleep 100000
+done
+
+if [ "$state" != "active" ]; then
+ exit 1
+fi
+
+state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ ping`
+if [ "$state" != "PONG" ]; then
+ for ((i=0; i < 50; i++)); do
+ usleep 100000
+ state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ ping`
+ echo "$state"
+ if [ "$state" == "PONG" ]; then
+ service_started=1
+ break
+ fi
+ done
+else
+ service_started=1
+fi
+
+if [ "$service_started" != "1" ];then
+ exit 1
+fi
+
+state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ interface | grep -vE "Available|p2p-dev" | grep wlan0`
+if [ $? != 0 ]; then
+ state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ interface_add wlan0 /data/wifi/wg870/wpa_supplicant.conf nl80211`
+ if [ "$state" != "OK" ]; then
+ exit 2
+ fi
+ wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 disconnect
+fi
+
+state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ interface | grep -vE "Available|p2p-dev" | grep ap0`
+if [ $? != 0 ]; then
+ wpa_cli -iwpa_wlan0_cmd -p/var/run/ IFNAME=wlan0 DRIVER interface_create ap0
+ state=`wpa_cli -iwpa_wlan0_cmd -p/var/run/ interface_add ap0 /data/wifi/wg870/wpa_supplicant_ap.conf nl80211`
+
+ if [ "$state" != "OK" ]; then
+ exit 3
+ fi
+ ifconfig ap0 down
+fi
+
+
+exit 0
+