diff options
author | Matthew Garrett <mjg@redhat.com> | 2009-12-11 17:40:46 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2010-04-04 01:29:12 -0400 |
commit | 17c452f99cf5e073b219a069a419b7b8ab3cfa97 (patch) | |
tree | 89701fc421ce40706f6ac01f7f75c28444a46d48 /drivers/acpi/video.c | |
parent | 2eaa9cfdf33b8d7fb7aff27792192e0019ae8fc6 (diff) |
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: Matthew Garrett <mjg@redhat.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index cbe6f3924a10..2c7ca7a4a146 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -2122,7 +2122,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) | |||
2122 | { | 2122 | { |
2123 | struct acpi_video_bus *video = acpi_driver_data(device); | 2123 | struct acpi_video_bus *video = acpi_driver_data(device); |
2124 | struct input_dev *input; | 2124 | struct input_dev *input; |
2125 | int keycode; | 2125 | int keycode = 0; |
2126 | 2126 | ||
2127 | if (!video) | 2127 | if (!video) |
2128 | return; | 2128 | return; |
@@ -2158,17 +2158,19 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) | |||
2158 | break; | 2158 | break; |
2159 | 2159 | ||
2160 | default: | 2160 | default: |
2161 | keycode = KEY_UNKNOWN; | ||
2162 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 2161 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
2163 | "Unsupported event [0x%x]\n", event)); | 2162 | "Unsupported event [0x%x]\n", event)); |
2164 | break; | 2163 | break; |
2165 | } | 2164 | } |
2166 | 2165 | ||
2167 | acpi_notifier_call_chain(device, event, 0); | 2166 | acpi_notifier_call_chain(device, event, 0); |
2168 | input_report_key(input, keycode, 1); | 2167 | |
2169 | input_sync(input); | 2168 | if (keycode) { |
2170 | input_report_key(input, keycode, 0); | 2169 | input_report_key(input, keycode, 1); |
2171 | input_sync(input); | 2170 | input_sync(input); |
2171 | input_report_key(input, keycode, 0); | ||
2172 | input_sync(input); | ||
2173 | } | ||
2172 | 2174 | ||
2173 | return; | 2175 | return; |
2174 | } | 2176 | } |
@@ -2179,7 +2181,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
2179 | struct acpi_device *device = NULL; | 2181 | struct acpi_device *device = NULL; |
2180 | struct acpi_video_bus *bus; | 2182 | struct acpi_video_bus *bus; |
2181 | struct input_dev *input; | 2183 | struct input_dev *input; |
2182 | int keycode; | 2184 | int keycode = 0; |
2183 | 2185 | ||
2184 | if (!video_device) | 2186 | if (!video_device) |
2185 | return; | 2187 | return; |
@@ -2220,17 +2222,19 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
2220 | keycode = KEY_DISPLAY_OFF; | 2222 | keycode = KEY_DISPLAY_OFF; |
2221 | break; | 2223 | break; |
2222 | default: | 2224 | default: |
2223 | keycode = KEY_UNKNOWN; | ||
2224 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 2225 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
2225 | "Unsupported event [0x%x]\n", event)); | 2226 | "Unsupported event [0x%x]\n", event)); |
2226 | break; | 2227 | break; |
2227 | } | 2228 | } |
2228 | 2229 | ||
2229 | acpi_notifier_call_chain(device, event, 0); | 2230 | acpi_notifier_call_chain(device, event, 0); |
2230 | input_report_key(input, keycode, 1); | 2231 | |
2231 | input_sync(input); | 2232 | if (keycode) { |
2232 | input_report_key(input, keycode, 0); | 2233 | input_report_key(input, keycode, 1); |
2233 | input_sync(input); | 2234 | input_sync(input); |
2235 | input_report_key(input, keycode, 0); | ||
2236 | input_sync(input); | ||
2237 | } | ||
2234 | 2238 | ||
2235 | return; | 2239 | return; |
2236 | } | 2240 | } |
@@ -2357,7 +2361,6 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
2357 | set_bit(KEY_BRIGHTNESSDOWN, input->keybit); | 2361 | set_bit(KEY_BRIGHTNESSDOWN, input->keybit); |
2358 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); | 2362 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); |
2359 | set_bit(KEY_DISPLAY_OFF, input->keybit); | 2363 | set_bit(KEY_DISPLAY_OFF, input->keybit); |
2360 | set_bit(KEY_UNKNOWN, input->keybit); | ||
2361 | 2364 | ||
2362 | error = input_register_device(input); | 2365 | error = input_register_device(input); |
2363 | if (error) | 2366 | if (error) |