From patchwork Fri Jul 13 06:52:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chia-Lin Kao (AceLan)" X-Patchwork-Id: 1193951 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 3A02EDFFFD for ; Fri, 13 Jul 2012 06:52:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753415Ab2GMGww (ORCPT ); Fri, 13 Jul 2012 02:52:52 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:62877 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752960Ab2GMGwv (ORCPT ); Fri, 13 Jul 2012 02:52:51 -0400 Received: by pbbrp8 with SMTP id rp8so5017851pbb.19 for ; Thu, 12 Jul 2012 23:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer; bh=VY6Puelx7coS480/d/N50rv4bI/G2BRwumOpVT4FkMg=; b=KWwMqFOjvEbp7HONIDYfKfyPQI6ATFCnVc2fyLVjHxO5nszOK7lmlPZIK9VXmWtamv fJW3proSjc9jCHeuYnJ31EjsHwtFA2ETN2O3hB4cj40y0HcHM8O7ZVyxFkYtLlEKoPZ0 tEqo2cD8hSn64aVil6/zKtHbuM44QzV6HFn7mewVugTbb9oo+65AcgbvxukSzRe1qXqP OXYOJOIaEtS2OZ8sCKjoUzqpRk0d7SSsMJZ28mmqgiYqlXvqCn8i4uxJXV+zcTl2uCsx MoAcbONa9czhIla7T00d4HZ3gbdnwx1GfOV5NOHkcYIMkyLKvez1pQggkoHG8wlUqrHS 3pIA== Received: by 10.68.192.73 with SMTP id he9mr1471855pbc.17.1342162371359; Thu, 12 Jul 2012 23:52:51 -0700 (PDT) Received: from localhost ([210.242.151.101]) by mx.google.com with ESMTPS id mt9sm5432881pbb.14.2012.07.12.23.52.49 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 Jul 2012 23:52:50 -0700 (PDT) From: AceLan Kao To: linux-acpi@vger.kernel.org, Zhang Rui , Corentin Chary Subject: [PATCH] ACPI video: prevent from reporting birghtness keyevents Date: Fri, 13 Jul 2012 14:52:47 +0800 Message-Id: <1342162367-10467-1-git-send-email-acelan.kao@canonical.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Prevent ACPI video from reporting brightness keyevents if the driver already adjust the brightness, or userspace app will adjust the brightness value again. We should distinguish keyevent from uevent, keyevent is used to inform the usespace app to do what the meaning of the key is. And uevent is used to say that the required action is already taken, userspace app could monitor uevent to show OSD or do any kind of notification they want. The backlight subsystem will emit the uevent once the brightness had changed, so ACPI video driver doesn't have to report the keyevent. Signed-off-by: AceLan Kao --- drivers/acpi/video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 1e0a9e1..221cff2 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -1546,7 +1546,8 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) acpi_notifier_call_chain(device, event, 0); - if (keycode) { + /* Report keyevent only if the driver didn't adjust the brightness */ + if (keycode && !brightness_switch_enabled) { input_report_key(input, keycode, 1); input_sync(input); input_report_key(input, keycode, 0);