Skip to contentSkip to conversation

HID: add KEY_CAMERA_FOCUS event in HID

PATCH Applied Qi Feng 3 participants 7 messages Feb 16, 2023 – Mar 10, 2023 HID

lore
Share & tools
lore

Qi Feng

author
#0 lore raw

PATCH v4 1/1 HID: add KEY_CAMERA_FOCUS event in HID

From: fengqi <[email protected]>

Our HID device need KEY_CAMERA_FOCUS event to control camera, but this event is non-existent in current HID driver. So we add this event in hid-input.c.

---
changes in v4:

-add HID_UP_CAMERA in HID usage tables , Then add the mapping under HID_UP_CAMERA
-modify the commit log of patch
-Link to v3:https://lore.kernel.org/linux-input/9a85b268c7636ef2e4e3bbbe318561ba2842a591.1676536357.git.fengqi@xiaomi.com/T/#u -Link to v2:https://lore.kernel.org/linux-input/CACOZ=ZU0zgRmoRu8X5bMUzUrXA9x-qoDJqrQroUs=+qKR58MQA@mail.gmail.com/T/#t -Link to v1:https://lore.kernel.org/linux-input/CACOZ=ZWB3grJKn7wAZEZ0BDyN7KJF4VWUTNs-mPxeoW_oiR7=g@mail.gmail.com/T/#t

---
 drivers/hid/hid-input.c | 10 ++++++++++
 include/linux/hid.h     |  1 +
 2 files changed, 11 insertions(+)
drivers/hid/hid-input.c +10 -0
index 77c8c49852b5..c6098ae2fac7 100644
@@ -1225,6 +1225,16 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 			return;
 		}
 		goto unknown;
+	case HID_UP_CAMERA:
+		switch (usage->hid & HID_USAGE) {
+		case 0x020:
+			map_key_clear(KEY_CAMERA_FOCUS);	break;
+		case 0x021:
+			map_key_clear(KEY_CAMERA);		break;
+		default:
+			goto ignore;
+		}
+		break;
 
 	case HID_UP_HPVENDOR:	/* Reported on a Dutch layout HP5308 */
 		set_bit(EV_REP, input->evbit);
include/linux/hid.h +1 -0
index 8677ae38599e..88793b77bd63 100644
@@ -155,6 +155,7 @@ struct hid_item {
 #define HID_UP_DIGITIZER	0x000d0000
 #define HID_UP_PID		0x000f0000
 #define HID_UP_BATTERY		0x00850000
+#define HID_UP_CAMERA		0x00900000
 #define HID_UP_HPVENDOR         0xff7f0000
 #define HID_UP_HPVENDOR2        0xff010000
 #define HID_UP_MSVENDOR		0xff000000
Signature · 1 line
2.39.0
author
#1 lore raw

loop more

Quoted 58 lines · Qi Feng <[email protected]> 于2023年2月16日周四 16:48写道:

From: fengqi <[email protected]>

Our HID device need KEY_CAMERA_FOCUS event to control camera, but this event is non-existent in current HID driver. So we add this event in hid-input.c.

---
changes in v4:

(quoted diff) +0 -6
-add HID_UP_CAMERA in HID usage tables , Then add the mapping under HID_UP_CAMERA
-modify the commit log of patch
-Link to v3:https://lore.kernel.org/linux-input/9a85b268c7636ef2e4e3bbbe318561ba2842a591.1676536357.git.fengqi@xiaomi.com/T/#u
-Link to v2:https://lore.kernel.org/linux-input/CACOZ=ZU0zgRmoRu8X5bMUzUrXA9x-qoDJqrQroUs=+qKR58MQA@mail.gmail.com/T/#t
-Link to v1:https://lore.kernel.org/linux-input/CACOZ=ZWB3grJKn7wAZEZ0BDyN7KJF4VWUTNs-mPxeoW_oiR7=g@mail.gmail.com/T/#t
---
 drivers/hid/hid-input.c | 10 ++++++++++
 include/linux/hid.h     |  1 +
 2 files changed, 11 insertions(+)
drivers/hid/hid-input.c +10 -0
index 77c8c49852b5..c6098ae2fac7 100644
@@ -1225,6 +1225,16 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                        return;
                }
                goto unknown;
+       case HID_UP_CAMERA:
+               switch (usage->hid & HID_USAGE) {
+               case 0x020:
+                       map_key_clear(KEY_CAMERA_FOCUS);        break;
+               case 0x021:
+                       map_key_clear(KEY_CAMERA);              break;
+               default:
+                       goto ignore;
+               }
+               break;
 
        case HID_UP_HPVENDOR:   /* Reported on a Dutch layout HP5308 */
                set_bit(EV_REP, input->evbit);
