Skip to contentSkip to conversation

HID: add missing hid usages

PATCH Superseded Olivier Gay 3 participants 7 messages Apr 4, 2014 – Apr 25, 2014

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: add missing hid usages

Add some missing hid usages from consumer page, add display brightness control usages from approved hid usage table request HUTTR41:
http://www.usb.org/developers/hidpage/HUTRR41.pdf
and add voice command usage from approved request HUTTR45:
http://www.usb.org/developers/hidpage/Voice_Command_Usage.pdf

---

Hi all,

with this patch we add some missing hid usages to the hid system. Those missing hid usages are already used by some Logitech products as well as some future ones.

(Note: checkpatch.pl shows some errors but I didn't want to break the current code style in hid-input.c)

Best regards,

Olivier

 drivers/hid/hid-debug.c    | 14 ++++++++++++++
 drivers/hid/hid-input.c    | 15 +++++++++++++++
 include/uapi/linux/input.h | 16 ++++++++++++++++
 3 files changed, 45 insertions(+)
drivers/hid/hid-debug.c +14 -0
index 53b771d..742d78b 100644
@@ -855,6 +855,20 @@ static const char *keys[KEY_MAX + 1] = {
 	[KEY_KBDILLUMDOWN] = "KbdIlluminationDown",
 	[KEY_KBDILLUMUP] = "KbdIlluminationUp",
 	[KEY_SWITCHVIDEOMODE] = "SwitchVideoMode",
+	[KEY_BUTTONCONFIG] = "ButtonConfig",
+	[KEY_TASKMANAGER] = "TaskManager",
+	[KEY_JOURNAL] = "Journal",
+	[KEY_CONTROLPANEL] = "ControlPanel",
+	[KEY_APPSELECT] = "AppSelect",
+	[KEY_SCREENSAVER] = "ScreenSaver",
+	[KEY_VOICECOMMAND] = "VoiceCommand",
+	[KEY_BRIGHTNESS_INC] = "BrightnessInc",
+	[KEY_BRIGHTNESS_DEC] = "BrightnessDec",
+	[KEY_BRIGHTNESS] = "Brightness",
+	[KEY_BRIGHTNESS_TOGGLE] = "BrightnessToggle",
+	[KEY_BRIGHTNESS_MIN] = "BrightnessMin",
+	[KEY_BRIGHTNESS_MAX] = "BrightnessMax",
+	[KEY_BRIGHTNESS_AUTO] = "BrightnessAuto",
 };
 
 static const char *relatives[REL_MAX + 1] = {
drivers/hid/hid-input.c +15 -0
index 930382e..e1409da 100644
@@ -721,6 +721,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x06c: map_key_clear(KEY_YELLOW);		break;
 		case 0x06d: map_key_clear(KEY_ZOOM);		break;
 
+		case 0x06f: map_key_clear(KEY_BRIGHTNESS_INC);		break;
+		case 0x070: map_key_clear(KEY_BRIGHTNESS_DEC);		break;
+		case 0x071: map_key_clear(KEY_BRIGHTNESS);		break;
+		case 0x072: map_key_clear(KEY_BRIGHTNESS_TOGGLE);	break;
+		case 0x073: map_key_clear(KEY_BRIGHTNESS_MIN);		break;
+		case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX);		break;
+		case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO);		break;
+
 		case 0x082: map_key_clear(KEY_VIDEO_NEXT);	break;
 		case 0x083: map_key_clear(KEY_LAST);		break;
 		case 0x084: map_key_clear(KEY_ENTER);		break;
@@ -761,6 +769,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x0bf: map_key_clear(KEY_SLOW);		break;
 
 		case 0x0cd: map_key_clear(KEY_PLAYPAUSE);	break;
+		case 0x0cf: map_key_clear(KEY_VOICECOMMAND);	break;
 		case 0x0e0: map_abs_clear(ABS_VOLUME);		break;
 		case 0x0e2: map_key_clear(KEY_MUTE);		break;
 		case 0x0e5: map_key_clear(KEY_BASSBOOST);	break;
@@ -768,6 +777,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x0ea: map_key_clear(KEY_VOLUMEDOWN);	break;
 		case 0x0f5: map_key_clear(KEY_SLOW);		break;
 
