lkml.org 
[lkml]   [2009]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] Add rfkill support to compal-laptop
From
Date
Ah, heh, thanks Alan for pointing out there was a patch here :)

> +static void compal_rfkill_poll(struct rfkill *rfkill, void *data)
> +{
> + unsigned long radio = (unsigned long) data;
> + u8 result;
> + bool hw_blocked;
> + bool sw_blocked;
> +
> + ec_read(COMPAL_EC_COMMAND_WIRELESS, &result);
> +
> + hw_blocked = !(result & (KILLSWITCH_MASK | radio));

I don't quite understand the "| radio" bit since that seems to be the
soft kill bit according to rfkill_set()?

> + sw_blocked = rfkill_set_hw_state(rfkill, hw_blocked);
> +
> + rfkill_set_sw_state(rfkill, sw_blocked);

This is wrong. You can remove the entire part about sw_blocked, almost.

> +static int compal_rfkill_set(void *data, bool blocked)
> +{
> + unsigned long radio = (unsigned long) data;
> + u8 result, value;
> +
> + ec_read(COMPAL_EC_COMMAND_WIRELESS, &result);
> +
> + if ((result & KILLSWITCH_MASK) == 0)
> + return -EINVAL;

Anyhow, here you reject the request to set the soft bit. I suspect you
could let it go through but it would only change the soft bit in the
BIOS, nothing else really.

Two options:
1) You can let it go though, in that case do that, and remove the sw
block stuff from poll() completely.

2) You can't let it go through. In this case, you need to leave set as
it is, but implement poll like this:

sw_block = rfkill_set_hw_state(rfkill, hw_blocked);
compal_rfkill_set(data, sw_block);

so that when the user soft-blocks the device while hard-blocked, the
soft block is still honoured after pushing the button on the laptop.

Also, I'm not entirely clear about the semantics -- you've called the
bit KILLSWITCH_MASK, but does it really control all technologies as a
hard block, i.e. it toggles both the bluetooth and wireless hard block?

johannes
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2009-08-19 11:05    [W:0.246 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site