HID: map telephony usage page
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 4 Mar 2015 22:10:26 +0000 (14:10 -0800)
committerJiri Kosina <jkosina@suse.cz>
Wed, 4 Mar 2015 22:31:36 +0000 (23:31 +0100)
Currently HID code maps usages from telephony page into BTN_0, BTN_1, etc
keys which get interpreted by mousedev and userspace as left/right/middle
button clicks, which is not really helpful.

This change adds mappings for usages that have corresponding input event
definitions, and leaves the rest unmapped. This can be changed when
there are userspace consumers for more telephony usages.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-input.c
include/linux/hid.h
include/uapi/linux/input.h

index 052869d0ab787da2a3d685c5c6bf905d05e047b8..19603efc8fa23f41bd119431b2c32160eeec00bb 100644 (file)
@@ -711,6 +711,29 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                }
                break;
 
+       case HID_UP_TELEPHONY:
+               switch (usage->hid & HID_USAGE) {
+               case 0x2f: map_key_clear(KEY_MICMUTE);          break;
+               case 0xb0: map_key_clear(KEY_NUMERIC_0);        break;
+               case 0xb1: map_key_clear(KEY_NUMERIC_1);        break;
+               case 0xb2: map_key_clear(KEY_NUMERIC_2);        break;
+               case 0xb3: map_key_clear(KEY_NUMERIC_3);        break;
+               case 0xb4: map_key_clear(KEY_NUMERIC_4);        break;
+               case 0xb5: map_key_clear(KEY_NUMERIC_5);        break;
+               case 0xb6: map_key_clear(KEY_NUMERIC_6);        break;
+               case 0xb7: map_key_clear(KEY_NUMERIC_7);        break;
+               case 0xb8: map_key_clear(KEY_NUMERIC_8);        break;
+               case 0xb9: map_key_clear(KEY_NUMERIC_9);        break;
+               case 0xba: map_key_clear(KEY_NUMERIC_STAR);     break;
+               case 0xbb: map_key_clear(KEY_NUMERIC_POUND);    break;
+               case 0xbc: map_key_clear(KEY_NUMERIC_A);        break;
+               case 0xbd: map_key_clear(KEY_NUMERIC_B);        break;
+               case 0xbe: map_key_clear(KEY_NUMERIC_C);        break;
+               case 0xbf: map_key_clear(KEY_NUMERIC_D);        break;
+               default: goto ignore;
+               }
+               break;
+
        case HID_UP_CONSUMER:   /* USB HUT v1.12, pages 75-84 */
                switch (usage->hid & HID_USAGE) {
                case 0x000: goto ignore;
index efc7787a41a8c75db5b89509e8ec4051d019038a..69f9cf7f078d941ec7b949c6f46ab482fa2eefe2 100644 (file)
@@ -159,6 +159,7 @@ struct hid_item {
 #define HID_UP_LED             0x00080000
 #define HID_UP_BUTTON          0x00090000
 #define HID_UP_ORDINAL         0x000a0000
+#define HID_UP_TELEPHONY       0x000b0000
 #define HID_UP_CONSUMER                0x000c0000
 #define HID_UP_DIGITIZER       0x000d0000
 #define HID_UP_PID             0x000f0000
index b0a81307985282005ade90ee6da96e3048c405d3..2b628c316882d15435f25299722cfe1fbd737cef 100644 (file)
@@ -702,6 +702,10 @@ struct input_keymap_entry {
 #define KEY_NUMERIC_9          0x209
 #define KEY_NUMERIC_STAR       0x20a
 #define KEY_NUMERIC_POUND      0x20b
+#define KEY_NUMERIC_A          0x20c   /* Phone key A - HUT Telephony 0xb9 */
+#define KEY_NUMERIC_B          0x20d
+#define KEY_NUMERIC_C          0x20e
+#define KEY_NUMERIC_D          0x20f
 
 #define KEY_CAMERA_FOCUS       0x210
 #define KEY_WPS_BUTTON         0x211   /* WiFi Protected Setup key */