Skip to content

Commit 740b2f0

Browse files
fengqiJiri Kosina
authored andcommitted
HID: add KEY_CAMERA_FOCUS event in HID
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. Signed-off-by: fengqi <fengqi@xiaomi.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 2653e3f commit 740b2f0

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/hid/hid-input.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,16 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
12611261
return;
12621262
}
12631263
goto unknown;
1264+
case HID_UP_CAMERA:
1265+
switch (usage->hid & HID_USAGE) {
1266+
case 0x020:
1267+
map_key_clear(KEY_CAMERA_FOCUS); break;
1268+
case 0x021:
1269+
map_key_clear(KEY_CAMERA); break;
1270+
default:
1271+
goto ignore;
1272+
}
1273+
break;
12641274

12651275
case HID_UP_HPVENDOR: /* Reported on a Dutch layout HP5308 */
12661276
set_bit(EV_REP, input->evbit);

include/linux/hid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ struct hid_item {
156156
#define HID_UP_DIGITIZER 0x000d0000
157157
#define HID_UP_PID 0x000f0000
158158
#define HID_UP_BATTERY 0x00850000
159+
#define HID_UP_CAMERA 0x00900000
159160
#define HID_UP_HPVENDOR 0xff7f0000
160161
#define HID_UP_HPVENDOR2 0xff010000
161162
#define HID_UP_MSVENDOR 0xff000000

0 commit comments

Comments
 (0)