Browse Source

interface type for wifi adapter search

Bob Mottram 7 years ago
parent
commit
cd2af02c11
3 changed files with 15 additions and 8 deletions
  1. 4
    2
      src/freedombone-mesh-batman
  2. 10
    5
      src/freedombone-utils-wifi
  3. 1
    1
      src/freedombone-wifi

+ 4
- 2
src/freedombone-mesh-batman View File

@@ -34,11 +34,13 @@ COMPLETION_FILE="/root/${PROJECT_NAME}-completed.txt"
34 34
 # hotspot passphrase must be 5 characters or longer
35 35
 HOTSPOT_PASSPHRASE="${PROJECT_NAME}"
36 36
 
37
+interface_type='wlan'
38
+
37 39
 source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-wifi
38 40
 source /usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-mesh
39 41
 
40 42
 mesh_protocol_init
41
-update_wifi_adaptors
43
+update_wifi_adaptors "${interface_type}"
42 44
 
43 45
 if [ ! "$IFACE" ]; then
44 46
     echo $'No wlan adaptor'
@@ -168,7 +170,7 @@ function add_wifi_interface {
168 170
 
169 171
 # shellcheck disable=SC2120
170 172
 function start {
171
-    update_wifi_adaptors
173
+    update_wifi_adaptors "${interface_type}"
172 174
 
173 175
     if [ -z "$IFACE" ] ; then
174 176
         echo 'error: unable to find wifi interface, not enabling batman-adv mesh'

+ 10
- 5
src/freedombone-utils-wifi View File

@@ -100,7 +100,7 @@ function setup_wifi_atheros {
100 100
     fi
101 101
     dpkg -i "$atheros_drivers_file"
102 102
     reset_usb_devices
103
-    update_wifi_adaptors
103
+    update_wifi_adaptors 'wlan'
104 104
     if [ "$IFACE" ]; then
105 105
         wpa_action "${IFACE}" stop
106 106
         wpa_cli -i "${IFACE}" terminate
@@ -198,19 +198,24 @@ function install_atheros_wifi {
198 198
 }
199 199
 
200 200
 function update_wifi_adaptors {
201
+    interface_type="$1"
201 202
     IFACE=
202 203
     IFACE_SECONDARY=
203 204
 
205
+    if [ ! "$interface_type" ]; then
206
+        interface_type='wlan'
207
+    fi
208
+
204 209
     for i in $(seq 10 -1 0); do
205
-        ifdown --force "wlan${i}" 2> /dev/null
210
+        ifdown --force "${interface_type}${i}" 2> /dev/null
206 211
     done
207 212
 
208 213
     for i in $(seq 10 -1 0); do
209
-        if grep -q "wlan${i}" /proc/net/dev; then
214
+        if grep -q "${interface_type}${i}" /proc/net/dev; then
210 215
             if [ ! $IFACE ]; then
211 216
                 IFACE="wlan${i}"
212 217
             else
213
-                IFACE_SECONDARY="wlan${i}"
218
+                IFACE_SECONDARY="${interface_type}${i}"
214 219
                 return
215 220
             fi
216 221
         fi
@@ -479,7 +484,7 @@ function wifi_networks_file_header {
479 484
 
480 485
 function create_networks_interactive {
481 486
     remove_config_param "WIFI_INTERFACE"
482
-    update_wifi_adaptors
487
+    update_wifi_adaptors 'wlan'
483 488
     if [ ! "$IFACE" ]; then
484 489
         # Don't try to configure wifi if there are no adaptors
485 490
         return

+ 1
- 1
src/freedombone-wifi View File

@@ -150,7 +150,7 @@ if [ ! ${wifi_interface_specified} ]; then
150 150
     else
151 151
         sleep "${WAIT_SEC}"
152 152
     fi
153
-    update_wifi_adaptors
153
+    update_wifi_adaptors 'wlan'
154 154
     if [ ! $IFACE ]; then
155 155
         echo $'No wifi adaptors were found'
156 156
         exit 872356