+		case 0x181: map_key_clear(KEY_BUTTONCONFIG);	break;
 		case 0x182: map_key_clear(KEY_BOOKMARKS);	break;
 		case 0x183: map_key_clear(KEY_CONFIG);		break;
 		case 0x184: map_key_clear(KEY_WORDPROCESSOR);	break;
@@ -781,6 +791,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x18c: map_key_clear(KEY_VOICEMAIL);	break;
 		case 0x18d: map_key_clear(KEY_ADDRESSBOOK);	break;
 		case 0x18e: map_key_clear(KEY_CALENDAR);	break;
+		case 0x18f: map_key_clear(KEY_TASKMANAGER);	break;
+		case 0x190: map_key_clear(KEY_JOURNAL);		break;
 		case 0x191: map_key_clear(KEY_FINANCE);		break;
 		case 0x192: map_key_clear(KEY_CALC);		break;
 		case 0x193: map_key_clear(KEY_PLAYER);		break;
@@ -789,12 +801,15 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x199: map_key_clear(KEY_CHAT);		break;
 		case 0x19c: map_key_clear(KEY_LOGOFF);		break;
 		case 0x19e: map_key_clear(KEY_COFFEE);		break;
+		case 0x19f: map_key_clear(KEY_CONTROLPANEL);		break;
+		case 0x1a2: map_key_clear(KEY_APPSELECT);		break;
 		case 0x1a3: map_key_clear(KEY_NEXT);		break;
 		case 0x1a4: map_key_clear(KEY_PREVIOUS);	break;
 		case 0x1a6: map_key_clear(KEY_HELP);		break;
 		case 0x1a7: map_key_clear(KEY_DOCUMENTS);	break;
 		case 0x1ab: map_key_clear(KEY_SPELLCHECK);	break;
 		case 0x1ae: map_key_clear(KEY_KEYBOARD);	break;
+		case 0x1b1: map_key_clear(KEY_SCREENSAVER);		break;
 		case 0x1b4: map_key_clear(KEY_FILE);		break;
 		case 0x1b6: map_key_clear(KEY_IMAGES);		break;
 		case 0x1b7: map_key_clear(KEY_AUDIO);		break;
