]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Added rfkill_block_all()
authorTim Gardner <tim.gardner@canonical.com>
Thu, 23 Jul 2009 15:51:47 +0000 (09:51 -0600)
committerTim Gardner <tim.gardner@canonical.com>
Thu, 23 Jul 2009 15:51:47 +0000 (09:51 -0600)
Utility function to block/unblock devices by type.

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
rfkill.c

index 3a1206b7fd9165a9feb5a7b5b37fce5458c8f94c..7d470be6a26f14ebc4f8956cbda3ec4073664544 100644 (file)
--- a/rfkill.c
+++ b/rfkill.c
@@ -210,6 +210,25 @@ static void rfkill_block(__u32 idx, __u8 block)
        close(fd);
 }
 
+static void rfkill_block_all(enum rfkill_type type, __u8 block)
+{
+       int num_events;
+       struct rfkill_event *events;
+       int i;
+
+       events = rfkill_get_event_list(&num_events);
+       if (!events)
+               return;
+
+       for (i = 0; i < num_events; i++) {
+               if ((events[i].type == type) || (type == RFKILL_TYPE_ALL)) {
+                       rfkill_block(events[i].idx, block);
+               }
+       }
+
+       free(events);
+}
+
 static const char *argv0;
 
 static void usage(void)