Added rfkill_block_all() Utility function to block/unblock devices by type. Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
diff --git a/rfkill.c b/rfkill.c index 3a1206b..7d470be 100644 --- a/rfkill.c +++ b/rfkill.c
@@ -210,6 +210,25 @@ 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)