include/linux/hid.h +1 -1
index 8677ae38599e..88793b77bd63 100644
@@ -155,6 +155,7 @@ struct hid_item {
 #define HID_UP_DIGITIZER       0x000d0000
 #define HID_UP_PID             0x000f0000
 #define HID_UP_BATTERY         0x00850000
+#define HID_UP_CAMERA          0x00900000
 #define HID_UP_HPVENDOR         0xff7f0000
 #define HID_UP_HPVENDOR2        0xff010000
 #define HID_UP_MSVENDOR                0xff000000
--

2.39.0

#2 lore raw
Quoted 1 line · qi feng

loop more

????

Reviewed-by on v4 1/1
#3 lore raw
In reply to Qi Feng
Quoted 57 lines · Qi Feng

From: fengqi <[email protected]>

Our HID device need KEY_CAMERA_FOCUS event to control camera, but this event is non-existent in current HID driver. So we add this event in hid-input.c.

---
changes in v4:

(quoted diff) +0 -6
-add HID_UP_CAMERA in HID usage tables , Then add the mapping under HID_UP_CAMERA
-modify the commit log of patch
-Link to v3:https://lore.kernel.org/linux-input/9a85b268c7636ef2e4e3bbbe318561ba2842a591.1676536357.git.fengqi@xiaomi.com/T/#u
-Link to v2:https://lore.kernel.org/linux-input/CACOZ=ZU0zgRmoRu8X5bMUzUrXA9x-qoDJqrQroUs=+qKR58MQA@mail.gmail.com/T/#t
-Link to v1:https://lore.kernel.org/linux-input/CACOZ=ZWB3grJKn7wAZEZ0BDyN7KJF4VWUTNs-mPxeoW_oiR7=g@mail.gmail.com/T/#t
---
 drivers/hid/hid-input.c | 10 ++++++++++
 include/linux/hid.h     |  1 +
 2 files changed, 11 insertions(+)
drivers/hid/hid-input.c +10 -0
index 77c8c49852b5..c6098ae2fac7 100644
@@ -1225,6 +1225,16 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 			return;
 		}
 		goto unknown;
+	case HID_UP_CAMERA:
+		switch (usage->hid & HID_USAGE) {
+		case 0x020:
+			map_key_clear(KEY_CAMERA_FOCUS);	break;
+		case 0x021:
+			map_key_clear(KEY_CAMERA);		break;
+		default:
+			goto ignore;
+		}
+		break;
 
 	case HID_UP_HPVENDOR:	/* Reported on a Dutch layout HP5308 */
 		set_bit(EV_REP, input->evbit);
include/linux/hid.h +1 -0
index 8677ae38599e..88793b77bd63 100644
@@ -155,6 +155,7 @@ struct hid_item {
 #define HID_UP_DIGITIZER	0x000d0000
 #define HID_UP_PID		0x000f0000
 #define HID_UP_BATTERY		0x00850000
+#define HID_UP_CAMERA		0x00900000
 #define HID_UP_HPVENDOR         0xff7f0000
 #define HID_UP_HPVENDOR2        0xff010000
 #define HID_UP_MSVENDOR		0xff000000
Signature · 1 line
2.39.0
author
#4 lore raw

Is there something wrong with this, I can correct it

Quoted 61 lines · Greg KH <[email protected]> 于2023年2月16日周四 18:18写道:
Quoted 55 lines · Qi Feng

From: fengqi <[email protected]>

Our HID device need KEY_CAMERA_FOCUS event to control camera, but this event is non-existent in current HID driver. So we add this event in hid-input.c.

---
changes in v4:

(quoted diff) +0 -6
-add HID_UP_CAMERA in HID usage tables , Then add the mapping under HID_UP_CAMERA
-modify the commit log of patch
-Link to v3:https://lore.kernel.org/linux-input/9a85b268c7636ef2e4e3bbbe318561ba2842a591.1676536357.git.fengqi@xiaomi.com/T/#u
-Link to v2:https://lore.kernel.org/linux-input/CACOZ=ZU0zgRmoRu8X5bMUzUrXA9x-qoDJqrQroUs=+qKR58MQA@mail.gmail.com/T/#t
-Link to v1:https://lore.kernel.org/linux-input/CACOZ=ZWB3grJKn7wAZEZ0BDyN7KJF4VWUTNs-mPxeoW_oiR7=g@mail.gmail.com/T/#t
---
 drivers/hid/hid-input.c | 10 ++++++++++
 include/linux/hid.h     |  1 +
 2 files changed, 11 insertions(+)
drivers/hid/hid-input.c +10 -0
index 77c8c49852b5..c6098ae2fac7 100644
@@ -1225,6 +1225,16 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
                      return;
              }
              goto unknown;
+     case HID_UP_CAMERA:
+             switch (usage->hid & HID_USAGE) {
+             case 0x020:
+                     map_key_clear(KEY_CAMERA_FOCUS);        break;
+             case 0x021:
+                     map_key_clear(KEY_CAMERA);              break;
+             default:
+                     goto ignore;
+             }
+             break;
 
      case HID_UP_HPVENDOR:   /* Reported on a Dutch layout HP5308 */
              set_bit(EV_REP, input->evbit);
include/linux/hid.h +1 -1
index 8677ae38599e..88793b77bd63 100644
@@ -155,6 +155,7 @@ struct hid_item {
 #define HID_UP_DIGITIZER     0x000d0000
 #define HID_UP_PID           0x000f0000
 #define HID_UP_BATTERY               0x00850000
+#define HID_UP_CAMERA                0x00900000
 #define HID_UP_HPVENDOR         0xff7f0000
 #define HID_UP_HPVENDOR2        0xff010000
 #define HID_UP_MSVENDOR              0xff000000
--
Quoted 2 lines

2.39.0

#5 lore raw

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Quoted 1 line · qi feng

Is there something wrong with this, I can correct it

Quoted 3 lines · look at the bottom of the email where I
Quoted 2 lines · Greg KH <[email protected]> 于2023年2月16日周四 18:18写道: