From: Tim Gardner Date: Thu, 23 Jul 2009 15:51:47 +0000 (-0600) Subject: Added rfkill_block_all() X-Git-Tag: v2.31-rc1~98^2~13^2~30 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=0d0256dadcb1506ef174d6f91aa197e33b3233f6;p=thirdparty%2Futil-linux.git Added rfkill_block_all() Utility function to block/unblock devices by type. Signed-off-by: Tim Gardner --- diff --git a/rfkill.c b/rfkill.c index 3a1206b7fd..7d470be6a2 100644 --- 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)