Search Linux Wireless

[PATCH 17/24] rt2x00: Fix rfkill handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When the rfkill key has been pressed rt2x00 should send out an rfkill
event instead of toggling all keys. This will make sure the event
will go through all correct rfkill layers.

Also initialize the rfkill->state field to make sure we correctly
notice key changes.

Signed-off-by: Ivo van Doorn <IvDoorn@xxxxxxxxx>
---
 drivers/net/wireless/rt2x00/rt2x00rfkill.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
index 7dde53c..dc5b696 100644
--- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c
+++ b/drivers/net/wireless/rt2x00/rt2x00rfkill.c
@@ -68,9 +68,10 @@ static int rt2x00rfkill_toggle_radio(void *data, enum rfkill_state state)
 static void rt2x00rfkill_poll(struct input_polled_dev *poll_dev)
 {
 	struct rt2x00_dev *rt2x00dev = poll_dev->private;
-	int status = rt2x00dev->ops->lib->rfkill_poll(rt2x00dev);
+	int state = rt2x00dev->ops->lib->rfkill_poll(rt2x00dev);
 
-	rfkill_switch_all(rt2x00dev->rfkill->type, status);
+	if (rt2x00dev->rfkill->state != state)
+		input_report_key(poll_dev->input, KEY_WLAN, 1);
 }
 
 int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
@@ -120,6 +121,7 @@ int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
 
 	rt2x00dev->rfkill->name = rt2x00dev->ops->name;
 	rt2x00dev->rfkill->data = rt2x00dev;
+	rt2x00dev->rfkill->state = rt2x00dev->ops->lib->rfkill_poll(rt2x00dev);
 	rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio;
 
 	rt2x00dev->poll_dev = input_allocate_polled_device();
-- 
1.5.3
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux