summaryrefslogtreecommitdiffstats
path: root/src/wireless
diff options
context:
space:
mode:
authorRémy Oudompheng <remy@archlinux.org>2011-06-19 17:59:52 +0200
committerRémy Oudompheng <remy@archlinux.org>2011-06-19 18:49:26 +0200
commit8e0191dcdd0ecab6cbf040d86d691f1dbbe74da4 (patch)
tree1e70a210442c25a83f0d44e349f098ede8c0fcbc /src/wireless
parent180fbf1d82f97329be645699e89c0ee599cbf9f2 (diff)
downloadnetctl-8e0191dcdd0ecab6cbf040d86d691f1dbbe74da4.tar.gz
netctl-8e0191dcdd0ecab6cbf040d86d691f1dbbe74da4.tar.xz
Rename wireless module to 'rfkill', remove wep_check
Diffstat (limited to 'src/wireless')
-rw-r--r--src/wireless90
1 files changed, 0 insertions, 90 deletions
diff --git a/src/wireless b/src/wireless
deleted file mode 100644
index 85743bf..0000000
--- a/src/wireless
+++ /dev/null
@@ -1,90 +0,0 @@
-# Uses wireless_tools, to check for association to a network.
-# wep_check interface [timeout]
-wep_check()
-{
- local INTERFACE="$1" TIMEOUT="${2:-15}" timeout=0 bssid
-
- while [[ $timeout -lt "$TIMEOUT" ]]; do
- bssid=$(iwgetid "$INTERFACE" -ra)
- [[ -n "$bssid" && "$bssid" != "00:00:00:00:00:00" ]] && return 0
- sleep 1
- let timeout++
- done
- return 1
-}
-
-set_rf_state() {
- local INTERFACE="$1" state="$2" RFKILL_NAME="$3"
-
- if [[ "$RFKILL" == "hard" ]]; then
- report_fail "Cannot set state on hardware rfkill switch"
- return 1
- fi
- local path=$(get_rf_path "$INTERFACE" "$RFKILL_NAME") || return 1
- case "$state" in
- enabled)
- echo 1 > "$path/state"
- ;;
- disabled)
- echo 0 > "$path/state"
- ;;
- esac
-}
-
-get_rf_path() {
- local INTERFACE="$1" RFKILL_NAME="$2" path
-
- if [[ -n "$RFKILL_NAME" ]]; then
- for path in /sys/class/rfkill/*; do
- if [[ "$(cat "$path/name")" == "$RFKILL_NAME" ]]; then
- echo "$path"
- return 0
- fi
- done
- report_fail "no rfkill switch with name $RFKILL_NAME"
- else
- path="/sys/class/net/$INTERFACE/rfkill"
- if [[ -d "$path" ]]; then
- echo "$path"
- return 0
- fi
- report_fail "no rfkill switch available on interface $INTERFACE"
- fi
- return 1
-}
-
-get_rf_state() {
- local INTERFACE="$1" PROFILE="$2" path state
-
- path=$(get_rf_path "$INTERFACE" "$RFKILL_NAME") || return 1
- state=$(cat "$path/state")
-
- case "$state" in
- 0|2)
- echo "disabled";;
- 1)
- echo "enabled";;
- *)
- echo "$state";;
- esac
-}
-
-enable_rf() {
- local INTERFACE="$1" RFKILL="$2" RFKILL_NAME="$3"
- # Enable rfkill if necessary, or fail if it is hardware
- if [[ -n "$RFKILL" ]]; then
- local state=$(get_rf_state "$INTERFACE") || return 1
- if [[ "$state" != "enabled" ]]; then
- if [[ "$RFKILL" == "soft" ]]; then
- set_rf_state "$INTERFACE" enabled $RFKILL_NAME
- sleep 1
- else
- report_fail "radio is disabled on $INTERFACE"
- return 1
- fi
- fi
- fi
-}
-
-# vim: ft=sh ts=4 et sw=4:
-