diff options
author | Seth Forshee <seth.forshee@canonical.com> | 2011-06-21 13:00:33 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2011-07-07 10:38:56 -0400 |
commit | 92530664bbe5a13aede4a8763459bbe560ad9221 (patch) | |
tree | 8796470b6b0dcc74c0ce84ce556ea266172dde69 | |
parent | 4dd1b49c6d215dc41ce50c80b4868388b93f31a3 (diff) |
acer-wmi: Only update rfkill status for associated hotkey events
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>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
-rw-r--r-- | 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 005417bd429e..942798ca96bc 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) | |||
1445 | union acpi_object *obj; | 1445 | union acpi_object *obj; |
1446 | struct event_return_value return_value; | 1446 | struct event_return_value return_value; |
1447 | acpi_status status; | 1447 | acpi_status status; |
1448 | u16 device_state; | ||
1449 | const struct key_entry *key; | ||
1448 | 1450 | ||
1449 | status = wmi_get_event_data(value, &response); | 1451 | status = wmi_get_event_data(value, &response); |
1450 | if (status != AE_OK) { | 1452 | if (status != AE_OK) { |
@@ -1472,23 +1474,32 @@ static void acer_wmi_notify(u32 value, void *context) | |||
1472 | 1474 | ||
1473 | switch (return_value.function) { | 1475 | switch (return_value.function) { |
1474 | case WMID_HOTKEY_EVENT: | 1476 | case WMID_HOTKEY_EVENT: |
1475 | if (return_value.device_state) { | 1477 | device_state = return_value.device_state; |
1476 | u16 device_state = return_value.device_state; | 1478 | pr_debug("device state: 0x%x\n", device_state); |
1477 | pr_debug("device state: 0x%x\n", device_state); | 1479 | |
1478 | if (has_cap(ACER_CAP_WIRELESS)) | 1480 | key = sparse_keymap_entry_from_scancode(acer_wmi_input_dev, |
1479 | rfkill_set_sw_state(wireless_rfkill, | 1481 | return_value.key_num); |
1480 | !(device_state & ACER_WMID3_GDS_WIRELESS)); | 1482 | if (!key) { |
1481 | if (has_cap(ACER_CAP_BLUETOOTH)) | ||
1482 | rfkill_set_sw_state(bluetooth_rfkill, | ||
1483 | !(device_state & ACER_WMID3_GDS_BLUETOOTH)); | ||
1484 | if (has_cap(ACER_CAP_THREEG)) | ||
1485 | rfkill_set_sw_state(threeg_rfkill, | ||
1486 | !(device_state & ACER_WMID3_GDS_THREEG)); | ||
1487 | } | ||
1488 | if (!sparse_keymap_report_event(acer_wmi_input_dev, | ||
1489 | return_value.key_num, 1, true)) | ||
1490 | pr_warn("Unknown key number - 0x%x\n", | 1483 | pr_warn("Unknown key number - 0x%x\n", |
1491 | return_value.key_num); | 1484 | return_value.key_num); |
1485 | } else { | ||
1486 | switch (key->keycode) { | ||
1487 | case KEY_WLAN: | ||
1488 | case KEY_BLUETOOTH: | ||
1489 | if (has_cap(ACER_CAP_WIRELESS)) | ||
1490 | rfkill_set_sw_state(wireless_rfkill, | ||
1491 | !(device_state & ACER_WMID3_GDS_WIRELESS)); | ||
1492 | if (has_cap(ACER_CAP_THREEG)) | ||
1493 | rfkill_set_sw_state(threeg_rfkill, | ||
1494 | !(device_state & ACER_WMID3_GDS_THREEG)); | ||
1495 | if (has_cap(ACER_CAP_BLUETOOTH)) | ||
1496 | rfkill_set_sw_state(bluetooth_rfkill, | ||
1497 | !(device_state & ACER_WMID3_GDS_BLUETOOTH)); | ||
1498 | break; | ||
1499 | } | ||
1500 | sparse_keymap_report_entry(acer_wmi_input_dev, key, | ||
1501 | 1, true); | ||
1502 | } | ||
1492 | break; | 1503 | break; |
1493 | default: | 1504 | default: |
1494 | pr_warn("Unknown function number - %d - %d\n", | 1505 | pr_warn("Unknown function number - %d - %d\n", |