hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/hid.h
....@@ -1,22 +1,10 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Copyright (c) 1999 Andreas Gal
34 * Copyright (c) 2000-2001 Vojtech Pavlik
45 * Copyright (c) 2006-2007 Jiri Kosina
56 */
67 /*
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
208 *
219 * Should you need to contact me, the author, you can do so either by
2210 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
....@@ -175,6 +163,7 @@
175163 #define HID_UP_LNVENDOR 0xffa00000
176164 #define HID_UP_SENSOR 0x00200000
177165 #define HID_UP_ASUSVENDOR 0xff310000
166
+#define HID_UP_GOOGLEVENDOR 0xffd10000
178167
179168 #define HID_USAGE 0x0000ffff
180169
....@@ -219,6 +208,7 @@
219208 #define HID_GD_VBRZ 0x00010045
220209 #define HID_GD_VNO 0x00010046
221210 #define HID_GD_FEATURE 0x00010047
211
+#define HID_GD_RESOLUTION_MULTIPLIER 0x00010048
222212 #define HID_GD_SYSTEM_CONTROL 0x00010080
223213 #define HID_GD_UP 0x00010090
224214 #define HID_GD_DOWN 0x00010091
....@@ -232,12 +222,14 @@
232222 #define HID_DC_BATTERYSTRENGTH 0x00060020
233223
234224 #define HID_CP_CONSUMER_CONTROL 0x000c0001
225
+#define HID_CP_AC_PAN 0x000c0238
235226
236227 #define HID_DG_DIGITIZER 0x000d0001
237228 #define HID_DG_PEN 0x000d0002
238229 #define HID_DG_LIGHTPEN 0x000d0003
239230 #define HID_DG_TOUCHSCREEN 0x000d0004
240231 #define HID_DG_TOUCHPAD 0x000d0005
232
+#define HID_DG_WHITEBOARD 0x000d0006
241233 #define HID_DG_STYLUS 0x000d0020
242234 #define HID_DG_PUCK 0x000d0021
243235 #define HID_DG_FINGER 0x000d0022
....@@ -383,6 +375,8 @@
383375 #define HID_GROUP_WACOM 0x0101
384376 #define HID_GROUP_LOGITECH_DJ_DEVICE 0x0102
385377 #define HID_GROUP_STEAM 0x0103
378
+#define HID_GROUP_LOGITECH_27MHZ_DEVICE 0x0104
379
+#define HID_GROUP_VIVALDI 0x0105
386380
387381 /*
388382 * HID protocol status
....@@ -432,6 +426,7 @@
432426 */
433427
434428 struct hid_collection {
429
+ int parent_idx; /* device->collection */
435430 unsigned type;
436431 unsigned usage;
437432 unsigned level;
....@@ -441,12 +436,16 @@
441436 unsigned hid; /* hid usage code */
442437 unsigned collection_index; /* index into collection array */
443438 unsigned usage_index; /* index into usage array */
439
+ __s8 resolution_multiplier;/* Effective Resolution Multiplier
440
+ (HUT v1.12, 4.3.1), default: 1 */
444441 /* hidinput data */
442
+ __s8 wheel_factor; /* 120/resolution_multiplier */
445443 __u16 code; /* input driver code */
446444 __u8 type; /* input driver type */
447445 __s8 hat_min; /* hat switch fun */
448446 __s8 hat_max; /* ditto */
449447 __s8 hat_dir; /* ditto */
448
+ __s16 wheel_accumulated; /* hi-res wheel */
450449 };
451450
452451 struct hid_input;
....@@ -727,8 +726,8 @@
727726 * input will not be passed to raw_event unless hid_device_io_start is
728727 * called.
729728 *
730
- * raw_event and event should return 0 on no action performed, 1 when no
731
- * further processing should be done and negative on error
729
+ * raw_event and event should return negative on error, any other value will
730
+ * pass the event on to .event() typically return 0 for success.
732731 *
733732 * input_mapping shall return a negative value to completely ignore this usage
734733 * (e.g. doubled or invalid usage), zero to continue with parsing of this
....@@ -846,7 +845,11 @@
846845
847846 /* Applications from HID Usage Tables 4/8/99 Version 1.1 */
848847 /* We ignore a few input applications that are not widely used */
849
-#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || ((a >= 0x000d0002) && (a <= 0x000d0006)))
848
+#define IS_INPUT_APPLICATION(a) \
849
+ (((a >= HID_UP_GENDESK) && (a <= HID_GD_MULTIAXIS)) \
850
+ || ((a >= HID_DG_PEN) && (a <= HID_DG_WHITEBOARD)) \
851
+ || (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL) \
852
+ || (a == HID_GD_WIRELESS_RADIO_CTLS))
850853
851854 /* HID core API */
852855
....@@ -891,7 +894,7 @@
891894 unsigned int hidinput_count_leds(struct hid_device *hid);
892895 __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
893896 void hid_output_report(struct hid_report *report, __u8 *data);
894
-void __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype);
897
+int __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype);
895898 u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
896899 struct hid_device *hid_allocate_device(void);
897900 struct hid_report *hid_register_report(struct hid_device *device,
....@@ -902,6 +905,8 @@
902905 unsigned int type, unsigned int id,
903906 unsigned int field_index,
904907 unsigned int report_counts);
908
+
909
+void hid_setup_resolution_multiplier(struct hid_device *hid);
905910 int hid_open_report(struct hid_device *device);
906911 int hid_check_keys_pressed(struct hid_device *hid);
907912 int hid_connect(struct hid_device *hid, unsigned int connect_mask);
....@@ -1175,29 +1180,32 @@
11751180 #define hid_pidff_init NULL
11761181 #endif
11771182
1178
-#define dbg_hid(format, arg...) \
1183
+#define dbg_hid(fmt, ...) \
11791184 do { \
11801185 if (hid_debug) \
1181
- printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \
1186
+ printk(KERN_DEBUG "%s: " fmt, __FILE__, ##__VA_ARGS__); \
11821187 } while (0)
11831188
1184
-#define hid_printk(level, hid, fmt, arg...) \
1185
- dev_printk(level, &(hid)->dev, fmt, ##arg)
1186
-#define hid_emerg(hid, fmt, arg...) \
1187
- dev_emerg(&(hid)->dev, fmt, ##arg)
1188
-#define hid_crit(hid, fmt, arg...) \
1189
- dev_crit(&(hid)->dev, fmt, ##arg)
1190
-#define hid_alert(hid, fmt, arg...) \
1191
- dev_alert(&(hid)->dev, fmt, ##arg)
1192
-#define hid_err(hid, fmt, arg...) \
1193
- dev_err(&(hid)->dev, fmt, ##arg)
1194
-#define hid_notice(hid, fmt, arg...) \
1195
- dev_notice(&(hid)->dev, fmt, ##arg)
1196
-#define hid_warn(hid, fmt, arg...) \
1197
- dev_warn(&(hid)->dev, fmt, ##arg)
1198
-#define hid_info(hid, fmt, arg...) \
1199
- dev_info(&(hid)->dev, fmt, ##arg)
1200
-#define hid_dbg(hid, fmt, arg...) \
1201
- dev_dbg(&(hid)->dev, fmt, ##arg)
1189
+#define hid_err(hid, fmt, ...) \
1190
+ dev_err(&(hid)->dev, fmt, ##__VA_ARGS__)
1191
+#define hid_notice(hid, fmt, ...) \
1192
+ dev_notice(&(hid)->dev, fmt, ##__VA_ARGS__)
1193
+#define hid_warn(hid, fmt, ...) \
1194
+ dev_warn(&(hid)->dev, fmt, ##__VA_ARGS__)
1195
+#define hid_info(hid, fmt, ...) \
1196
+ dev_info(&(hid)->dev, fmt, ##__VA_ARGS__)
1197
+#define hid_dbg(hid, fmt, ...) \
1198
+ dev_dbg(&(hid)->dev, fmt, ##__VA_ARGS__)
1199
+
1200
+#define hid_err_once(hid, fmt, ...) \
1201
+ dev_err_once(&(hid)->dev, fmt, ##__VA_ARGS__)
1202
+#define hid_notice_once(hid, fmt, ...) \
1203
+ dev_notice_once(&(hid)->dev, fmt, ##__VA_ARGS__)
1204
+#define hid_warn_once(hid, fmt, ...) \
1205
+ dev_warn_once(&(hid)->dev, fmt, ##__VA_ARGS__)
1206
+#define hid_info_once(hid, fmt, ...) \
1207
+ dev_info_once(&(hid)->dev, fmt, ##__VA_ARGS__)
1208
+#define hid_dbg_once(hid, fmt, ...) \
1209
+ dev_dbg_once(&(hid)->dev, fmt, ##__VA_ARGS__)
12021210
12031211 #endif