* rfkill hard state after booting
@ 2009-09-24 13:02 Norbert Preining
2009-09-24 14:07 ` Johannes Berg
0 siblings, 1 reply; 14+ messages in thread
From: Norbert Preining @ 2009-09-24 13:02 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless
Hi all,
(please cc)
I recently (on a flight) I found out that when I boot with the hard-switch
activated, so turning off all wireless activity on my laptop, the state
is not correctly announced in /dev/rfkill (reading it with rfkill command,
or my own gnome applet). All the devices seem to be in normal state but
one.
Here some outputs:
$ cd /sys/class/rfkill
$ ls
rfkill0@ rfkill1@ rfkill2@ rfkill3@ rfkill4@ rfkill5@
$ cat rfkill?/name
sony-wifi
sony-bluetooth
sony-wwan
hso-0
hci0
phy0
$
and the three sony-* are the ones for actually turning on/off the devices,
but they showed all soft 0 hard 0 at initial startup. Only phy0 (AFAIR)
had hard 1.
After turning off and on again the hard-switch the events were right.
That is all with 2.6.31.
driver iwlagn, Detected Intel Wireless WiFi Link 5100AGN REV=0x54
Best wishes
Norbert
-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@logic.at> Vienna University of Technology
Debian Developer <preining@debian.org> Debian TeX Group
gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
LIMERIGG (vb.)
To jar one's leg as the result of the disappearance of a stair which
isn't there in the darkness.
--- Douglas Adams, The Meaning of Liff
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: rfkill hard state after booting
2009-09-24 13:02 rfkill hard state after booting Norbert Preining
@ 2009-09-24 14:07 ` Johannes Berg
2009-09-24 15:01 ` Alan Jenkins
0 siblings, 1 reply; 14+ messages in thread
From: Johannes Berg @ 2009-09-24 14:07 UTC (permalink / raw)
To: Norbert Preining
Cc: linux-wireless, Alan Jenkins, Mattia Dongili, Almer S. Tigelaar,
Matthias Welwarsky
[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]
On Thu, 2009-09-24 at 15:02 +0200, Norbert Preining wrote:
> I recently (on a flight) I found out that when I boot with the hard-switch
> activated, so turning off all wireless activity on my laptop, the state
> is not correctly announced in /dev/rfkill (reading it with rfkill command,
> or my own gnome applet). All the devices seem to be in normal state but
> one.
Very strange.
> Here some outputs:
> $ cd /sys/class/rfkill
> $ ls
> rfkill0@ rfkill1@ rfkill2@ rfkill3@ rfkill4@ rfkill5@
> $ cat rfkill?/name
> sony-wifi
> sony-bluetooth
> sony-wwan
> hso-0
> hci0
> phy0
> $
>
> and the three sony-* are the ones for actually turning on/off the devices,
> but they showed all soft 0 hard 0 at initial startup. Only phy0 (AFAIR)
> had hard 1.
Makes sense. I mean, that phy0 was hard blocked.
> After turning off and on again the hard-switch the events were right.
I can't decide where this bug is. I suspect it's in the sony code.
Anyone feel responsible for that code?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: rfkill hard state after booting
2009-09-24 14:07 ` Johannes Berg
@ 2009-09-24 15:01 ` Alan Jenkins
2009-09-24 15:05 ` Johannes Berg
2009-09-24 16:19 ` rfkill hard state after booting Norbert Preining
0 siblings, 2 replies; 14+ messages in thread
From: Alan Jenkins @ 2009-09-24 15:01 UTC (permalink / raw)
To: Johannes Berg
Cc: Norbert Preining, linux-wireless, Mattia Dongili,
Almer S. Tigelaar, Matthias Welwarsky
Johannes Berg wrote:
> On Thu, 2009-09-24 at 15:02 +0200, Norbert Preining wrote:
>
>
>> I recently (on a flight) I found out that when I boot with the hard-switch
>> activated, so turning off all wireless activity on my laptop, the state
>> is not correctly announced in /dev/rfkill (reading it with rfkill command,
>> or my own gnome applet). All the devices seem to be in normal state but
>> one.
>>
>
> Very strange.
>
>
>> Here some outputs:
>> $ cd /sys/class/rfkill
>> $ ls
>> rfkill0@ rfkill1@ rfkill2@ rfkill3@ rfkill4@ rfkill5@
>> $ cat rfkill?/name
>> sony-wifi
>> sony-bluetooth
>> sony-wwan
>> hso-0
>> hci0
>> phy0
>> $
>>
>> and the three sony-* are the ones for actually turning on/off the devices,
>> but they showed all soft 0 hard 0 at initial startup. Only phy0 (AFAIR)
>> had hard 1.
>>
>
> Makes sense. I mean, that phy0 was hard blocked.
>
>
>> After turning off and on again the hard-switch the events were right.
>>
>
> I can't decide where this bug is. I suspect it's in the sony code.
> Anyone feel responsible for that code?
>
> johannes
>
I think it's pretty clear it's in the sony code. It doesn't call
set_hw_state() during init. I.e. (completely untested):
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index dafaa4a..a234a9d 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1081,6 +1081,8 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
struct rfkill *rfk;
enum rfkill_type type;
const char *name;
+ int result;
+ bool hwblock;
switch (nc_type) {
case SONY_WIFI:
@@ -1108,6 +1110,10 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
if (!rfk)
return -ENOMEM;
+ sony_call_snc_handle(0x124, 0x200, &result);
+ hwblock = !(result & 0x1);
+ rfkill_set_hw_state(rfk, hwblock);
+
err = rfkill_register(rfk);
if (err) {
rfkill_destroy(rfk);
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: rfkill hard state after booting
2009-09-24 15:01 ` Alan Jenkins
@ 2009-09-24 15:05 ` Johannes Berg
2009-09-24 15:12 ` Alan Jenkins
2009-09-24 16:19 ` rfkill hard state after booting Norbert Preining
1 sibling, 1 reply; 14+ messages in thread
From: Johannes Berg @ 2009-09-24 15:05 UTC (permalink / raw)
To: Alan Jenkins
Cc: Norbert Preining, linux-wireless, Mattia Dongili,
Almer S. Tigelaar, Matthias Welwarsky
[-- Attachment #1: Type: text/plain, Size: 346 bytes --]
On Thu, 2009-09-24 at 16:01 +0100, Alan Jenkins wrote:
> I think it's pretty clear it's in the sony code. It doesn't call
> set_hw_state() during init. I.e. (completely untested):
Agree, looking at the code this seems reasonable.
Although maybe it should just call sony_nc_rfkill_update() after
registering all of them?
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: rfkill hard state after booting
2009-09-24 15:05 ` Johannes Berg
@ 2009-09-24 15:12 ` Alan Jenkins
2009-09-24 17:29 ` Johannes Berg
0 siblings, 1 reply; 14+ messages in thread
From: Alan Jenkins @ 2009-09-24 15:12 UTC (permalink / raw)
To: Johannes Berg
Cc: Norbert Preining, linux-wireless, Mattia Dongili,
Almer S. Tigelaar, Matthias Welwarsky
Johannes Berg wrote:
> On Thu, 2009-09-24 at 16:01 +0100, Alan Jenkins wrote:
>
>
>> I think it's pretty clear it's in the sony code. It doesn't call
>> set_hw_state() during init. I.e. (completely untested):
>>
>
> Agree, looking at the code this seems reasonable.
>
> Although maybe it should just call sony_nc_rfkill_update() after
> registering all of them?
>
> johannes
>
That means the initial "add" uevents etc. will contain wrong values (and
then be updated immediately after). Do we care about that? It's
unlikely to matter in practice for platform devices which only get
loaded at boot-time, but perhaps it would set a bad example.
Regards
Alan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: rfkill hard state after booting
2009-09-24 15:01 ` Alan Jenkins
2009-09-24 15:05 ` Johannes Berg
@ 2009-09-24 16:19 ` Norbert Preining
1 sibling, 0 replies; 14+ messages in thread
From: Norbert Preining @ 2009-09-24 16:19 UTC (permalink / raw)
To: Alan Jenkins
Cc: Johannes Berg, linux-wireless, Mattia Dongili, Almer S. Tigelaar,
Matthias Welwarsky
On Do, 24 Sep 2009, Alan Jenkins wrote:
> + sony_call_snc_handle(0x124, 0x200, &result);
> + hwblock = !(result & 0x1);
> + rfkill_set_hw_state(rfk, hwblock);
> +
I confirm that the (full) patch fixed that problem. Thanks!
Best wishes
Norbert
-------------------------------------------------------------------------------
Dr. Norbert Preining <preining@logic.at> Vienna University of Technology
Debian Developer <preining@debian.org> Debian TeX Group
gpg DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
GOLANT (adj.)
Blank, sly and faintly embarrassed. Pertaining to the expression seen
on the face of someone who has clearly forgotten your name.
--- Douglas Adams, The Meaning of Liff
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: rfkill hard state after booting
2009-09-24 15:12 ` Alan Jenkins
@ 2009-09-24 17:29 ` Johannes Berg
2009-09-24 19:15 ` [PATCH] sony-laptop: check for rfkill hard block at load time Alan Jenkins
0 siblings, 1 reply; 14+ messages in thread
From: Johannes Berg @ 2009-09-24 17:29 UTC (permalink / raw)
To: Alan Jenkins
Cc: Norbert Preining, linux-wireless, Mattia Dongili,
Almer S. Tigelaar, Matthias Welwarsky
[-- Attachment #1: Type: text/plain, Size: 580 bytes --]
On Thu, 2009-09-24 at 16:12 +0100, Alan Jenkins wrote:
> > Although maybe it should just call sony_nc_rfkill_update() after
> > registering all of them?
> That means the initial "add" uevents etc. will contain wrong values (and
> then be updated immediately after). Do we care about that? It's
> unlikely to matter in practice for platform devices which only get
> loaded at boot-time, but perhaps it would set a bad example.
Ah, good point. I was just a little concerned about the logic
difference, but I don't really understand the _update() logic.
johannes
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] sony-laptop: check for rfkill hard block at load time
2009-09-24 17:29 ` Johannes Berg
@ 2009-09-24 19:15 ` Alan Jenkins
2009-09-24 19:24 ` Gábor Stefanik
` (2 more replies)
0 siblings, 3 replies; 14+ messages in thread
From: Alan Jenkins @ 2009-09-24 19:15 UTC (permalink / raw)
To: Mattia Dongili
Cc: linux-wireless@vger.kernel.org, Norbert Preining, Johannes Berg,
Almer S. Tigelaar, Matthias Welwarsky
"I recently (on a flight) I found out that when I boot with the hard-switch
activated, so turning off all wireless activity on my laptop, the state
is not correctly announced in /dev/rfkill (reading it with rfkill command,
or my own gnome applet)...
After turning off and on again the hard-switch the events were right."
We can fix this by querying the firmware at load time and calling
rfkill_set_hw_state().
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Tested-by: Norbert Preining <preining@logic.at>
---
drivers/platform/x86/sony-laptop.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index dafaa4a..a234a9d 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1081,6 +1081,8 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
struct rfkill *rfk;
enum rfkill_type type;
const char *name;
+ int result;
+ bool hwblock;
switch (nc_type) {
case SONY_WIFI:
@@ -1108,6 +1110,10 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
if (!rfk)
return -ENOMEM;
+ sony_call_snc_handle(0x124, 0x200, &result);
+ hwblock = !(result & 0x1);
+ rfkill_set_hw_state(rfk, hwblock);
+
err = rfkill_register(rfk);
if (err) {
rfkill_destroy(rfk);
--
1.6.3.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] sony-laptop: check for rfkill hard block at load time
2009-09-24 19:15 ` [PATCH] sony-laptop: check for rfkill hard block at load time Alan Jenkins
@ 2009-09-24 19:24 ` Gábor Stefanik
2009-09-24 20:11 ` Alan Jenkins
2009-09-24 19:27 ` Johannes Berg
2009-09-24 22:38 ` Mattia Dongili
2 siblings, 1 reply; 14+ messages in thread
From: Gábor Stefanik @ 2009-09-24 19:24 UTC (permalink / raw)
To: Alan Jenkins
Cc: Mattia Dongili, linux-wireless@vger.kernel.org, Norbert Preining,
Johannes Berg, Almer S. Tigelaar, Matthias Welwarsky
On Thu, Sep 24, 2009 at 9:15 PM, Alan Jenkins
<alan-jenkins@tuffmail.co.uk> wrote:
> "I recently (on a flight) I found out that when I boot with the hard-switch
> activated, so turning off all wireless activity on my laptop, the state
> is not correctly announced in /dev/rfkill (reading it with rfkill command,
> or my own gnome applet)...
>
> After turning off and on again the hard-switch the events were right."
>
> We can fix this by querying the firmware at load time and calling
> rfkill_set_hw_state().
>
> Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
> Tested-by: Norbert Preining <preining@logic.at>
> ---
> drivers/platform/x86/sony-laptop.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index dafaa4a..a234a9d 100644
> --- a/drivers/platform/x86/sony-laptop.c
> +++ b/drivers/platform/x86/sony-laptop.c
> @@ -1081,6 +1081,8 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
> struct rfkill *rfk;
> enum rfkill_type type;
> const char *name;
> + int result;
> + bool hwblock;
>
> switch (nc_type) {
> case SONY_WIFI:
> @@ -1108,6 +1110,10 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
> if (!rfk)
> return -ENOMEM;
>
> + sony_call_snc_handle(0x124, 0x200, &result);
Please define these somewhere, don't use magic numbers.
> + hwblock = !(result & 0x1);
> + rfkill_set_hw_state(rfk, hwblock);
> +
> err = rfkill_register(rfk);
> if (err) {
> rfkill_destroy(rfk);
> --
> 1.6.3.2
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Vista: [V]iruses, [I]ntruders, [S]pyware, [T]rojans and [A]dware. :-)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] sony-laptop: check for rfkill hard block at load time
2009-09-24 19:15 ` [PATCH] sony-laptop: check for rfkill hard block at load time Alan Jenkins
2009-09-24 19:24 ` Gábor Stefanik
@ 2009-09-24 19:27 ` Johannes Berg
2009-09-24 22:38 ` Mattia Dongili
2 siblings, 0 replies; 14+ messages in thread
From: Johannes Berg @ 2009-09-24 19:27 UTC (permalink / raw)
To: Alan Jenkins
Cc: Mattia Dongili, linux-wireless@vger.kernel.org, Norbert Preining,
Almer S. Tigelaar, Matthias Welwarsky
[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]
On Thu, 2009-09-24 at 20:15 +0100, Alan Jenkins wrote:
> "I recently (on a flight) I found out that when I boot with the hard-switch
> activated, so turning off all wireless activity on my laptop, the state
> is not correctly announced in /dev/rfkill (reading it with rfkill command,
> or my own gnome applet)...
>
> After turning off and on again the hard-switch the events were right."
>
> We can fix this by querying the firmware at load time and calling
> rfkill_set_hw_state().
>
> Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
> Tested-by: Norbert Preining <preining@logic.at>
Looks good, thanks Alan.
Acked-by: Johannes Berg <johannes@sipsolutions.net>
> ---
> drivers/platform/x86/sony-laptop.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index dafaa4a..a234a9d 100644
> --- a/drivers/platform/x86/sony-laptop.c
> +++ b/drivers/platform/x86/sony-laptop.c
> @@ -1081,6 +1081,8 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
> struct rfkill *rfk;
> enum rfkill_type type;
> const char *name;
> + int result;
> + bool hwblock;
>
> switch (nc_type) {
> case SONY_WIFI:
> @@ -1108,6 +1110,10 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
> if (!rfk)
> return -ENOMEM;
>
> + sony_call_snc_handle(0x124, 0x200, &result);
> + hwblock = !(result & 0x1);
> + rfkill_set_hw_state(rfk, hwblock);
> +
> err = rfkill_register(rfk);
> if (err) {
> rfkill_destroy(rfk);
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] sony-laptop: check for rfkill hard block at load time
2009-09-24 19:24 ` Gábor Stefanik
@ 2009-09-24 20:11 ` Alan Jenkins
2009-09-24 23:04 ` Mattia Dongili
0 siblings, 1 reply; 14+ messages in thread
From: Alan Jenkins @ 2009-09-24 20:11 UTC (permalink / raw)
To: Gábor Stefanik
Cc: Mattia Dongili, linux-wireless@vger.kernel.org, Norbert Preining,
Johannes Berg, Almer S. Tigelaar, Matthias Welwarsky
Gábor Stefanik wrote:
> On Thu, Sep 24, 2009 at 9:15 PM, Alan Jenkins
> <alan-jenkins@tuffmail.co.uk> wrote:
>
>> "I recently (on a flight) I found out that when I boot with the hard-switch
>> activated, so turning off all wireless activity on my laptop, the state
>> is not correctly announced in /dev/rfkill (reading it with rfkill command,
>> or my own gnome applet)...
>>
>> After turning off and on again the hard-switch the events were right."
>>
>> We can fix this by querying the firmware at load time and calling
>> rfkill_set_hw_state().
>>
>> Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
>> Tested-by: Norbert Preining <preining@logic.at>
>> ---
>> drivers/platform/x86/sony-laptop.c | 6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
>> index dafaa4a..a234a9d 100644
>> --- a/drivers/platform/x86/sony-laptop.c
>> +++ b/drivers/platform/x86/sony-laptop.c
>> @@ -1081,6 +1081,8 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
>> struct rfkill *rfk;
>> enum rfkill_type type;
>> const char *name;
>> + int result;
>> + bool hwblock;
>>
>> switch (nc_type) {
>> case SONY_WIFI:
>> @@ -1108,6 +1110,10 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
>> if (!rfk)
>> return -ENOMEM;
>>
>> + sony_call_snc_handle(0x124, 0x200, &result);
>>
>
> Please define these somewhere, don't use magic numbers.
>
The rfkill functions are all together in the file, it's not that bad.
But ok.
There's another bug / missing feature - it doesn't re-read the hard
states on resume from suspend.
I'll submit two more patches then. I won't convert all of the magic
numbers though. This isn't hardware I know anything about, and "magic
numbers" is a good description of some of them -
/* Setup hotkeys */
sony_call_snc_handle(0x0100, 0, &result);
sony_call_snc_handle(0x0101, 0, &result);
sony_call_snc_handle(0x0102, 0x100, &result);
sony_call_snc_handle(0x0127, 0, &result);
Others are already sufficiently obvious, and the extra indirection would
only serve to obscure
/* Enable all events */
acpi_callsetfunc(sony_nc_acpi_handle, "SN02", 0xffff, &result);
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] sony-laptop: check for rfkill hard block at load time
2009-09-24 19:15 ` [PATCH] sony-laptop: check for rfkill hard block at load time Alan Jenkins
2009-09-24 19:24 ` Gábor Stefanik
2009-09-24 19:27 ` Johannes Berg
@ 2009-09-24 22:38 ` Mattia Dongili
2009-09-25 9:13 ` Alan Jenkins
2 siblings, 1 reply; 14+ messages in thread
From: Mattia Dongili @ 2009-09-24 22:38 UTC (permalink / raw)
To: Alan Jenkins
Cc: linux-wireless@vger.kernel.org, Norbert Preining, Johannes Berg,
Almer S. Tigelaar, Matthias Welwarsky
On Thu, Sep 24, 2009 at 08:15:24PM +0100, Alan Jenkins wrote:
> "I recently (on a flight) I found out that when I boot with the hard-switch
> activated, so turning off all wireless activity on my laptop, the state
> is not correctly announced in /dev/rfkill (reading it with rfkill command,
> or my own gnome applet)...
>
> After turning off and on again the hard-switch the events were right."
>
> We can fix this by querying the firmware at load time and calling
> rfkill_set_hw_state().
Is it worth trying to get this into a stable release?
> Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
> Tested-by: Norbert Preining <preining@logic.at>
Acked-by: Mattia Dongili <malattia@linux.it>
> ---
> drivers/platform/x86/sony-laptop.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
> index dafaa4a..a234a9d 100644
> --- a/drivers/platform/x86/sony-laptop.c
> +++ b/drivers/platform/x86/sony-laptop.c
> @@ -1081,6 +1081,8 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
> struct rfkill *rfk;
> enum rfkill_type type;
> const char *name;
> + int result;
> + bool hwblock;
>
> switch (nc_type) {
> case SONY_WIFI:
> @@ -1108,6 +1110,10 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
> if (!rfk)
> return -ENOMEM;
>
> + sony_call_snc_handle(0x124, 0x200, &result);
> + hwblock = !(result & 0x1);
> + rfkill_set_hw_state(rfk, hwblock);
> +
> err = rfkill_register(rfk);
> if (err) {
> rfkill_destroy(rfk);
> --
> 1.6.3.2
>
>
>
--
mattia
:wq!
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] sony-laptop: check for rfkill hard block at load time
2009-09-24 20:11 ` Alan Jenkins
@ 2009-09-24 23:04 ` Mattia Dongili
0 siblings, 0 replies; 14+ messages in thread
From: Mattia Dongili @ 2009-09-24 23:04 UTC (permalink / raw)
To: Alan Jenkins
Cc: Gábor Stefanik, linux-wireless@vger.kernel.org,
Norbert Preining, Johannes Berg, Almer S. Tigelaar,
Matthias Welwarsky
On Thu, Sep 24, 2009 at 09:11:36PM +0100, Alan Jenkins wrote:
> Gábor Stefanik wrote:
> > On Thu, Sep 24, 2009 at 9:15 PM, Alan Jenkins
> > <alan-jenkins@tuffmail.co.uk> wrote:
> >
...
> >> @@ -1108,6 +1110,10 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
> >> if (!rfk)
> >> return -ENOMEM;
> >>
> >> + sony_call_snc_handle(0x124, 0x200, &result);
> >>
> >
> > Please define these somewhere, don't use magic numbers.
> >
>
> The rfkill functions are all together in the file, it's not that bad.
> But ok.
>
> There's another bug / missing feature - it doesn't re-read the hard
> states on resume from suspend.
>
> I'll submit two more patches then. I won't convert all of the magic
> numbers though. This isn't hardware I know anything about, and "magic
> numbers" is a good description of some of them -
right and the whole purpose of them is to hit specific code paths
in the DSDT tables. Not sure we would benefit that much from having
names for them.
--
mattia
:wq!
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] sony-laptop: check for rfkill hard block at load time
2009-09-24 22:38 ` Mattia Dongili
@ 2009-09-25 9:13 ` Alan Jenkins
0 siblings, 0 replies; 14+ messages in thread
From: Alan Jenkins @ 2009-09-25 9:13 UTC (permalink / raw)
To: John W. Linville
Cc: linux-wireless@vger.kernel.org, Mattia Dongili, Norbert Preining,
Almer S. Tigelaar, Matthias Welwarsky, Johannes Berg
Mattia Dongili wrote:
> On Thu, Sep 24, 2009 at 08:15:24PM +0100, Alan Jenkins wrote:
>
>> "I recently (on a flight) I found out that when I boot with the hard-switch
>> activated, so turning off all wireless activity on my laptop, the state
>> is not correctly announced in /dev/rfkill (reading it with rfkill command,
>> or my own gnome applet)...
>>
>> After turning off and on again the hard-switch the events were right."
>>
>> We can fix this by querying the firmware at load time and calling
>> rfkill_set_hw_state().
>>
>
> Is it worth trying to get this into a stable release?
>
Sure. It seems to fit, and all we have to do is add a CC to the patch
>> Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
>> Tested-by: Norbert Preining <preining@logic.at>
>>
>
> Acked-by: Mattia Dongili <malattia@linux.it>
>
CC: stable@kernel.org
>
>> ---
>> drivers/platform/x86/sony-laptop.c | 6 ++++++
>> 1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
>> index dafaa4a..a234a9d 100644
>> --- a/drivers/platform/x86/sony-laptop.c
>> +++ b/drivers/platform/x86/sony-laptop.c
>> @@ -1081,6 +1081,8 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
>> struct rfkill *rfk;
>> enum rfkill_type type;
>> const char *name;
>> + int result;
>> + bool hwblock;
>>
>> switch (nc_type) {
>> case SONY_WIFI:
>> @@ -1108,6 +1110,10 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
>> if (!rfk)
>> return -ENOMEM;
>>
>> + sony_call_snc_handle(0x124, 0x200, &result);
>> + hwblock = !(result & 0x1);
>> + rfkill_set_hw_state(rfk, hwblock);
>> +
>> err = rfkill_register(rfk);
>> if (err) {
>> rfkill_destroy(rfk);
>> --
>> 1.6.3.2
>>
>>
>>
>>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2009-09-25 9:13 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-24 13:02 rfkill hard state after booting Norbert Preining
2009-09-24 14:07 ` Johannes Berg
2009-09-24 15:01 ` Alan Jenkins
2009-09-24 15:05 ` Johannes Berg
2009-09-24 15:12 ` Alan Jenkins
2009-09-24 17:29 ` Johannes Berg
2009-09-24 19:15 ` [PATCH] sony-laptop: check for rfkill hard block at load time Alan Jenkins
2009-09-24 19:24 ` Gábor Stefanik
2009-09-24 20:11 ` Alan Jenkins
2009-09-24 23:04 ` Mattia Dongili
2009-09-24 19:27 ` Johannes Berg
2009-09-24 22:38 ` Mattia Dongili
2009-09-25 9:13 ` Alan Jenkins
2009-09-24 16:19 ` rfkill hard state after booting Norbert Preining
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).