diff mbox

dell-laptop: Fix rfkill state queries

Message ID 1249007138-27354-1-git-send-email-mjg@redhat.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Matthew Garrett July 31, 2009, 2:25 a.m. UTC
The current code in dell-laptop is confused about the hardware rfkill
state. Fix it up such that it's always reported correctly.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
 drivers/platform/x86/dell-laptop.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Tim Gardner July 31, 2009, 1:19 p.m. UTC | #1
Matthew Garrett wrote:
> The current code in dell-laptop is confused about the hardware rfkill
> state. Fix it up such that it's always reported correctly.
> 
> Signed-off-by: Matthew Garrett <mjg@redhat.com>
> ---
>  drivers/platform/x86/dell-laptop.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
> index 74909c4..9061111 100644
> --- a/drivers/platform/x86/dell-laptop.c
> +++ b/drivers/platform/x86/dell-laptop.c
> @@ -197,8 +197,8 @@ static void dell_rfkill_query(struct rfkill *rfkill, void *data)
>  	dell_send_request(&buffer, 17, 11);
>  	status = buffer.output[1];
>  
> -	if (status & BIT(bit))
> -		rfkill_set_hw_state(rfkill, !!(status & BIT(16)));
> +	rfkill_set_sw_state(rfkill, !!(status & BIT(bit)));
> +	rfkill_set_hw_state(rfkill, !(status & BIT(16)));
>  }
>  
>  static const struct rfkill_ops dell_rfkill_ops = {

This works on an Inspiron 1420 and XPS1330 as far as I was able to test.
The physical rfkill switch sets 'Hard blocked: yes' for 'phy0: Wireless
LAN', and everything returns to normal 'blocked: no' when the switch is
disabled. I was not able to figure out how to get BIT(16) cleared. Is
that a keyboard function? Anyways,

Tested-by: Tim Gardner <tim.gardner@canonical.com>

rtg
Matthew Garrett July 31, 2009, 1:36 p.m. UTC | #2
On Fri, Jul 31, 2009 at 07:19:28AM -0600, Tim Gardner wrote:

> This works on an Inspiron 1420 and XPS1330 as far as I was able to test.
> The physical rfkill switch sets 'Hard blocked: yes' for 'phy0: Wireless
> LAN', and everything returns to normal 'blocked: no' when the switch is
> disabled. I was not able to figure out how to get BIT(16) cleared. Is
> that a keyboard function? Anyways,

Might be Fn+F2.
diff mbox

Patch

diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 74909c4..9061111 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -197,8 +197,8 @@  static void dell_rfkill_query(struct rfkill *rfkill, void *data)
 	dell_send_request(&buffer, 17, 11);
 	status = buffer.output[1];
 
-	if (status & BIT(bit))
-		rfkill_set_hw_state(rfkill, !!(status & BIT(16)));
+	rfkill_set_sw_state(rfkill, !!(status & BIT(bit)));
+	rfkill_set_hw_state(rfkill, !(status & BIT(16)));
 }
 
 static const struct rfkill_ops dell_rfkill_ops = {