All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes-cdvu00un1VgdHxzADdlk8Q@public.gmane.org>
To: Joey Lee <jlee-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org,
	Al Cho <ACho-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>,
	Gary Lin <GLin-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org>,
	oldium.pro-9Vj9tDbzfuSlVyrhU4qvOw@public.gmane.org,
	mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: acer-wmi: rfkill and bluetooth enabling doesn't work as in 2.6.37
Date: Wed, 23 Mar 2011 13:17:27 +0100	[thread overview]
Message-ID: <1300882647.3790.17.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <4D881693020000230002A2FC-jb/6P8Q/KsjOKUPnnb0SpZ/xhEQF/MHJojBamW5iJbs@public.gmane.org>

[remove Alan, his email address no longer works]

Hi,

> Sorry for I didn't really capture what your mean. Please then me
> introduce the issue's background:
> 
> For the beginning, I added this patch to acer-wmi driver:
> 
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=466449cfe797b8a5d82d25d0e0e08426d8dfba19
> 
> Because Acer notebook's BIOS can keep the devices state when system
> reboot, so, the above patch add the logic when acer-wmi driver initial
> to query the devices state by wmi method then set soft-block to
> acer-wmi's killswitch, including wlan, bluetooth and wwan.
> 
> The acer-wmi used rfkill_init_sw_state to set the initial state before
> rfkill register.

Yeah that seems reasonable.

> There have source code in rfkill_init_sw_state to set rfkill to
> persistent, then rfkill/core.c replicate acer-wmi's bluetooth state to
> the same type's rfkill.
> 
>         if (!rfkill->persistent || rfkill_epo_lock_active) {
>                 schedule_work(&rfkill->sync_work);
>         } else {
> #ifdef CONFIG_RFKILL_INPUT
>                 bool soft_blocked = !!(rfkill->state & RFKILL_BLOCK_SW);
> 
>                 if (!atomic_read(&rfkill_input_disabled))		//when rfkill-input enable
>                         __rfkill_switch_all(rfkill->type, soft_blocked);	//set sw block state to the same type
> #endif
>         }

But that's also required to actually make the persistent state have any
impact at all.

> No, BIOS only emit acpi notify when user press function key, acer-wmi
> driver emit KEY_WLAN to userland after receive the acpi notify. Of
> course at this moment, acer-wmi driver need to maintain rfkill state to
> sync with real device state.

So, I'm confused. Why does the driver not use the acer_wmi_notify
function to update the rfkill status too, but polls it every second?

> > It seems that what happens is roughly this:
> >  1) at boot, all BT is set to soft-killed due to the way the BIOS
> >     started up
> 
> Yes, acer BIOS's default value is bluetooth disabled. So, when system
> boot, there only have acer-wmi's bluetooth killswitch:
> 
> 0: acer-wireless: Wireless LAN
>         Soft blocked: no
>         Hard blocked: no
> 1: acer-bluetooth: Bluetooth
>         Soft blocked: yes		# default is sw block
>         Hard blocked: no
> 2: acer-threeg: Wireless WAN
>         Soft blocked: no
>         Hard blocked: no
> 4: phy0: Wireless LAN
>         Soft blocked: no
>         Hard blocked: no
> 
> There have no hci0's killswtich, because BT device power off by BIOS
> when system cold boot.

Right -- I missed that part.

> >  2) when you press the button, it's a toggle, so rfkill-input toggles
> >     all BT rfkill instances (acer and hci0)
> 
> Per Oldřich's report, he press bluetooth hardware key then see like the
> following:
> 
> 4: phy0: Wireless LAN
>         Soft blocked: no
>         Hard blocked: no
> 6: acer-wireless: Wireless LAN
>         Soft blocked: no
>         Hard blocked: no
> 7: acer-bluetooth: Bluetooth
>         Soft blocked: no
>         Hard blocked: no
> 8: acer-threeg: Wirele        Hard blocked: no
> 9: hci0: Bluetooth
>         Soft blocked: yes	# create hci0 rfkill but default is soft blocked
>         Hard blocked: no
> 
> I didn't have bluetooth HW key on my Acer machine, but I can unblock acer-wmi bluetooth
> rfkill manually to reproduce this issue.

Hmm, that I don't understand. Why would that reproduce the issue? Ah,
ok, that's because __rfkill_switch_all() will set global_states, and it
happens during init. So it gets registered with the global state, which
is still blocked since you just unblocked this single thing.

So, it seems that the design here only works if
 a) the bios stores the last state
 b) the driver only reports key inputs, no rfkill inputs

> If only use bluetooth HW key to control the rfkill, then it should be
> fine. But, Oldřich report still have problem cann't enable bluetooth
> after he press HW key because hci0's bluetooth default set to soft
> blocked.

Yeah that's because the BT hw key seems to generate the wrong event?

> If we want to remove rfkill-input, then we need re-compiler kernel. Why
> don't add a option for enable/disable it ?

Well I don't think we want to remove rfkill input, ever, because that
just leads to a mess where the user has to take action. I'd rather have
it work out of the box and be overridden by urfkill which should work
fine.

Of course, in this particular instance it _doesn't_ work out of the box,
but shouldn't we rather fix that?



But due the the behaviour you outlined earlier, I think your patch makes
sense... the BIOS doesn't actually seem to _store_ the rfkill state
anyway, since it's always off when you cold boot. So why bother using
that state as the default anyway?

