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>
This commit is contained in:
parent
4dd1b49c6d
commit
92530664bb
|
@ -1445,6 +1445,8 @@ static void acer_wmi_notify(u32 value, void *context)
|
||||||
union acpi_object *obj;
|
union acpi_object *obj;
|
||||||
struct event_return_value return_value;
|
struct event_return_value return_value;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
u16 device_state;
|
||||||
|
const struct key_entry *key;
|
||||||
|
|
||||||
status = wmi_get_event_data(value, &response);
|
status = wmi_get_event_data(value, &response);
|
||||||
if (status != AE_OK) {
|
if (status != AE_OK) {
|
||||||
|
@ -1472,23 +1474,32 @@ static void acer_wmi_notify(u32 value, void *context)
|
||||||
|
|
||||||
switch (return_value.function) {
|
switch (return_value.function) {
|
||||||
case WMID_HOTKEY_EVENT:
|
case WMID_HOTKEY_EVENT:
|
||||||
if (return_value.device_state) {
|
device_state = return_value.device_state;
|
||||||
u16 device_state = return_value.device_state;
|
|
||||||
pr_debug("device state: 0x%x\n", 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))
|
if (has_cap(ACER_CAP_WIRELESS))
|
||||||
rfkill_set_sw_state(wireless_rfkill,
|
rfkill_set_sw_state(wireless_rfkill,
|
||||||
!(device_state & ACER_WMID3_GDS_WIRELESS));
|
!(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))
|
if (has_cap(ACER_CAP_THREEG))
|
||||||
rfkill_set_sw_state(threeg_rfkill,
|
rfkill_set_sw_state(threeg_rfkill,
|
||||||
!(device_state & ACER_WMID3_GDS_THREEG));
|
!(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);
|
||||||
}
|
}
|
||||||
if (!sparse_keymap_report_event(acer_wmi_input_dev,
|
|
||||||
return_value.key_num, 1, true))
|
|
||||||
pr_warn("Unknown key number - 0x%x\n",
|
|
||||||
return_value.key_num);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
pr_warn("Unknown function number - %d - %d\n",
|
pr_warn("Unknown function number - %d - %d\n",
|
||||||
|
|
Loading…
Reference in New Issue