提交 bc19d6e0 编写于 作者: A Adel Gadllah 提交者: John W. Linville

b43/b43legacy: add RFKILL_STATE_HARD_BLOCKED support

This patch sets the rfkill state to RFKILL_STATE_HARD_BLOCKED when the
radio is killed by the hardware switch.
Signed-off-by: NAdel Gadllah <adel.gadllah@gmail.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 f97d1f48
...@@ -43,6 +43,23 @@ static bool b43_is_hw_radio_enabled(struct b43_wldev *dev) ...@@ -43,6 +43,23 @@ static bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
return 0; return 0;
} }
/* Update the rfkill state */
static void b43_rfkill_update_state(struct b43_wldev *dev)
{
struct b43_rfkill *rfk = &(dev->wl->rfkill);
if (!dev->radio_hw_enable) {
rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED;
return;
}
if (!dev->phy.radio_on)
rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED;
else
rfk->rfkill->state = RFKILL_STATE_UNBLOCKED;
}
/* The poll callback for the hardware button. */ /* The poll callback for the hardware button. */
static void b43_rfkill_poll(struct input_polled_dev *poll_dev) static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
{ {
...@@ -60,6 +77,7 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev) ...@@ -60,6 +77,7 @@ static void b43_rfkill_poll(struct input_polled_dev *poll_dev)
if (unlikely(enabled != dev->radio_hw_enable)) { if (unlikely(enabled != dev->radio_hw_enable)) {
dev->radio_hw_enable = enabled; dev->radio_hw_enable = enabled;
report_change = 1; report_change = 1;
b43_rfkill_update_state(dev);
b43info(wl, "Radio hardware status changed to %s\n", b43info(wl, "Radio hardware status changed to %s\n",
enabled ? "ENABLED" : "DISABLED"); enabled ? "ENABLED" : "DISABLED");
} }
......
...@@ -44,6 +44,23 @@ static bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev) ...@@ -44,6 +44,23 @@ static bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev)
return 0; return 0;
} }
/* Update the rfkill state */
static void b43legacy_rfkill_update_state(struct b43legacy_wldev *dev)
{
struct b43legacy_rfkill *rfk = &(dev->wl->rfkill);
if (!dev->radio_hw_enable) {
rfk->rfkill->state = RFKILL_STATE_HARD_BLOCKED;
return;
}
if (!dev->phy.radio_on)
rfk->rfkill->state = RFKILL_STATE_SOFT_BLOCKED;
else
rfk->rfkill->state = RFKILL_STATE_UNBLOCKED;
}
/* The poll callback for the hardware button. */ /* The poll callback for the hardware button. */
static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev) static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev)
{ {
...@@ -61,6 +78,7 @@ static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev) ...@@ -61,6 +78,7 @@ static void b43legacy_rfkill_poll(struct input_polled_dev *poll_dev)
if (unlikely(enabled != dev->radio_hw_enable)) { if (unlikely(enabled != dev->radio_hw_enable)) {
dev->radio_hw_enable = enabled; dev->radio_hw_enable = enabled;
report_change = 1; report_change = 1;
b43legacy_rfkill_update_state(dev);
b43legacyinfo(wl, "Radio hardware status changed to %s\n", b43legacyinfo(wl, "Radio hardware status changed to %s\n",
enabled ? "ENABLED" : "DISABLED"); enabled ? "ENABLED" : "DISABLED");
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册