That will work around the problem at hand by making the acer wmi enable
BT whenever it is loaded, but that doesn't seem so bad either.

As for the more generic problem, I'm not sure what to do. I really wish
people would just use urfkill.

johannes

  parent reply	other threads:[~2011-03-23 12:17 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 22:02 acer-wmi: rfkill and bluetooth enabling doesn't work as in 2.6.37 Joey Lee
2011-03-11 20:21 ` Oldřich Jedlička
2011-03-11 20:34   ` Joey Lee
2011-03-11 20:54     ` Oldřich Jedlička
2011-03-11 21:25       ` Joey Lee
2011-03-11 21:34         ` Oldřich Jedlička
2011-03-11 21:45           ` Joey Lee
     [not found]             ` <4D7B32B10200002300029B5E-jb/6P8Q/KsjOKUPnnb0SpZ/xhEQF/MHJojBamW5iJbs@public.gmane.org>
2011-03-15 11:11               ` Joey Lee
     [not found]                 ` <4D7FE4260200002300029D70-jb/6P8Q/KsjOKUPnnb0SpZ/xhEQF/MHJojBamW5iJbs@public.gmane.org>
2011-03-16  6:32                   ` Oldřich Jedlička
2011-03-16  8:59                     ` Joey Lee
2011-03-20 20:09                       ` Oldřich Jedlička
2011-03-21 11:26                         ` Joey Lee
2011-03-21 11:43                           ` Johannes Berg
2011-03-21 13:57                             ` Joey Lee
2011-03-21 14:35                               ` Johannes Berg
2011-03-21 16:25                                 ` Joey Lee
     [not found]                                   ` <4D881693020000230002A2FC-jb/6P8Q/KsjOKUPnnb0SpZ/xhEQF/MHJojBamW5iJbs@public.gmane.org>
2011-03-23 12:17                                     ` Johannes Berg [this message]
     [not found]                                       ` <1300882647.3790.17.camel-8upI4CBIZJIJvtFkdXX2HixXY32XiHfO@public.gmane.org>
2011-03-24  7:01                                         ` Joey Lee
2011-03-24  8:35                                           ` Johannes Berg
2011-03-24 12:55                                             ` Joey Lee
2011-03-24 12:58                                               ` Johannes Berg
2011-03-24 13:36                                                 ` Joey Lee
2011-03-21 19:27                                 ` Oldřich Jedlička
     [not found]                                   ` <201103212027.01952.oldium.pro-9Vj9tDbzfuSlVyrhU4qvOw@public.gmane.org>
2011-03-23 11:58                                     ` Johannes Berg
2011-03-23 21:38                                       ` Oldřich Jedlička
2011-03-24  8:36                                         ` Johannes Berg
     [not found]                                           ` <1300955793.3807.6.camel-8upI4CBIZJIJvtFkdXX2HixXY32XiHfO@public.gmane.org>
2011-03-24 13:13                                             ` Joey Lee
2011-03-24 13:13                                               ` Joey Lee
     [not found]                                               ` <201103242234.03598.oldium.pro@seznam.cz>
2011-03-25  6:29                                                 ` Oldřich Jedlička
     [not found]                                                 ` <201103242234.03598.oldium.pro-9Vj9tDbzfuSlVyrhU4qvOw@public.gmane.org>
2011-03-25  8:13                                                   ` Joey Lee
2011-03-25 19:22                                                     ` Oldřich Jedlička
2011-03-25 22:35                                                       ` Joey Lee
2011-03-27 17:09                                                         ` Dmitry Torokhov
2011-03-28  8:51                                                           ` Joey Lee
2011-03-31  5:23                                                           ` Oldřich Jedlička
     [not found]                                                             ` <AANLkTi=QREK2r6zbvo6RyTNMG4=NCf+kCUWi52ZwjOhS@mail.gmail.com>
2011-03-31  7:51                                                               ` Joey Lee
2011-03-31  8:09                                                                 ` Joey Lee
2011-03-31  9:10                                                                   ` Joey Lee
2011-03-31 20:27                                                                     ` Oldřich Jedlička
     [not found]                                                       ` <201103252022.26766.oldium.pro-9Vj9tDbzfuSlVyrhU4qvOw@public.gmane.org>
2011-03-28  9:04                                                         ` Joey Lee
2011-03-30 18:49                                                           ` Oldřich Jedlička
2011-03-11 22:00           ` Oldřich Jedlička
  -- strict thread matches above, loose matches on Subject: below --
2011-03-21 17:52 Joey Lee
2011-03-21 17:52 ` Joey Lee
2011-03-21 20:44 ` Oldřich Jedlička
2011-03-22  2:32   ` Joey Lee
2011-03-24 21:56     ` Oldřich Jedlička
2011-03-10 18:37 Oldřich Jedlička

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1300882647.3790.17.camel@jlt3.sipsolutions.net \
    --to=johannes-cdvu00un1vgdhxzaddlk8q@public.gmane.org \
    --cc=ACho-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org \
    --cc=GLin-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=jlee-Et1tbQHTxzrQT0dZR+AlfA@public.gmane.org \
    --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org \
    --cc=mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org \
    --cc=oldium.pro-9Vj9tDbzfuSlVyrhU4qvOw@public.gmane.org \
    --cc=platform-driver-x86-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.