[arch-projects] [netctl][PATCH 1/2] rfkill: add rf_is_enabled (query current rfkill state)
Ivan Shapovalov
intelfx100 at gmail.com
Sat Sep 21 11:37:22 EDT 2013
---
src/lib/rfkill | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/lib/rfkill b/src/lib/rfkill
index e388f08..b7adfc2 100644
--- a/src/lib/rfkill
+++ b/src/lib/rfkill
@@ -26,6 +26,19 @@ get_rf_path() {
return 1
}
+## Determine whether the transmission is allowed (unblocked) at the moment
+# $1: interface name
+# $2: rfkill name
+rf_is_enabled() {
+ local interface=$1 rfkill=$2 path hard soft
+
+ path=$(get_rf_path "$interface" "$rfkill") || return 1
+ read hard < "$path/hard"
+ read soft < "$path/soft"
+
+ (( ! hard && ! soft ))
+}
+
## Unblock transmission through a wireless device
# $1: interface name
# $2: rfkill name
--
1.8.4
More information about the arch-projects
mailing list