From patchwork Fri Dec 11 22:40:46 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Garrett X-Patchwork-Id: 66786 X-Patchwork-Delegate: rui.zhang@intel.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nBBMf99B026567 for ; Fri, 11 Dec 2009 22:41:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761406AbZLKWk7 (ORCPT ); Fri, 11 Dec 2009 17:40:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1761452AbZLKWk7 (ORCPT ); Fri, 11 Dec 2009 17:40:59 -0500 Received: from cavan.codon.org.uk ([93.93.128.6]:56707 "EHLO cavan.codon.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761406AbZLKWk6 (ORCPT ); Fri, 11 Dec 2009 17:40:58 -0500 Received: from lan-nat-pool-bos.redhat.com ([66.187.234.200] helo=localhost.localdomain) by cavan.codon.org.uk with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NJEAU-0002PK-W9; Fri, 11 Dec 2009 22:40:59 +0000 From: Matthew Garrett To: linux-acpi@vger.kernel.org Cc: lenb@kernel.org, Matthew Garrett Subject: [PATCH] acpi: Don't send KEY_UNKNOWN for random video notifications Date: Fri, 11 Dec 2009 17:40:46 -0500 Message-Id: <1260571246-24582-1-git-send-email-mjg@redhat.com> X-Mailer: git-send-email 1.6.5.2 X-SA-Do-Not-Run: Yes X-SA-Exim-Connect-IP: 66.187.234.200 X-SA-Exim-Mail-From: mjg@redhat.com X-SA-Exim-Scanned: No (on cavan.codon.org.uk); SAEximRunCond expanded to false Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 05dff63..655183c 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -2100,7 +2100,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) { struct acpi_video_bus *video = acpi_driver_data(device); struct input_dev *input; - int keycode; + int keycode = 0; if (!video) return; @@ -2136,17 +2136,19 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) break; default: - keycode = KEY_UNKNOWN; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported event [0x%x]\n", event)); break; } acpi_notifier_call_chain(device, event, 0); - input_report_key(input, keycode, 1); - input_sync(input); - input_report_key(input, keycode, 0); - input_sync(input); + + if (keycode) { + input_report_key(input, keycode, 1); + input_sync(input); + input_report_key(input, keycode, 0); + input_sync(input); + } return; } @@ -2157,7 +2159,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) struct acpi_device *device = NULL; struct acpi_video_bus *bus; struct input_dev *input; - int keycode; + int keycode = 0; if (!video_device) return; @@ -2198,17 +2200,19 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) keycode = KEY_DISPLAY_OFF; break; default: - keycode = KEY_UNKNOWN; ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unsupported event [0x%x]\n", event)); break; } acpi_notifier_call_chain(device, event, 0); - input_report_key(input, keycode, 1); - input_sync(input); - input_report_key(input, keycode, 0); - input_sync(input); + + if (keycode) { + input_report_key(input, keycode, 1); + input_sync(input); + input_report_key(input, keycode, 0); + input_sync(input); + } return; } @@ -2299,7 +2303,6 @@ static int acpi_video_bus_add(struct acpi_device *device) set_bit(KEY_BRIGHTNESSDOWN, input->keybit); set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); set_bit(KEY_DISPLAY_OFF, input->keybit); - set_bit(KEY_UNKNOWN, input->keybit); error = input_register_device(input); if (error)