* Re: acer-wmi problem handling device states from WMI events
@ 2011-06-21 10:16 Joey Lee
2011-06-21 13:14 ` Seth Forshee
0 siblings, 1 reply; 10+ messages in thread
From: Joey Lee @ 2011-06-21 10:16 UTC (permalink / raw)
To: seth.forshee; +Cc: Joey Lee, platform-driver-x86
Hi Seth,
於 一,2011-06-20 於 14:06 -0500,Seth Forshee 提到:
> Hi Joey,
>
> acer-wmi is indiscriminately using the device state from hotkey events
> to update the various rfkill states. On the Aspire 1830 this can result
> in a soft block on the wlan when the touchpad hotkey is pressed, as it
> is reporting a non-zero device state that does not reflect the wireless
> status.
>
Thank's for you found out this issue, I didn't meet it because touchpad
hotkey didn't emit any wmi event on my Acer TravelMate 8572.
I will double check it.
> I beleive the following (untested) patch is a roughly correct fix for
> this issue. It changes acer-wmi to only update the rfkill states when
> the appropriate hotkeys are pressed, but I'm a little unsure about the
> way I've split out the rfkill updates acording to the hotkeys. I don't
> see any support in the driver for a 3G hotkey, so I've grouped it with
> the wlan key, and I have split out bluetooth to be handled separately
> from these. Does this patch look correct?
>
> Thanks,
> Seth
>
Yes, I thought your patch can avoid acer-wmi update killswitch state
base on the result from non-Communication button.
On some Acer machines only have one wireless key, the key only emit
KEY_WIRELESS but EC updates 3 communication devices' states, I thought
we can direct update 3 killswitch state when received KEY_WLAN or
KEY_BLUETOOTH. maybe like this:
+ switch (key->keycode) {
+ case KEY_WLAN:
+ case KEY_BLUETOOTH:
+ if (has_cap(ACER_CAP_WIRELESS))
+ rfkill_set_sw_state(wireless_rfkill,
+ !(device_state & ACER_WMID3_GDS_WIRELESS));
+ if (has_cap(ACER_CAP_THREEG))
+ rfkill_set_sw_state(threeg_rfkill,
+ !(device_state & ACER_WMID3_GDS_THREEG));
+ if (has_cap(ACER_CAP_BLUETOOTH))
+ rfkill_set_sw_state(bluetooth_rfkill,
+ !(device_state & ACER_WMID3_GDS_BLUETOOTH));
+ break;
+ }
+ sparse_keymap_report_entry(acer_wmi_input_dev, key,
+ 1, true);
Of course need more testing on my and your Acer machines.
I will double check this patch on my TravelMate 8572 then reply result
on this mail tomorrow.
Thank's a lot!
Joey Lee
>
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index 005417b..592328d 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -1445,6 +1445,8 @@ static void acer_wmi_notify(u32 value, void *context)
> union acpi_object *obj;
> struct event_return_value return_value;
> acpi_status status;
> + u16 device_state;
> + const struct key_entry *key;
>
> status = wmi_get_event_data(value, &response);
> if (status != AE_OK) {
> @@ -1472,23 +1474,33 @@ static void acer_wmi_notify(u32 value, void *context)
>
> switch (return_value.function) {
> case WMID_HOTKEY_EVENT:
> - if (return_value.device_state) {
> - u16 device_state = return_value.device_state;
> - pr_debug("device state: 0x%x\n", device_state);
> - if (has_cap(ACER_CAP_WIRELESS))
> - rfkill_set_sw_state(wireless_rfkill,
> - !(device_state & ACER_WMID3_GDS_WIRELESS));
> - if (has_cap(ACER_CAP_BLUETOOTH))
> - rfkill_set_sw_state(bluetooth_rfkill,
> - !(device_state & ACER_WMID3_GDS_BLUETOOTH));
> - if (has_cap(ACER_CAP_THREEG))
> - rfkill_set_sw_state(threeg_rfkill,
> - !(device_state & ACER_WMID3_GDS_THREEG));
> - }
> - if (!sparse_keymap_report_event(acer_wmi_input_dev,
> - return_value.key_num, 1, true))
> + device_state = return_value.device_state;
> + pr_debug("device state: 0x%x\n", device_state);
> +
> + key = sparse_keymap_entry_from_scancode(acer_wmi_input_dev,
> + return_value.key_num);
> + if (!key) {
> pr_warn("Unknown key number - 0x%x\n",
> return_value.key_num);
> + } else {
> + switch (key->keycode) {
> + case KEY_WLAN:
> + if (has_cap(ACER_CAP_WIRELESS))
> + rfkill_set_sw_state(wireless_rfkill,
> + !(device_state & ACER_WMID3_GDS_WIRELESS));
> + if (has_cap(ACER_CAP_THREEG))
> + rfkill_set_sw_state(threeg_rfkill,
> + !(device_state & ACER_WMID3_GDS_THREEG));
> + break;
> + case KEY_BLUETOOTH:
> + if (has_cap(ACER_CAP_BLUETOOTH))
> + rfkill_set_sw_state(bluetooth_rfkill,
> + !(device_state & ACER_WMID3_GDS_BLUETOOTH));
> + break;
> + }
> + sparse_keymap_report_entry(acer_wmi_input_dev, key,
> + 1, true);
> + }
> break;
> default:
> pr_warn("Unknown function number - %d - %d\n",
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: acer-wmi problem handling device states from WMI events
2011-06-21 10:16 acer-wmi problem handling device states from WMI events Joey Lee
@ 2011-06-21 13:14 ` Seth Forshee
2011-06-21 16:58 ` Seth Forshee
0 siblings, 1 reply; 10+ messages in thread
From: Seth Forshee @ 2011-06-21 13:14 UTC (permalink / raw)
To: Joey Lee; +Cc: platform-driver-x86
On Tue, Jun 21, 2011 at 04:16:38AM -0600, Joey Lee wrote:
> Hi Seth,
>
> 於 一,2011-06-20 於 14:06 -0500,Seth Forshee 提到:
> > Hi Joey,
> >
> > acer-wmi is indiscriminately using the device state from hotkey events
> > to update the various rfkill states. On the Aspire 1830 this can result
> > in a soft block on the wlan when the touchpad hotkey is pressed, as it
> > is reporting a non-zero device state that does not reflect the wireless
> > status.
> >
>
> Thank's for you found out this issue, I didn't meet it because touchpad
> hotkey didn't emit any wmi event on my Acer TravelMate 8572.
>
> I will double check it.
>
> > I beleive the following (untested) patch is a roughly correct fix for
> > this issue. It changes acer-wmi to only update the rfkill states when
> > the appropriate hotkeys are pressed, but I'm a little unsure about the
> > way I've split out the rfkill updates acording to the hotkeys. I don't
> > see any support in the driver for a 3G hotkey, so I've grouped it with
> > the wlan key, and I have split out bluetooth to be handled separately
> > from these. Does this patch look correct?
> >
> > Thanks,
> > Seth
> >
>
> Yes, I thought your patch can avoid acer-wmi update killswitch state
> base on the result from non-Communication button.
>
> On some Acer machines only have one wireless key, the key only emit
> KEY_WIRELESS but EC updates 3 communication devices' states, I thought
> we can direct update 3 killswitch state when received KEY_WLAN or
> KEY_BLUETOOTH. maybe like this:
>
> + switch (key->keycode) {
> + case KEY_WLAN:
> + case KEY_BLUETOOTH:
> + if (has_cap(ACER_CAP_WIRELESS))
> + rfkill_set_sw_state(wireless_rfkill,
> + !(device_state & ACER_WMID3_GDS_WIRELESS));
> + if (has_cap(ACER_CAP_THREEG))
> + rfkill_set_sw_state(threeg_rfkill,
> + !(device_state & ACER_WMID3_GDS_THREEG));
> + if (has_cap(ACER_CAP_BLUETOOTH))
> + rfkill_set_sw_state(bluetooth_rfkill,
> + !(device_state & ACER_WMID3_GDS_BLUETOOTH));
> + break;
> + }
> + sparse_keymap_report_entry(acer_wmi_input_dev, key,
> + 1, true);
>
> Of course need more testing on my and your Acer machines.
> I will double check this patch on my TravelMate 8572 then reply result
> on this mail tomorrow.
That is the other way I was thinking of doing this, but I wasn't sure
which was correct, and the machine in question doesn't have bluetooth
for me to test. Based on your explanation I think doing it as above is
best.
I'll get some testing with the version above, and if it tests well for
both of us I will send an updated patch plus one other patch to support
the wlan hotkey on the 1830. I don't personally have this machine so it
may be a few days before I receive results back from my tester.
Thanks,
Seth
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: acer-wmi problem handling device states from WMI events
2011-06-21 13:14 ` Seth Forshee
@ 2011-06-21 16:58 ` Seth Forshee
2011-06-21 17:00 ` [PATCH 1/2] acer-wmi: Add support for Aspire 1830 wlan hotkey Seth Forshee
2011-06-21 17:00 ` [PATCH 2/2] acer-wmi: Only update rfkill status for associated hotkey events Seth Forshee
0 siblings, 2 replies; 10+ messages in thread
From: Seth Forshee @ 2011-06-21 16:58 UTC (permalink / raw)
To: Joey Lee; +Cc: platform-driver-x86
On Tue, Jun 21, 2011 at 08:14:42AM -0500, Seth Forshee wrote:
> On Tue, Jun 21, 2011 at 04:16:38AM -0600, Joey Lee wrote:
> > Hi Seth,
> >
> > 於 一,2011-06-20 於 14:06 -0500,Seth Forshee 提到:
> > > Hi Joey,
> > >
> > > acer-wmi is indiscriminately using the device state from hotkey events
> > > to update the various rfkill states. On the Aspire 1830 this can result
> > > in a soft block on the wlan when the touchpad hotkey is pressed, as it
> > > is reporting a non-zero device state that does not reflect the wireless
> > > status.
> > >
> >
> > Thank's for you found out this issue, I didn't meet it because touchpad
> > hotkey didn't emit any wmi event on my Acer TravelMate 8572.
> >
> > I will double check it.
> >
> > > I beleive the following (untested) patch is a roughly correct fix for
> > > this issue. It changes acer-wmi to only update the rfkill states when
> > > the appropriate hotkeys are pressed, but I'm a little unsure about the
> > > way I've split out the rfkill updates acording to the hotkeys. I don't
> > > see any support in the driver for a 3G hotkey, so I've grouped it with
> > > the wlan key, and I have split out bluetooth to be handled separately
> > > from these. Does this patch look correct?
> > >
> > > Thanks,
> > > Seth
> > >
> >
> > Yes, I thought your patch can avoid acer-wmi update killswitch state
> > base on the result from non-Communication button.
> >
> > On some Acer machines only have one wireless key, the key only emit
> > KEY_WIRELESS but EC updates 3 communication devices' states, I thought
> > we can direct update 3 killswitch state when received KEY_WLAN or
> > KEY_BLUETOOTH. maybe like this:
> >
> > + switch (key->keycode) {
> > + case KEY_WLAN:
> > + case KEY_BLUETOOTH:
> > + if (has_cap(ACER_CAP_WIRELESS))
> > + rfkill_set_sw_state(wireless_rfkill,
> > + !(device_state & ACER_WMID3_GDS_WIRELESS));
> > + if (has_cap(ACER_CAP_THREEG))
> > + rfkill_set_sw_state(threeg_rfkill,
> > + !(device_state & ACER_WMID3_GDS_THREEG));
> > + if (has_cap(ACER_CAP_BLUETOOTH))
> > + rfkill_set_sw_state(bluetooth_rfkill,
> > + !(device_state & ACER_WMID3_GDS_BLUETOOTH));
> > + break;
> > + }
> > + sparse_keymap_report_entry(acer_wmi_input_dev, key,
> > + 1, true);
> >
> > Of course need more testing on my and your Acer machines.
> > I will double check this patch on my TravelMate 8572 then reply result
> > on this mail tomorrow.
>
> That is the other way I was thinking of doing this, but I wasn't sure
> which was correct, and the machine in question doesn't have bluetooth
> for me to test. Based on your explanation I think doing it as above is
> best.
>
> I'll get some testing with the version above, and if it tests well for
> both of us I will send an updated patch plus one other patch to support
> the wlan hotkey on the 1830. I don't personally have this machine so it
> may be a few days before I receive results back from my tester.
I got test results back already, and the patch is working. I'll follow
up with both patches, that way if they work fine in your testing you can
go ahead and take them.
Thanks!
Seth
^ permalink raw reply [flat|nested] 10+ messages in thread* [PATCH 1/2] acer-wmi: Add support for Aspire 1830 wlan hotkey
2011-06-21 16:58 ` Seth Forshee
@ 2011-06-21 17:00 ` Seth Forshee
2011-06-22 10:14 ` Joey Lee
2011-06-21 17:00 ` [PATCH 2/2] acer-wmi: Only update rfkill status for associated hotkey events Seth Forshee
1 sibling, 1 reply; 10+ messages in thread
From: Seth Forshee @ 2011-06-21 17:00 UTC (permalink / raw)
To: Joey Lee; +Cc: platform-driver-x86
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
drivers/platform/x86/acer-wmi.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 005417b..0dd6986 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -99,6 +99,7 @@ enum acer_wmi_event_ids {
static const struct key_entry acer_wmi_keymap[] = {
{KE_KEY, 0x01, {KEY_WLAN} }, /* WiFi */
{KE_KEY, 0x03, {KEY_WLAN} }, /* WiFi */
+ {KE_KEY, 0x04, {KEY_WLAN} }, /* WiFi */
{KE_KEY, 0x12, {KEY_BLUETOOTH} }, /* BT */
{KE_KEY, 0x21, {KEY_PROG1} }, /* Backup */
{KE_KEY, 0x22, {KEY_PROG2} }, /* Arcade */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 1/2] acer-wmi: Add support for Aspire 1830 wlan hotkey
2011-06-21 17:00 ` [PATCH 1/2] acer-wmi: Add support for Aspire 1830 wlan hotkey Seth Forshee
@ 2011-06-22 10:14 ` Joey Lee
0 siblings, 0 replies; 10+ messages in thread
From: Joey Lee @ 2011-06-22 10:14 UTC (permalink / raw)
To: seth.forshee; +Cc: Joey Lee, platform-driver-x86
於 二,2011-06-21 於 12:00 -0500,Seth Forshee 提到:
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> ---
> drivers/platform/x86/acer-wmi.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index 005417b..0dd6986 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -99,6 +99,7 @@ enum acer_wmi_event_ids {
> static const struct key_entry acer_wmi_keymap[] = {
> {KE_KEY, 0x01, {KEY_WLAN} }, /* WiFi */
> {KE_KEY, 0x03, {KEY_WLAN} }, /* WiFi */
> + {KE_KEY, 0x04, {KEY_WLAN} }, /* WiFi */
> {KE_KEY, 0x12, {KEY_BLUETOOTH} }, /* BT */
> {KE_KEY, 0x21, {KEY_PROG1} }, /* Backup */
> {KE_KEY, 0x22, {KEY_PROG2} }, /* Arcade */
Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Thank's for your patch!
Joey Lee
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/2] acer-wmi: Only update rfkill status for associated hotkey events
2011-06-21 16:58 ` Seth Forshee
2011-06-21 17:00 ` [PATCH 1/2] acer-wmi: Add support for Aspire 1830 wlan hotkey Seth Forshee
@ 2011-06-21 17:00 ` Seth Forshee
2011-06-22 10:15 ` Joey Lee
1 sibling, 1 reply; 10+ messages in thread
From: Seth Forshee @ 2011-06-21 17:00 UTC (permalink / raw)
To: Joey Lee; +Cc: platform-driver-x86
acer-wmi is indiscriminately using the device state from hotkey
events to update the various rfkill states. On the Aspire 1830 this
can result in a soft block on the wlan when the touchpad hotkey is
pressed, as it is reporting a non-zero device state that does not
reflect the wireless status. To fix this, only update rfkill states
when a wlan or bluetooth hotkey is pressed.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
drivers/platform/x86/acer-wmi.c | 41 ++++++++++++++++++++++++--------------
1 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 0dd6986..591eb7a 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1446,6 +1446,8 @@ static void acer_wmi_notify(u32 value, void *context)
union acpi_object *obj;
struct event_return_value return_value;
acpi_status status;
+ u16 device_state;
+ const struct key_entry *key;
status = wmi_get_event_data(value, &response);
if (status != AE_OK) {
@@ -1473,23 +1475,32 @@ static void acer_wmi_notify(u32 value, void *context)
switch (return_value.function) {
case WMID_HOTKEY_EVENT:
- if (return_value.device_state) {
- u16 device_state = return_value.device_state;
- pr_debug("device state: 0x%x\n", device_state);
- if (has_cap(ACER_CAP_WIRELESS))
- rfkill_set_sw_state(wireless_rfkill,
- !(device_state & ACER_WMID3_GDS_WIRELESS));
- if (has_cap(ACER_CAP_BLUETOOTH))
- rfkill_set_sw_state(bluetooth_rfkill,
- !(device_state & ACER_WMID3_GDS_BLUETOOTH));
- if (has_cap(ACER_CAP_THREEG))
- rfkill_set_sw_state(threeg_rfkill,
- !(device_state & ACER_WMID3_GDS_THREEG));
- }
- if (!sparse_keymap_report_event(acer_wmi_input_dev,
- return_value.key_num, 1, true))
+ device_state = return_value.device_state;
+ pr_debug("device state: 0x%x\n", device_state);
+
+ key = sparse_keymap_entry_from_scancode(acer_wmi_input_dev,
+ return_value.key_num);
+ if (!key) {
pr_warn("Unknown key number - 0x%x\n",
return_value.key_num);
+ } else {
+ switch (key->keycode) {
+ case KEY_WLAN:
+ case KEY_BLUETOOTH:
+ if (has_cap(ACER_CAP_WIRELESS))
+ rfkill_set_sw_state(wireless_rfkill,
+ !(device_state & ACER_WMID3_GDS_WIRELESS));
+ if (has_cap(ACER_CAP_THREEG))
+ rfkill_set_sw_state(threeg_rfkill,
+ !(device_state & ACER_WMID3_GDS_THREEG));
+ if (has_cap(ACER_CAP_BLUETOOTH))
+ rfkill_set_sw_state(bluetooth_rfkill,
+ !(device_state & ACER_WMID3_GDS_BLUETOOTH));
+ break;
+ }
+ sparse_keymap_report_entry(acer_wmi_input_dev, key,
+ 1, true);
+ }
break;
default:
pr_warn("Unknown function number - %d - %d\n",
--
1.7.4.1
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 2/2] acer-wmi: Only update rfkill status for associated hotkey events
2011-06-21 17:00 ` [PATCH 2/2] acer-wmi: Only update rfkill status for associated hotkey events Seth Forshee
@ 2011-06-22 10:15 ` Joey Lee
2011-06-22 20:50 ` Joey Lee
0 siblings, 1 reply; 10+ messages in thread
From: Joey Lee @ 2011-06-22 10:15 UTC (permalink / raw)
To: seth.forshee; +Cc: Joey Lee, platform-driver-x86
於 二,2011-06-21 於 12:00 -0500,Seth Forshee 提到:
> acer-wmi is indiscriminately using the device state from hotkey
> events to update the various rfkill states. On the Aspire 1830 this
> can result in a soft block on the wlan when the touchpad hotkey is
> pressed, as it is reporting a non-zero device state that does not
> reflect the wireless status. To fix this, only update rfkill states
> when a wlan or bluetooth hotkey is pressed.
>
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> ---
> drivers/platform/x86/acer-wmi.c | 41 ++++++++++++++++++++++++--------------
> 1 files changed, 26 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> index 0dd6986..591eb7a 100644
> --- a/drivers/platform/x86/acer-wmi.c
> +++ b/drivers/platform/x86/acer-wmi.c
> @@ -1446,6 +1446,8 @@ static void acer_wmi_notify(u32 value, void *context)
> union acpi_object *obj;
> struct event_return_value return_value;
> acpi_status status;
> + u16 device_state;
> + const struct key_entry *key;
>
> status = wmi_get_event_data(value, &response);
> if (status != AE_OK) {
> @@ -1473,23 +1475,32 @@ static void acer_wmi_notify(u32 value, void *context)
>
> switch (return_value.function) {
> case WMID_HOTKEY_EVENT:
> - if (return_value.device_state) {
> - u16 device_state = return_value.device_state;
> - pr_debug("device state: 0x%x\n", device_state);
> - if (has_cap(ACER_CAP_WIRELESS))
> - rfkill_set_sw_state(wireless_rfkill,
> - !(device_state & ACER_WMID3_GDS_WIRELESS));
> - if (has_cap(ACER_CAP_BLUETOOTH))
> - rfkill_set_sw_state(bluetooth_rfkill,
> - !(device_state & ACER_WMID3_GDS_BLUETOOTH));
> - if (has_cap(ACER_CAP_THREEG))
> - rfkill_set_sw_state(threeg_rfkill,
> - !(device_state & ACER_WMID3_GDS_THREEG));
> - }
> - if (!sparse_keymap_report_event(acer_wmi_input_dev,
> - return_value.key_num, 1, true))
> + device_state = return_value.device_state;
> + pr_debug("device state: 0x%x\n", device_state);
> +
> + key = sparse_keymap_entry_from_scancode(acer_wmi_input_dev,
> + return_value.key_num);
> + if (!key) {
> pr_warn("Unknown key number - 0x%x\n",
> return_value.key_num);
> + } else {
> + switch (key->keycode) {
> + case KEY_WLAN:
> + case KEY_BLUETOOTH:
> + if (has_cap(ACER_CAP_WIRELESS))
> + rfkill_set_sw_state(wireless_rfkill,
> + !(device_state & ACER_WMID3_GDS_WIRELESS));
> + if (has_cap(ACER_CAP_THREEG))
> + rfkill_set_sw_state(threeg_rfkill,
> + !(device_state & ACER_WMID3_GDS_THREEG));
> + if (has_cap(ACER_CAP_BLUETOOTH))
> + rfkill_set_sw_state(bluetooth_rfkill,
> + !(device_state & ACER_WMID3_GDS_BLUETOOTH));
> + break;
> + }
> + sparse_keymap_report_entry(acer_wmi_input_dev, key,
> + 1, true);
> + }
> break;
> default:
> pr_warn("Unknown function number - %d - %d\n",
Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Tested on Acer TravelMate 8572, patch works no problem!
Thank's for your patch!
Joey Lee
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 2/2] acer-wmi: Only update rfkill status for associated hotkey events
2011-06-22 10:15 ` Joey Lee
@ 2011-06-22 20:50 ` Joey Lee
0 siblings, 0 replies; 10+ messages in thread
From: Joey Lee @ 2011-06-22 20:50 UTC (permalink / raw)
To: mjg59; +Cc: seth.forshee, platform-driver-x86
Hi Matthew,
於 三,2011-06-22 於 04:15 -0600,Joey Lee 提到:
> 於 二,2011-06-21 於 12:00 -0500,Seth Forshee 提到:
> > acer-wmi is indiscriminately using the device state from hotkey
> > events to update the various rfkill states. On the Aspire 1830 this
> > can result in a soft block on the wlan when the touchpad hotkey is
> > pressed, as it is reporting a non-zero device state that does not
> > reflect the wireless status. To fix this, only update rfkill states
> > when a wlan or bluetooth hotkey is pressed.
> >
> > Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> > ---
> > drivers/platform/x86/acer-wmi.c | 41 ++++++++++++++++++++++++--------------
> > 1 files changed, 26 insertions(+), 15 deletions(-)
> >
> > diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> > index 0dd6986..591eb7a 100644
> > --- a/drivers/platform/x86/acer-wmi.c
> > +++ b/drivers/platform/x86/acer-wmi.c
> > @@ -1446,6 +1446,8 @@ static void acer_wmi_notify(u32 value, void *context)
> > union acpi_object *obj;
> > struct event_return_value return_value;
> > acpi_status status;
> > + u16 device_state;
> > + const struct key_entry *key;
> >
> > status = wmi_get_event_data(value, &response);
> > if (status != AE_OK) {
> > @@ -1473,23 +1475,32 @@ static void acer_wmi_notify(u32 value, void *context)
> >
> > switch (return_value.function) {
> > case WMID_HOTKEY_EVENT:
> > - if (return_value.device_state) {
> > - u16 device_state = return_value.device_state;
> > - pr_debug("device state: 0x%x\n", device_state);
> > - if (has_cap(ACER_CAP_WIRELESS))
> > - rfkill_set_sw_state(wireless_rfkill,
> > - !(device_state & ACER_WMID3_GDS_WIRELESS));
> > - if (has_cap(ACER_CAP_BLUETOOTH))
> > - rfkill_set_sw_state(bluetooth_rfkill,
> > - !(device_state & ACER_WMID3_GDS_BLUETOOTH));
> > - if (has_cap(ACER_CAP_THREEG))
> > - rfkill_set_sw_state(threeg_rfkill,
> > - !(device_state & ACER_WMID3_GDS_THREEG));
> > - }
> > - if (!sparse_keymap_report_event(acer_wmi_input_dev,
> > - return_value.key_num, 1, true))
> > + device_state = return_value.device_state;
> > + pr_debug("device state: 0x%x\n", device_state);
> > +
> > + key = sparse_keymap_entry_from_scancode(acer_wmi_input_dev,
> > + return_value.key_num);
> > + if (!key) {
> > pr_warn("Unknown key number - 0x%x\n",
> > return_value.key_num);
> > + } else {
> > + switch (key->keycode) {
> > + case KEY_WLAN:
> > + case KEY_BLUETOOTH:
> > + if (has_cap(ACER_CAP_WIRELESS))
> > + rfkill_set_sw_state(wireless_rfkill,
> > + !(device_state & ACER_WMID3_GDS_WIRELESS));
> > + if (has_cap(ACER_CAP_THREEG))
> > + rfkill_set_sw_state(threeg_rfkill,
> > + !(device_state & ACER_WMID3_GDS_THREEG));
> > + if (has_cap(ACER_CAP_BLUETOOTH))
> > + rfkill_set_sw_state(bluetooth_rfkill,
> > + !(device_state & ACER_WMID3_GDS_BLUETOOTH));
> > + break;
> > + }
> > + sparse_keymap_report_entry(acer_wmi_input_dev, key,
> > + 1, true);
> > + }
> > break;
> > default:
> > pr_warn("Unknown function number - %d - %d\n",
>
> Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
>
> Tested on Acer TravelMate 8572, patch works no problem!
>
>
> Thank's for your patch!
> Joey Lee
>
> --
> To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
We need include this patch to 3.0-rc5 for avoid regression issue when
acer-wmi received non-zero result from non-communication key.
I just reviewed document, non-communication key event need return zero
result for communication devices state, but buggy BIOS didn't 100%
follow it.
Thank's a lot!
Joey Lee
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: acer-wmi problem handling device states from WMI events
@ 2011-06-21 10:30 Joey Lee
0 siblings, 0 replies; 10+ messages in thread
From: Joey Lee @ 2011-06-21 10:30 UTC (permalink / raw)
To: Joey Lee; +Cc: seth.forshee, platform-driver-x86
於 二,2011-06-21 於 10:16 +0000,joeyli(Joey Lee) 提到:
> Hi Seth,
>
> 於 一,2011-06-20 於 14:06 -0500,Seth Forshee 提到:
> > Hi Joey,
> >
> > acer-wmi is indiscriminately using the device state from hotkey events
> > to update the various rfkill states. On the Aspire 1830 this can result
> > in a soft block on the wlan when the touchpad hotkey is pressed, as it
> > is reporting a non-zero device state that does not reflect the wireless
> > status.
> >
>
> Thank's for you found out this issue, I didn't meet it because touchpad
> hotkey didn't emit any wmi event on my Acer TravelMate 8572.
>
> I will double check it.
>
Just checked, it also emit touchpad wmi event, I missed it.
Will test your patch, I will check KEY_WLAN and KEY_BLUETOOTH in the
same case to update killswitch states.
Thank's a lot1
Joey Lee
> > I beleive the following (untested) patch is a roughly correct fix for
> > this issue. It changes acer-wmi to only update the rfkill states when
> > the appropriate hotkeys are pressed, but I'm a little unsure about the
> > way I've split out the rfkill updates acording to the hotkeys. I don't
> > see any support in the driver for a 3G hotkey, so I've grouped it with
> > the wlan key, and I have split out bluetooth to be handled separately
> > from these. Does this patch look correct?
> >
> > Thanks,
> > Seth
> >
>
> Yes, I thought your patch can avoid acer-wmi update killswitch state
> base on the result from non-Communication button.
>
> On some Acer machines only have one wireless key, the key only emit
> KEY_WIRELESS but EC updates 3 communication devices' states, I thought
> we can direct update 3 killswitch state when received KEY_WLAN or
> KEY_BLUETOOTH. maybe like this:
>
> + switch (key->keycode) {
> + case KEY_WLAN:
> + case KEY_BLUETOOTH:
> + if (has_cap(ACER_CAP_WIRELESS))
> + rfkill_set_sw_state(wireless_rfkill,
> + !(device_state & ACER_WMID3_GDS_WIRELESS));
> + if (has_cap(ACER_CAP_THREEG))
> + rfkill_set_sw_state(threeg_rfkill,
> + !(device_state & ACER_WMID3_GDS_THREEG));
> + if (has_cap(ACER_CAP_BLUETOOTH))
> + rfkill_set_sw_state(bluetooth_rfkill,
> + !(device_state & ACER_WMID3_GDS_BLUETOOTH));
> + break;
> + }
> + sparse_keymap_report_entry(acer_wmi_input_dev, key,
> + 1, true);
>
> Of course need more testing on my and your Acer machines.
> I will double check this patch on my TravelMate 8572 then reply result
> on this mail tomorrow.
>
>
> Thank's a lot!
> Joey Lee
>
> >
> > diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
> > index 005417b..592328d 100644
> > --- a/drivers/platform/x86/acer-wmi.c
> > +++ b/drivers/platform/x86/acer-wmi.c
> > @@ -1445,6 +1445,8 @@ static void acer_wmi_notify(u32 value, void *context)
> > union acpi_object *obj;
> > struct event_return_value return_value;
> > acpi_status status;
> > + u16 device_state;
> > + const struct key_entry *key;
> >
> > status = wmi_get_event_data(value, &response);
> > if (status != AE_OK) {
> > @@ -1472,23 +1474,33 @@ static void acer_wmi_notify(u32 value, void *context)
> >
> > switch (return_value.function) {
> > case WMID_HOTKEY_EVENT:
> > - if (return_value.device_state) {
> > - u16 device_state = return_value.device_state;
> > - pr_debug("device state: 0x%x\n", device_state);
> > - if (has_cap(ACER_CAP_WIRELESS))
> > - rfkill_set_sw_state(wireless_rfkill,
> > - !(device_state & ACER_WMID3_GDS_WIRELESS));
> > - if (has_cap(ACER_CAP_BLUETOOTH))
> > - rfkill_set_sw_state(bluetooth_rfkill,
> > - !(device_state & ACER_WMID3_GDS_BLUETOOTH));
> > - if (has_cap(ACER_CAP_THREEG))
> > - rfkill_set_sw_state(threeg_rfkill,
> > - !(device_state & ACER_WMID3_GDS_THREEG));
> > - }
> > - if (!sparse_keymap_report_event(acer_wmi_input_dev,
> > - return_value.key_num, 1, true))
> > + device_state = return_value.device_state;
> > + pr_debug("device state: 0x%x\n", device_state);
> > +
> > + key = sparse_keymap_entry_from_scancode(acer_wmi_input_dev,
> > + return_value.key_num);
> > + if (!key) {
> > pr_warn("Unknown key number - 0x%x\n",
> > return_value.key_num);
> > + } else {
> > + switch (key->keycode) {
> > + case KEY_WLAN:
> > + if (has_cap(ACER_CAP_WIRELESS))
> > + rfkill_set_sw_state(wireless_rfkill,
> > + !(device_state & ACER_WMID3_GDS_WIRELESS));
> > + if (has_cap(ACER_CAP_THREEG))
> > + rfkill_set_sw_state(threeg_rfkill,
> > + !(device_state & ACER_WMID3_GDS_THREEG));
> > + break;
> > + case KEY_BLUETOOTH:
> > + if (has_cap(ACER_CAP_BLUETOOTH))
> > + rfkill_set_sw_state(bluetooth_rfkill,
> > + !(device_state & ACER_WMID3_GDS_BLUETOOTH));
> > + break;
> > + }
> > + sparse_keymap_report_entry(acer_wmi_input_dev, key,
> > + 1, true);
> > + }
> > break;
> > default:
> > pr_warn("Unknown function number - %d - %d\n",
>
^ permalink raw reply [flat|nested] 10+ messages in thread* acer-wmi problem handling device states from WMI events
@ 2011-06-20 19:06 Seth Forshee
0 siblings, 0 replies; 10+ messages in thread
From: Seth Forshee @ 2011-06-20 19:06 UTC (permalink / raw)
To: Joey Lee; +Cc: platform-driver-x86
Hi Joey,
acer-wmi is indiscriminately using the device state from hotkey events
to update the various rfkill states. On the Aspire 1830 this can result
in a soft block on the wlan when the touchpad hotkey is pressed, as it
is reporting a non-zero device state that does not reflect the wireless
status.
I beleive the following (untested) patch is a roughly correct fix for
this issue. It changes acer-wmi to only update the rfkill states when
the appropriate hotkeys are pressed, but I'm a little unsure about the
way I've split out the rfkill updates acording to the hotkeys. I don't
see any support in the driver for a 3G hotkey, so I've grouped it with
the wlan key, and I have split out bluetooth to be handled separately
from these. Does this patch look correct?
Thanks,
Seth
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 005417b..592328d 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1445,6 +1445,8 @@ static void acer_wmi_notify(u32 value, void *context)
union acpi_object *obj;
struct event_return_value return_value;
acpi_status status;
+ u16 device_state;
+ const struct key_entry *key;
status = wmi_get_event_data(value, &response);
if (status != AE_OK) {
@@ -1472,23 +1474,33 @@ static void acer_wmi_notify(u32 value, void *context)
switch (return_value.function) {
case WMID_HOTKEY_EVENT:
- if (return_value.device_state) {
- u16 device_state = return_value.device_state;
- pr_debug("device state: 0x%x\n", device_state);
- if (has_cap(ACER_CAP_WIRELESS))
- rfkill_set_sw_state(wireless_rfkill,
- !(device_state & ACER_WMID3_GDS_WIRELESS));
- if (has_cap(ACER_CAP_BLUETOOTH))
- rfkill_set_sw_state(bluetooth_rfkill,
- !(device_state & ACER_WMID3_GDS_BLUETOOTH));
- if (has_cap(ACER_CAP_THREEG))
- rfkill_set_sw_state(threeg_rfkill,
- !(device_state & ACER_WMID3_GDS_THREEG));
- }
- if (!sparse_keymap_report_event(acer_wmi_input_dev,
- return_value.key_num, 1, true))
+ device_state = return_value.device_state;
+ pr_debug("device state: 0x%x\n", device_state);
+
+ key = sparse_keymap_entry_from_scancode(acer_wmi_input_dev,
+ return_value.key_num);
+ if (!key) {
pr_warn("Unknown key number - 0x%x\n",
return_value.key_num);
+ } else {
+ switch (key->keycode) {
+ case KEY_WLAN:
+ if (has_cap(ACER_CAP_WIRELESS))
+ rfkill_set_sw_state(wireless_rfkill,
+ !(device_state & ACER_WMID3_GDS_WIRELESS));
+ if (has_cap(ACER_CAP_THREEG))
+ rfkill_set_sw_state(threeg_rfkill,
+ !(device_state & ACER_WMID3_GDS_THREEG));
+ break;
+ case KEY_BLUETOOTH:
+ if (has_cap(ACER_CAP_BLUETOOTH))
+ rfkill_set_sw_state(bluetooth_rfkill,
+ !(device_state & ACER_WMID3_GDS_BLUETOOTH));
+ break;
+ }
+ sparse_keymap_report_entry(acer_wmi_input_dev, key,
+ 1, true);
+ }
break;
default:
pr_warn("Unknown function number - %d - %d\n",
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-06-22 20:50 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21 10:16 acer-wmi problem handling device states from WMI events Joey Lee
2011-06-21 13:14 ` Seth Forshee
2011-06-21 16:58 ` Seth Forshee
2011-06-21 17:00 ` [PATCH 1/2] acer-wmi: Add support for Aspire 1830 wlan hotkey Seth Forshee
2011-06-22 10:14 ` Joey Lee
2011-06-21 17:00 ` [PATCH 2/2] acer-wmi: Only update rfkill status for associated hotkey events Seth Forshee
2011-06-22 10:15 ` Joey Lee
2011-06-22 20:50 ` Joey Lee
-- strict thread matches above, loose matches on Subject: below --
2011-06-21 10:30 acer-wmi problem handling device states from WMI events Joey Lee
2011-06-20 19:06 Seth Forshee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox