summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/8021x44
-rw-r--r--src/wireless44
2 files changed, 44 insertions, 44 deletions
diff --git a/src/8021x b/src/8021x
index fea7c39..0c3a8c2 100644
--- a/src/8021x
+++ b/src/8021x
@@ -50,6 +50,50 @@ stop_wpa()
fi
}
+# Return a filename containing a list of network APs and ESSIDs found (sorted by decreasing signal strength)
+# list_networks interface
+list_networks() {
+ wpa_supplicant_scan_info "$1" 1,5
+}
+
+wpa_supplicant_scan_info() {
+ local INTERFACE="$1" fields="$2" essids
+ # temp file used, as keeping ESSID's with spaces in their name in arrays
+ # is hard, obscure and kinda nasty. This is simpler and clearer.
+
+ [[ -z "$INTERFACE" ]] && return 1
+ essids=$(mktemp --tmpdir essid.XXXXXXXX)
+
+ wpa_supplicant -B -i"$INTERFACE" -Dnl80211,wext -C/run/wpa_supplicant -P/run/wpa_supplicant.pid || return 1
+ $WPA_CLI -i "$INTERFACE" scan &> /dev/null
+ sleep 2.5
+ $WPA_CLI -i "$INTERFACE" scan_results |
+ grep -v "^Selected" |
+ grep -v "^bssid" |
+ sort -rn -k3 |
+ sort -u -k5 |
+ sort -rn -k3 |
+ cut -f"$fields" > "$essids"
+
+ # Fields are tab delimited
+ # Remove extraneous output from wpa_cli
+ # Sort by strength
+ # Remove duplicates
+ # Re-sort by strength as the removal disorders the list
+ # Cut to the AP/essid fields only
+
+ kill "$(cat /run/wpa_supplicant.pid)"
+
+ # File of 0 length, ie. no ssid's.
+ if [[ ! -s "$essids" ]]; then
+ rm -f "$essids"
+ return 1
+ fi
+
+ echo $essids
+ return 0
+}
+
# Requires already loaded profile
make_wpa_config_file() {
local interface=$1
diff --git a/src/wireless b/src/wireless
index 71713e7..b5ae141 100644
--- a/src/wireless
+++ b/src/wireless
@@ -72,50 +72,6 @@ find_ap() {
return 1
}
-# Return a filename containing a list of network APs and ESSIDs found (sorted by decreasing signal strength)
-# list_networks interface
-list_networks() {
- wpa_supplicant_scan_info "$1" 1,5
-}
-
-wpa_supplicant_scan_info() {
- local INTERFACE="$1" fields="$2" essids
- # temp file used, as keeping ESSID's with spaces in their name in arrays
- # is hard, obscure and kinda nasty. This is simpler and clearer.
-
- [[ -z "$INTERFACE" ]] && return 1
- essids=$(mktemp --tmpdir essid.XXXXXXXX)
-
- wpa_supplicant -B -i"$INTERFACE" -Dnl80211,wext -C/run/wpa_supplicant -P/run/wpa_supplicant.pid || return 1
- wpa_cli -p /run/wpa_supplicant -i "$INTERFACE" scan &> /dev/null
- sleep 2.5
- wpa_cli -p /run/wpa_supplicant -i "$INTERFACE" scan_results |
- grep -v "^Selected" |
- grep -v "^bssid" |
- sort -rn -k3 |
- sort -u -k5 |
- sort -rn -k3 |
- cut -f"$fields" > "$essids"
-
- # Fields are tab delimited
- # Remove extraneous output from wpa_cli
- # Sort by strength
- # Remove duplicates
- # Re-sort by strength as the removal disorders the list
- # Cut to the AP/essid fields only
-
- kill "$(cat /run/wpa_supplicant.pid)"
-
- # File of 0 length, ie. no ssid's.
- if [[ ! -s "$essids" ]]; then
- rm -f "$essids"
- return 1
- fi
-
- echo $essids
- return 0
-}
-
set_rf_state() {
local INTERFACE="$1" state="$2" RFKILL_NAME="$3"