Skip to content
Snippets Groups Projects
Commit 17c452f9 authored by Matthew Garrett's avatar Matthew Garrett Committed by Len Brown
Browse files

ACPI: Don't send KEY_UNKNOWN for random video notifications


I have a machine here that's sending 0xD1 notifications on the video
device once every second or so. I have no idea why (it's a prototype,
it may be broken), but sending KEY_UNKNOWN is unhelpful and results in
the console becoming unusable. Let's not report keys unless we have
something useful to say about them.

Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
Acked-by: default avatarZhang Rui <rui.zhang@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 2eaa9cfd
No related branches found
No related tags found
No related merge requests found
...@@ -2122,7 +2122,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) ...@@ -2122,7 +2122,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
{ {
struct acpi_video_bus *video = acpi_driver_data(device); struct acpi_video_bus *video = acpi_driver_data(device);
struct input_dev *input; struct input_dev *input;
int keycode; int keycode = 0;
if (!video) if (!video)
return; return;
...@@ -2158,17 +2158,19 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) ...@@ -2158,17 +2158,19 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
break; break;
default: default:
keycode = KEY_UNKNOWN;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Unsupported event [0x%x]\n", event)); "Unsupported event [0x%x]\n", event));
break; break;
} }
acpi_notifier_call_chain(device, event, 0); acpi_notifier_call_chain(device, event, 0);
input_report_key(input, keycode, 1);
input_sync(input); if (keycode) {
input_report_key(input, keycode, 0); input_report_key(input, keycode, 1);
input_sync(input); input_sync(input);
input_report_key(input, keycode, 0);
input_sync(input);
}
return; return;
} }
...@@ -2179,7 +2181,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) ...@@ -2179,7 +2181,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
struct acpi_video_bus *bus; struct acpi_video_bus *bus;
struct input_dev *input; struct input_dev *input;
int keycode; int keycode = 0;
if (!video_device) if (!video_device)
return; return;
...@@ -2220,17 +2222,19 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) ...@@ -2220,17 +2222,19 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
keycode = KEY_DISPLAY_OFF; keycode = KEY_DISPLAY_OFF;
break; break;
default: default:
keycode = KEY_UNKNOWN;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Unsupported event [0x%x]\n", event)); "Unsupported event [0x%x]\n", event));
break; break;
} }
acpi_notifier_call_chain(device, event, 0); acpi_notifier_call_chain(device, event, 0);
input_report_key(input, keycode, 1);
input_sync(input); if (keycode) {
input_report_key(input, keycode, 0); input_report_key(input, keycode, 1);
input_sync(input); input_sync(input);
input_report_key(input, keycode, 0);
input_sync(input);
}
return; return;
} }
...@@ -2357,7 +2361,6 @@ static int acpi_video_bus_add(struct acpi_device *device) ...@@ -2357,7 +2361,6 @@ static int acpi_video_bus_add(struct acpi_device *device)
set_bit(KEY_BRIGHTNESSDOWN, input->keybit); set_bit(KEY_BRIGHTNESSDOWN, input->keybit);
set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); set_bit(KEY_BRIGHTNESS_ZERO, input->keybit);
set_bit(KEY_DISPLAY_OFF, input->keybit); set_bit(KEY_DISPLAY_OFF, input->keybit);
set_bit(KEY_UNKNOWN, input->keybit);
error = input_register_device(input); error = input_register_device(input);
if (error) if (error)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment