From patchwork Thu Oct 8 09:58:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Pribnow X-Patchwork-Id: 7351011 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 487C69F4DC for ; Thu, 8 Oct 2015 09:58:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E67F207D0 for ; Thu, 8 Oct 2015 09:58:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27E08207CF for ; Thu, 8 Oct 2015 09:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753595AbbJHJ6p (ORCPT ); Thu, 8 Oct 2015 05:58:45 -0400 Received: from mout.gmx.net ([212.227.15.18]:49259 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753848AbbJHJ6m (ORCPT ); Thu, 8 Oct 2015 05:58:42 -0400 Received: from [127.0.0.1] ([77.20.148.56]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0Lj1Cw-1aJzwv48li-00dBvi; Thu, 08 Oct 2015 11:58:40 +0200 From: Hauke Pribnow Subject: [2/2 v2] Input: input.h - Add and extend KEY_* usage detail comments To: linux-input@vger.kernel.org Cc: anssi.hannula@iki.fi Message-ID: <56163E47.1000000@gmx.net> Date: Thu, 8 Oct 2015 11:58:31 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-Antivirus: avast! (VPS 151007-2, 07.10.2015), Outbound message X-Antivirus-Status: Clean X-Provags-ID: V03:K0:8aJbQN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PMRxX Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The KEY_* definitions in input.h had no formal functional definitions when they were first introduced. This led to a situation where some keys were used inconsistently across different drivers. For example, KEY_POWER was used both in some very low-level situations (where pressing the key should directly shut down the whole system) and on high-level home media remote controls (where the pressing the key should either make the system go to some standby mode or should even just quit some currently running application). To reach a more consistent usage of KEY_* definitions, it is crucial to add and extend comments in input.h to assign functional key definitions to KEY_* definitions, preferrably based on the USB HID Usage Tables for keys that are not defined in such a way yet. This patch mainly adds such funtional definitions for KEY_POWER and KEY_POWER2. It further adds some information on how these definitions are related to each other. Signed-off-by: Hauke Pribnow --- (This is a re-submission because my e-mail client broke the patch by wrapping long lines. Sorry for that!) Hello again, similar to the first patch, this patch also deals with KEY_* definition usage inconsistencies. See more details in the additional information text of the prior patch mail. I found out that most remote controls use KEY_POWER2 and most integrated devices (that have their own power button) use KEY_POWER. However, this is unfortunately not always the case, so some remote controls also use KEY_POWER. This calls for a better functional definition of the two buttons. The reason why I split up my attempt to functionally define the keys better into two patches is that I'm not completely sure if I "interpreted" KEY_POWER2 correctly. As written in the comments for that KEY_* definition below, I did not find an entry in the USB HID Usage Tables that would match KEY_POWER2 well. I did find a "Quit" entry in the Tables under 15.6 though... but I'm not sure if that would quite fit to KEY_POWER2. That's why I was hoping for some additional ideas on how this situation might be resolved better. Thanks a lot for any kind of feedback in advance, Hauke include/uapi/linux/input.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index 731417c..bffcd2c 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h @@ -328,7 +328,10 @@ struct input_keymap_entry { #define KEY_MUTE 113 #define KEY_VOLUMEDOWN 114 #define KEY_VOLUMEUP 115 -#define KEY_POWER 116 /* SC System Power Down */ +#define KEY_POWER 116 /* SC System Power Down (USB HID + Usage Tables 4.5.1). Use KEY_POWER2 + for a less "powerful" power button. + See comment there for details. */ #define KEY_KPEQUAL 117 #define KEY_KPPLUSMINUS 118 #define KEY_PAUSE 119 @@ -357,8 +360,10 @@ struct input_keymap_entry { #define KEY_MENU 139 /* Menu (show menu) */ #define KEY_CALC 140 /* AL Calculator */ #define KEY_SETUP 141 -#define KEY_SLEEP 142 /* SC System Sleep */ -#define KEY_WAKEUP 143 /* System Wake Up */ +#define KEY_SLEEP 142 /* SC System Sleep (USB HID Tables + 4.5.1) */ +#define KEY_WAKEUP 143 /* SC System Wake Up (USB HID Tables + 4.5.1) */ #define KEY_FILE 144 /* AL Local Machine Browser */ #define KEY_SENDFILE 145 #define KEY_DELETEFILE 146 @@ -562,7 +567,14 @@ struct input_keymap_entry { #define KEY_SELECT 0x161 #define KEY_GOTO 0x162 #define KEY_CLEAR 0x163 -#define KEY_POWER2 0x164 +#define KEY_POWER2 0x164 /* A less "powerful" power key like the + power key on a remote that typically + does not power down your whole + system but either puts it into some + standby mode or just exits some + currently running application. (A + key like this is not defined in the + USB HID Usage Tables.) */ #define KEY_OPTION 0x165 #define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */ #define KEY_TIME 0x167