include/uapi/linux/input.h +16 -0
index bd24470..d82454f 100644
@@ -722,6 +722,22 @@ struct input_keymap_entry {
 
 #define KEY_ALS_TOGGLE		0x230	/* Ambient light sensor */
 
+#define KEY_BUTTONCONFIG		0x240	/* AL Button Configuration */
+#define KEY_TASKMANAGER		0x241	/* AL Task/Project Manager */
+#define KEY_JOURNAL		0x242	/* AL Log/Journal/Timecard */
+#define KEY_CONTROLPANEL		0x243	/* AL Control Panel */
+#define KEY_APPSELECT		0x244	/* AL Select Task/Application */
+#define KEY_SCREENSAVER		0x245	/* AL Screen Saver */
+#define KEY_VOICECOMMAND		0x246	/* Listening Voice Command */
+
+#define KEY_BRIGHTNESS_INC		KEY_BRIGHTNESSUP
+#define KEY_BRIGHTNESS_DEC		KEY_BRIGHTNESSDOWN
+#define KEY_BRIGHTNESS		0x250	/* Display Brightness */
+#define KEY_BRIGHTNESS_TOGGLE		0x251	/* Backlight Toggle */
+#define KEY_BRIGHTNESS_MIN		0x252	/* Set Brightness to Minimum */
+#define KEY_BRIGHTNESS_MAX		0x253	/* Set Brightness to Maximum */
+#define KEY_BRIGHTNESS_AUTO		0x254	/* Set Auto Brightness */
+
 #define BTN_TRIGGER_HAPPY		0x2c0
 #define BTN_TRIGGER_HAPPY1		0x2c0
 #define BTN_TRIGGER_HAPPY2		0x2c1
Signature · 1 line
1.9.0
#1 lore raw

[ adding Dmitry to CC ]

Quoted 11 lines · Olivier Gay

Add some missing hid usages from consumer page, add display brightness control usages from approved hid usage table request HUTTR41:
http://www.usb.org/developers/hidpage/HUTRR41.pdf
and add voice command usage from approved request HUTTR45:
http://www.usb.org/developers/hidpage/Voice_Command_Usage.pdf

---

Quoted 8 lines

Hi all,

with this patch we add some missing hid usages to the hid system. Those missing hid usages are already used by some Logitech products as well as some future ones.

(Note: checkpatch.pl shows some errors but I didn't want to break the current code style in hid-input.c)

Thanks for the patch, Olivier. All looking good to me, but for the input.h additions, I'd like to get Ack from Dmitry, hence CCing him.

Dmitry, ok to take this through my tree with your ack?

Thanks.

Quoted 125 lines

Best regards,

Olivier

 drivers/hid/hid-debug.c    | 14 ++++++++++++++
 drivers/hid/hid-input.c    | 15 +++++++++++++++
 include/uapi/linux/input.h | 16 ++++++++++++++++
 3 files changed, 45 insertions(+)
drivers/hid/hid-debug.c +14 -0
index 53b771d..742d78b 100644
@@ -855,6 +855,20 @@ static const char *keys[KEY_MAX + 1] = {
 	[KEY_KBDILLUMDOWN] = "KbdIlluminationDown",
 	[KEY_KBDILLUMUP] = "KbdIlluminationUp",
 	[KEY_SWITCHVIDEOMODE] = "SwitchVideoMode",
+	[KEY_BUTTONCONFIG] = "ButtonConfig",
+	[KEY_TASKMANAGER] = "TaskManager",
+	[KEY_JOURNAL] = "Journal",
+	[KEY_CONTROLPANEL] = "ControlPanel",
+	[KEY_APPSELECT] = "AppSelect",
+	[KEY_SCREENSAVER] = "ScreenSaver",
+	[KEY_VOICECOMMAND] = "VoiceCommand",
+	[KEY_BRIGHTNESS_INC] = "BrightnessInc",
+	[KEY_BRIGHTNESS_DEC] = "BrightnessDec",
+	[KEY_BRIGHTNESS] = "Brightness",
+	[KEY_BRIGHTNESS_TOGGLE] = "BrightnessToggle",
+	[KEY_BRIGHTNESS_MIN] = "BrightnessMin",
+	[KEY_BRIGHTNESS_MAX] = "BrightnessMax",
+	[KEY_BRIGHTNESS_AUTO] = "BrightnessAuto",
 };
 
 static const char *relatives[REL_MAX + 1] = {
drivers/hid/hid-input.c +15 -0
index 930382e..e1409da 100644
@@ -721,6 +721,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x06c: map_key_clear(KEY_YELLOW);		break;
 		case 0x06d: map_key_clear(KEY_ZOOM);		break;
 
+		case 0x06f: map_key_clear(KEY_BRIGHTNESS_INC);		break;
+		case 0x070: map_key_clear(KEY_BRIGHTNESS_DEC);		break;
+		case 0x071: map_key_clear(KEY_BRIGHTNESS);		break;
+		case 0x072: map_key_clear(KEY_BRIGHTNESS_TOGGLE);	break;
+		case 0x073: map_key_clear(KEY_BRIGHTNESS_MIN);		break;
+		case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX);		break;
+		case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO);		break;
+
 		case 0x082: map_key_clear(KEY_VIDEO_NEXT);	break;
 		case 0x083: map_key_clear(KEY_LAST);		break;
 		case 0x084: map_key_clear(KEY_ENTER);		break;
@@ -761,6 +769,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x0bf: map_key_clear(KEY_SLOW);		break;
 
 		case 0x0cd: map_key_clear(KEY_PLAYPAUSE);	break;
+		case 0x0cf: map_key_clear(KEY_VOICECOMMAND);	break;
 		case 0x0e0: map_abs_clear(ABS_VOLUME);		break;
 		case 0x0e2: map_key_clear(KEY_MUTE);		break;
 		case 0x0e5: map_key_clear(KEY_BASSBOOST);	break;
@@ -768,6 +777,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x0ea: map_key_clear(KEY_VOLUMEDOWN);	break;
 		case 0x0f5: map_key_clear(KEY_SLOW);		break;
 
+		case 0x181: map_key_clear(KEY_BUTTONCONFIG);	break;
 		case 0x182: map_key_clear(KEY_BOOKMARKS);	break;
 		case 0x183: map_key_clear(KEY_CONFIG);		break;
 		case 0x184: map_key_clear(KEY_WORDPROCESSOR);	break;
@@ -781,6 +791,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x18c: map_key_clear(KEY_VOICEMAIL);	break;
 		case 0x18d: map_key_clear(KEY_ADDRESSBOOK);	break;
 		case 0x18e: map_key_clear(KEY_CALENDAR);	break;
+		case 0x18f: map_key_clear(KEY_TASKMANAGER);	break;
+		case 0x190: map_key_clear(KEY_JOURNAL);		break;
 		case 0x191: map_key_clear(KEY_FINANCE);		break;
 		case 0x192: map_key_clear(KEY_CALC);		break;
 		case 0x193: map_key_clear(KEY_PLAYER);		break;
@@ -789,12 +801,15 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x199: map_key_clear(KEY_CHAT);		break;
 		case 0x19c: map_key_clear(KEY_LOGOFF);		break;
 		case 0x19e: map_key_clear(KEY_COFFEE);		break;
+		case 0x19f: map_key_clear(KEY_CONTROLPANEL);		break;
+		case 0x1a2: map_key_clear(KEY_APPSELECT);		break;
 		case 0x1a3: map_key_clear(KEY_NEXT);		break;
 		case 0x1a4: map_key_clear(KEY_PREVIOUS);	break;
 		case 0x1a6: map_key_clear(KEY_HELP);		break;
 		case 0x1a7: map_key_clear(KEY_DOCUMENTS);	break;
 		case 0x1ab: map_key_clear(KEY_SPELLCHECK);	break;
 		case 0x1ae: map_key_clear(KEY_KEYBOARD);	break;
+		case 0x1b1: map_key_clear(KEY_SCREENSAVER);		break;
 		case 0x1b4: map_key_clear(KEY_FILE);		break;
 		case 0x1b6: map_key_clear(KEY_IMAGES);		break;
 		case 0x1b7: map_key_clear(KEY_AUDIO);		break;
include/uapi/linux/input.h +16 -0
index bd24470..d82454f 100644
@@ -722,6 +722,22 @@ struct input_keymap_entry {
 
 #define KEY_ALS_TOGGLE		0x230	/* Ambient light sensor */
 
+#define KEY_BUTTONCONFIG		0x240	/* AL Button Configuration */
+#define KEY_TASKMANAGER		0x241	/* AL Task/Project Manager */
+#define KEY_JOURNAL		0x242	/* AL Log/Journal/Timecard */
+#define KEY_CONTROLPANEL		0x243	/* AL Control Panel */
+#define KEY_APPSELECT		0x244	/* AL Select Task/Application */
+#define KEY_SCREENSAVER		0x245	/* AL Screen Saver */
+#define KEY_VOICECOMMAND		0x246	/* Listening Voice Command */
+
+#define KEY_BRIGHTNESS_INC		KEY_BRIGHTNESSUP
+#define KEY_BRIGHTNESS_DEC		KEY_BRIGHTNESSDOWN
+#define KEY_BRIGHTNESS		0x250	/* Display Brightness */
+#define KEY_BRIGHTNESS_TOGGLE		0x251	/* Backlight Toggle */
+#define KEY_BRIGHTNESS_MIN		0x252	/* Set Brightness to Minimum */
+#define KEY_BRIGHTNESS_MAX		0x253	/* Set Brightness to Maximum */
+#define KEY_BRIGHTNESS_AUTO		0x254	/* Set Auto Brightness */
+
 #define BTN_TRIGGER_HAPPY		0x2c0
 #define BTN_TRIGGER_HAPPY1		0x2c0
 #define BTN_TRIGGER_HAPPY2		0x2c1
Signature · 1 line
1.9.0
Signature · 2 lines
Jiri Kosina
SUSE Labs
#2 lore raw
Quoted 10 lines · Jiri Kosina

[ adding Dmitry to CC ]

Quoted 4 lines · Olivier Gay

with this patch we add some missing hid usages to the hid system. Those missing hid usages are already used by some Logitech products as well as some future ones.

Quoted 7 lines
Quoted 2 lines

(Note: checkpatch.pl shows some errors but I didn't want to break the current code style in hid-input.c)

Thanks for the patch, Olivier. All looking good to me, but for the input.h additions, I'd like to get Ack from Dmitry, hence CCing him.

Dmitry, ok to take this through my tree with your ack?

Hi Dmitry,

by any chance did you take a look on this commit we submitted?

Best regards,

Olivier

maintainer
#3 lore raw
In reply to Jiri Kosina
Quoted 8 lines · Jiri Kosina

[ adding Dmitry to CC ]

Quoted 3 lines · Olivier Gay

#define KEY_ALS_TOGGLE 0x230 /* Ambient light sensor */

Quoted 11 lines

include/uapi/linux/input.h struct input_keymap_entry { · line 735

Quoted 11 lines
include/uapi/linux/input.h +11 -0
+#define KEY_BUTTONCONFIG		0x240	/* AL Button Configuration */
+#define KEY_TASKMANAGER		0x241	/* AL Task/Project Manager */
+#define KEY_JOURNAL		0x242	/* AL Log/Journal/Timecard */
+#define KEY_CONTROLPANEL		0x243	/* AL Control Panel */
+#define KEY_APPSELECT		0x244	/* AL Select Task/Application */
+#define KEY_SCREENSAVER		0x245	/* AL Screen Saver */
+#define KEY_VOICECOMMAND		0x246	/* Listening Voice Command */
+
+#define KEY_BRIGHTNESS_INC		KEY_BRIGHTNESSUP
+#define KEY_BRIGHTNESS_DEC		KEY_BRIGHTNESSDOWN
+#define KEY_BRIGHTNESS		0x250	/* Display Brightness */

What is it supposed to do exactly? Show OSD for brightness?

Quoted 1 line
Quoted 1 line

+#define KEY_BRIGHTNESS_TOGGLE 0x251 /* Backlight Toggle */

We already have KEY_DISPLAYTOGGLE, isn't this the same?

Thanks.

Signature · 1 line
Dmitry
#4 lore raw
Quoted 4 lines · Dmitry Torokhov
Quoted 1 line · Jiri Kosina
Quoted 1 line

+#define KEY_BRIGHTNESS 0x250 /* Display Brightness */

What is it supposed to do exactly? Show OSD for brightness?

No, it's a linear control usage to (HUTTR41) "Sets brightness to a value between logical min and max.". I'm changing the comment to /* Set Brightness */.

Quoted 3 lines
Quoted 1 line
Quoted 1 line

+#define KEY_BRIGHTNESS_TOGGLE 0x251 /* Backlight Toggle */

We already have KEY_DISPLAYTOGGLE, isn't this the same?

I agree, they are the same and we should alias it to KEY_DISPLAYTOGGLE. I'm sending a v2 patch.

Best regards,

Olivier

maintainer
#5 lore raw
Quoted 10 lines · Olivier Gay
Quoted 4 lines · Dmitry Torokhov
Quoted 1 line · Jiri Kosina
Quoted 1 line

+#define KEY_BRIGHTNESS 0x250 /* Display Brightness */

What is it supposed to do exactly? Show OSD for brightness?

No, it's a linear control usage to (HUTTR41) "Sets brightness to a value between logical min and max.". I'm changing the comment to /* Set Brightness */.

Then it does not make sense to expose it as a key - how system should respond to such event? Pick a random value?

If we really need to support this we need ABS_BRIGHTNESS, like we have ABS_VOLUME.

Thanks.

Signature · 1 line
Dmitry
#6 lore raw
Quoted 7 lines · Dmitry Torokhov
Quoted 4 lines · Olivier Gay
Quoted 2 lines · Dmitry Torokhov
Quoted 1 line · Jiri Kosina
Quoted 1 line

+#define KEY_BRIGHTNESS 0x250 /* Display Brightness */

Then it does not make sense to expose it as a key - how system should respond to such event? Pick a random value?

Yes, I also noticed that after sending v2. We would also need to pass/use the linear control value.

Quoted 2 lines

If we really need to support this we need ABS_BRIGHTNESS, like we have ABS_VOLUME.

This is not absolutely needed and the other display brightness usages are more important (like increment, decrement or toggle). I'm sending a new v3 without this usage.

Best regards,

Olivier