If the rfkill switch is enabled, do not react to netlink notifications

until the rfkill is disabled.  They will mostly fail outright.
This commit is contained in:
Nicholas J. Kain
2015-02-13 17:20:36 -05:00
parent cf81573082
commit 5b050ba498
3 changed files with 9 additions and 0 deletions

View File

@@ -70,6 +70,7 @@ void handle_rfkill_notice(struct client_state_t cs[static 1], uint32_t rfkidx)
if (event.op != RFKILL_OP_CHANGE && event.op != RFKILL_OP_CHANGE_ALL)
return;
if (event.soft || event.hard) {
cs->rfkill_set = 1;
if (cs->ifsPrevState == IFS_UP) {
log_line("rfkill: radio now blocked; bringing interface down");
cs->ifsPrevState = IFS_DOWN;
@@ -77,6 +78,7 @@ void handle_rfkill_notice(struct client_state_t cs[static 1], uint32_t rfkidx)
} else
log_line("rfkill: radio now blocked, but interface isn't up");
} else {
cs->rfkill_set = 0;
if (cs->ifsPrevState == IFS_DOWN) {
log_line("rfkill: radio now unblocked; bringing interface up");
cs->ifsPrevState = IFS_UP;