From patchwork Thu Oct 8 09:07:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Pribnow X-Patchwork-Id: 7350551 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2600CBEEA4 for ; Thu, 8 Oct 2015 09:07:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1BDF2207C2 for ; Thu, 8 Oct 2015 09:07:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29C40207BD for ; Thu, 8 Oct 2015 09:07:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754017AbbJHJHX (ORCPT ); Thu, 8 Oct 2015 05:07:23 -0400 Received: from mout.gmx.net ([212.227.15.19]:64408 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753015AbbJHJHV (ORCPT ); Thu, 8 Oct 2015 05:07:21 -0400 Received: from [127.0.0.1] ([77.20.148.56]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0MSMw7-1aCTo42y2F-00TUxJ; Thu, 08 Oct 2015 11:07:11 +0200 From: Hauke Pribnow Subject: [2/2] Input: input.h - Add and extend KEY_* usage detail comments To: linux-input@vger.kernel.org Cc: anssi.hannula@iki.fi Message-ID: <56163238.1090709@gmx.net> Date: Thu, 8 Oct 2015 11:07:04 +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:We0Z9v1Gu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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 --- 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(-) #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 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. */