diff options
author | John Klug <john.klug@multitech.com> | 2019-02-27 16:46:41 -0600 |
---|---|---|
committer | John Klug <john.klug@multitech.com> | 2019-02-27 16:46:41 -0600 |
commit | c65694edb9733a3c5bb07a26b65565f6f3b61a5a (patch) | |
tree | b5e36135cc751fc7258e0aaa193b79d1708f32c6 | |
parent | 5de29c9f06cfa9f0fb9b84d6e4f23c85186743d9 (diff) | |
download | meta-multitech-atmel-c65694edb9733a3c5bb07a26b65565f6f3b61a5a.tar.gz meta-multitech-atmel-c65694edb9733a3c5bb07a26b65565f6f3b61a5a.tar.bz2 meta-multitech-atmel-c65694edb9733a3c5bb07a26b65565f6f3b61a5a.zip |
mLinux wl12xx functionality will be minimal, for testing and calibration only
-rw-r--r-- | recipes-bsp/wifiup/wifiup/wifi.init | 180 | ||||
-rw-r--r-- | recipes-bsp/wifiup/wifiup/wifi.modprobe | 3 | ||||
-rw-r--r-- | recipes-bsp/wifiup/wifiup_0.1.bb | 23 |
3 files changed, 0 insertions, 206 deletions
diff --git a/recipes-bsp/wifiup/wifiup/wifi.init b/recipes-bsp/wifiup/wifiup/wifi.init deleted file mode 100644 index 064a633..0000000 --- a/recipes-bsp/wifiup/wifiup/wifi.init +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/sh - -LOCK=/var/lock/wifi_lock -WIFI_AP_CONFIG_FILE="/var/run/hostapd.conf" -WIFI_CLIENT_CONFIG_FILE="/var/run/wpa_supplicant.conf" -WIFI_LOG_FILE="/var/log/wpa_supplicant.log" -UDHCPC_WIFIUP_SCRIPT="/etc/udhcpc.d/wifiup" -FACTORY_NVS_PATH="/lib/firmware/ti-connectivity/wl1271-nvs.bin.factory" -NVS_PATH="/var/oem/mts/wl1271-nvs.bin" - -if mkdir $LOCK; then - trap "rm -fr $LOCK" EXIT -else - echo "Wifi lock not acquired, resource in use" >&2 - exit 1 -fi - -cnt=$(ps -A | grep 'wifi$' | wc -l) - -function init() { - echo "initializing wifi chip" - - # install factory nvs file if necessary - if [[ ! -f $NVS_PATH ]]; then - echo "$NVS_PATH not found, using factory default" - mount -o remount,rw /var/oem - mkdir -p /var/oem/mts - cp $FACTORY_NVS_PATH $NVS_PATH - mount -o remount,ro /var/oem - fi - - # enable wifi chip - mts-io-sysfs store wlan-enabled 0 - usleep 50000 - mts-io-sysfs store wlan-enabled 1 - sleep 1 - # load atmel_mci module - lsmod | grep -q atmel_mci || { - modprobe atmel_mci && sleep 3 - } - - # led - ## INFO: code from scripts/led_ni_setup - echo "netdev" > /sys/class/leds/led-b/trigger - echo "wlan0" > /sys/class/leds/led-b/device_name - echo "link tx rx" > /sys/class/leds/led-b/mode -} - -function start() { - JSON=$(curl -m 5 -s 127.0.0.1/api?fields=wifi,lan,system/macAddress,system/mode) - - : ${WIFI_AP_ENABLED:='false'} - : ${WIFI_AP_MAC:='0F:0A:0C:0E:05:01'} - : ${WIFI_CLIENT_ENABLED:='true'} - : ${WIFI_CLIENT_MODE:='WAN'} - : ${SYSTEM_MODE:='STATION'} - - if [ "$SYSTEM_MODE" != "ROUTER" ]; then - echo "Can NOT configure WiFi Access Point or Client. System Mode: $SYSTEM_MODE" - exit 1 - fi - - if [ "$WIFI_AP_ENABLED" == "true" ] && [ "$WIFI_CLIENT_ENABLED" == "true" ]; then - echo "Can NOT enable both Wifi Access Point and Client at the same time" - exit 1 - fi - - if [ "$WIFI_AP_ENABLED" == "false" ] && [ "$WIFI_CLIENT_ENABLED" == "false" ]; then - echo "Wifi is disabled. Powering Down Wifi Chip" - stop - exit - fi - - init - - # Check to see if Wifi AP is enabled - # And that Wifi Client is not enabled - if [ "$WIFI_AP_ENABLED" == "true" ] && [ "$WIFI_CLIENT_ENABLED" == "false" ]; then - echo "WiFi AP enabled - Bringing up hostapd on wlan0" - # initialize hostapd config - wifi_ap_init - if [ -f $WIFI_AP_CONFIG_FILE ]; then - hostapd -B $WIFI_AP_CONFIG_FILE -P /var/run/hostapd_wlan0.pid - sleep 5 - ip link set br0 address $WIFI_AP_MAC - else - echo "Error generating $WIFI_AP_CONFIG_FILE" - exit 1 - fi - else - echo "WiFi AP is disabled" - fi - - # Check to see if Wifi Client is enabled - # And that Wifi AP is not enabled - if [ "$WIFI_CLIENT_ENABLED" == "true" ] && [ "$WIFI_AP_ENABLED" == "false" ]; then - echo "WiFi Client enabled - Configuring wlan0" - - # initialize wpasupplicant config - wifi_client_init - - ifconfig wlan0 up - - # Check to see if ap is designated - if [ -f $WIFI_CLIENT_CONFIG_FILE ]; then - echo "WiFi Client - Configuring wpa supplicant" - # syslog option is '-s', file option is '-f <path>' - wpa_supplicant -B -iwlan0 -Dnl80211 -c $WIFI_CLIENT_CONFIG_FILE -P /var/run/wpa_supplicant_wlan0.pid $ -s & - - sleep 10 - - if [ "$WIFI_CLIENT_MODE" == "WAN" ]; then - echo "WiFi Client - Starting DHCP client" - udhcpc -i wlan0 -s $UDHCPC_WIFIUP_SCRIPT -p /var/run/udhcpc_wlan0.pid > /dev/null 2>&1 & - elif [ "$WIFI_CLIENT_MODE" == "LAN" ]; then - echo "WiFi Client - Adding to bridge" - brctl addif br0 wlan0 - fi - sleep 2 - fi - else - echo "WiFi client is disabled" - fi -} - -function stop() { - echo -n "Shutting down wifi " - - if [ -f /var/run/wpa_supplicant_wlan0.pid ]; then - PID=$(cat /var/run/wpa_supplicant_wlan0.pid) - kill $PID > /dev/null 2>&1 - fi - if [ -f /var/run/udhcpc_wlan0.pid ]; then - PID=$(cat /var/run/udhcpc_wlan0.pid) - kill $PID > /dev/null 2>&1 - fi - if [ -f /var/run/hostapd_wlan0.pid ]; then - PID=$(cat /var/run/hostapd_wlan0.pid) - kill $PID > /dev/null 2>&1 - fi - - modprobe -r wl12xx > /dev/null 2>&1 - modprobe -r wlcore > /dev/null 2>&1 - modprobe -r wlcore_sdio > /dev/null 2>&1 - modprobe -r atmel_mci > /dev/null 2>&1 -} - -function scan() { - init - - # Ensure WLAN is up - ifconfig wlan0 up - # Scan - iw wlan0 scan -} - -case "$1" in - "start") - start - ;; - "stop") - stop - ;; - "restart") - ## Stop the service and regardless of whether it was - ## running or not, start it again. - echo "Restarting wifi" - stop - start - ;; - "scan") - scan - ;; - *) - ## If no parameters are given, print which are avaiable. - echo "Usage: $0 {start|stop|scan|restart}" - exit 1 - ;; -esac - diff --git a/recipes-bsp/wifiup/wifiup/wifi.modprobe b/recipes-bsp/wifiup/wifiup/wifi.modprobe deleted file mode 100644 index e1c3f52..0000000 --- a/recipes-bsp/wifiup/wifiup/wifi.modprobe +++ /dev/null @@ -1,3 +0,0 @@ -# Do not load the 'atmel_mci' module on boot. -# Loaded by /etc/init.d/wifi after wifi power switch on. -blacklist atmel_mci diff --git a/recipes-bsp/wifiup/wifiup_0.1.bb b/recipes-bsp/wifiup/wifiup_0.1.bb deleted file mode 100644 index 5c6003b..0000000 --- a/recipes-bsp/wifiup/wifiup_0.1.bb +++ /dev/null @@ -1,23 +0,0 @@ -DESCRIPTION = "Provides the Wifi init scripts" -SECTION = "init scripts" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" -# Was dependent on api -RDEPENDS_${PN} = "curl jsparser" -PR = "r4" - -inherit update-rc.d - -INITSCRIPT_NAME = "wifi" -INITSCRIPT_PARAMS = "defaults 73 27" - -SRC_URI += "file://wifi.init \ - file://wifi.modprobe " - -do_install_append() { - install -d ${D}/etc/init.d - install -m 0755 ${WORKDIR}/wifi.init ${D}/etc/init.d/wifi - - install -d ${D}/etc/modprobe.d - install -m 0644 ${WORKDIR}/wifi.modprobe ${D}/etc/modprobe.d/wifi.conf -} |