| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 1999 Andreas Gal |
|---|
| 3 | 4 | * Copyright (c) 2000-2001 Vojtech Pavlik |
|---|
| 4 | 5 | * Copyright (c) 2006-2007 Jiri Kosina |
|---|
| 5 | 6 | */ |
|---|
| 6 | 7 | /* |
|---|
| 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 |
|---|
| 20 | 8 | * |
|---|
| 21 | 9 | * Should you need to contact me, the author, you can do so either by |
|---|
| 22 | 10 | * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: |
|---|
| .. | .. |
|---|
| 175 | 163 | #define HID_UP_LNVENDOR 0xffa00000 |
|---|
| 176 | 164 | #define HID_UP_SENSOR 0x00200000 |
|---|
| 177 | 165 | #define HID_UP_ASUSVENDOR 0xff310000 |
|---|
| 166 | +#define HID_UP_GOOGLEVENDOR 0xffd10000 |
|---|
| 178 | 167 | |
|---|
| 179 | 168 | #define HID_USAGE 0x0000ffff |
|---|
| 180 | 169 | |
|---|
| .. | .. |
|---|
| 219 | 208 | #define HID_GD_VBRZ 0x00010045 |
|---|
| 220 | 209 | #define HID_GD_VNO 0x00010046 |
|---|
| 221 | 210 | #define HID_GD_FEATURE 0x00010047 |
|---|
| 211 | +#define HID_GD_RESOLUTION_MULTIPLIER 0x00010048 |
|---|
| 222 | 212 | #define HID_GD_SYSTEM_CONTROL 0x00010080 |
|---|
| 223 | 213 | #define HID_GD_UP 0x00010090 |
|---|
| 224 | 214 | #define HID_GD_DOWN 0x00010091 |
|---|
| .. | .. |
|---|
| 232 | 222 | #define HID_DC_BATTERYSTRENGTH 0x00060020 |
|---|
| 233 | 223 | |
|---|
| 234 | 224 | #define HID_CP_CONSUMER_CONTROL 0x000c0001 |
|---|
| 225 | +#define HID_CP_AC_PAN 0x000c0238 |
|---|
| 235 | 226 | |
|---|
| 236 | 227 | #define HID_DG_DIGITIZER 0x000d0001 |
|---|
| 237 | 228 | #define HID_DG_PEN 0x000d0002 |
|---|
| 238 | 229 | #define HID_DG_LIGHTPEN 0x000d0003 |
|---|
| 239 | 230 | #define HID_DG_TOUCHSCREEN 0x000d0004 |
|---|
| 240 | 231 | #define HID_DG_TOUCHPAD 0x000d0005 |
|---|
| 232 | +#define HID_DG_WHITEBOARD 0x000d0006 |
|---|
| 241 | 233 | #define HID_DG_STYLUS 0x000d0020 |
|---|
| 242 | 234 | #define HID_DG_PUCK 0x000d0021 |
|---|
| 243 | 235 | #define HID_DG_FINGER 0x000d0022 |
|---|
| .. | .. |
|---|
| 383 | 375 | #define HID_GROUP_WACOM 0x0101 |
|---|
| 384 | 376 | #define HID_GROUP_LOGITECH_DJ_DEVICE 0x0102 |
|---|
| 385 | 377 | #define HID_GROUP_STEAM 0x0103 |
|---|
| 378 | +#define HID_GROUP_LOGITECH_27MHZ_DEVICE 0x0104 |
|---|
| 379 | +#define HID_GROUP_VIVALDI 0x0105 |
|---|
| 386 | 380 | |
|---|
| 387 | 381 | /* |
|---|
| 388 | 382 | * HID protocol status |
|---|
| .. | .. |
|---|
| 432 | 426 | */ |
|---|
| 433 | 427 | |
|---|
| 434 | 428 | struct hid_collection { |
|---|
| 429 | + int parent_idx; /* device->collection */ |
|---|
| 435 | 430 | unsigned type; |
|---|
| 436 | 431 | unsigned usage; |
|---|
| 437 | 432 | unsigned level; |
|---|
| .. | .. |
|---|
| 441 | 436 | unsigned hid; /* hid usage code */ |
|---|
| 442 | 437 | unsigned collection_index; /* index into collection array */ |
|---|
| 443 | 438 | unsigned usage_index; /* index into usage array */ |
|---|
| 439 | + __s8 resolution_multiplier;/* Effective Resolution Multiplier |
|---|
| 440 | + (HUT v1.12, 4.3.1), default: 1 */ |
|---|
| 444 | 441 | /* hidinput data */ |
|---|
| 442 | + __s8 wheel_factor; /* 120/resolution_multiplier */ |
|---|
| 445 | 443 | __u16 code; /* input driver code */ |
|---|
| 446 | 444 | __u8 type; /* input driver type */ |
|---|
| 447 | 445 | __s8 hat_min; /* hat switch fun */ |
|---|
| 448 | 446 | __s8 hat_max; /* ditto */ |
|---|
| 449 | 447 | __s8 hat_dir; /* ditto */ |
|---|
| 448 | + __s16 wheel_accumulated; /* hi-res wheel */ |
|---|
| 450 | 449 | }; |
|---|
| 451 | 450 | |
|---|
| 452 | 451 | struct hid_input; |
|---|
| .. | .. |
|---|
| 727 | 726 | * input will not be passed to raw_event unless hid_device_io_start is |
|---|
| 728 | 727 | * called. |
|---|
| 729 | 728 | * |
|---|
| 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. |
|---|
| 732 | 731 | * |
|---|
| 733 | 732 | * input_mapping shall return a negative value to completely ignore this usage |
|---|
| 734 | 733 | * (e.g. doubled or invalid usage), zero to continue with parsing of this |
|---|
| .. | .. |
|---|
| 846 | 845 | |
|---|
| 847 | 846 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ |
|---|
| 848 | 847 | /* 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)) |
|---|
| 850 | 853 | |
|---|
| 851 | 854 | /* HID core API */ |
|---|
| 852 | 855 | |
|---|
| .. | .. |
|---|
| 891 | 894 | unsigned int hidinput_count_leds(struct hid_device *hid); |
|---|
| 892 | 895 | __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); |
|---|
| 893 | 896 | 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); |
|---|
| 895 | 898 | u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags); |
|---|
| 896 | 899 | struct hid_device *hid_allocate_device(void); |
|---|
| 897 | 900 | struct hid_report *hid_register_report(struct hid_device *device, |
|---|
| .. | .. |
|---|
| 902 | 905 | unsigned int type, unsigned int id, |
|---|
| 903 | 906 | unsigned int field_index, |
|---|
| 904 | 907 | unsigned int report_counts); |
|---|
| 908 | + |
|---|
| 909 | +void hid_setup_resolution_multiplier(struct hid_device *hid); |
|---|
| 905 | 910 | int hid_open_report(struct hid_device *device); |
|---|
| 906 | 911 | int hid_check_keys_pressed(struct hid_device *hid); |
|---|
| 907 | 912 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); |
|---|
| .. | .. |
|---|
| 1175 | 1180 | #define hid_pidff_init NULL |
|---|
| 1176 | 1181 | #endif |
|---|
| 1177 | 1182 | |
|---|
| 1178 | | -#define dbg_hid(format, arg...) \ |
|---|
| 1183 | +#define dbg_hid(fmt, ...) \ |
|---|
| 1179 | 1184 | do { \ |
|---|
| 1180 | 1185 | if (hid_debug) \ |
|---|
| 1181 | | - printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \ |
|---|
| 1186 | + printk(KERN_DEBUG "%s: " fmt, __FILE__, ##__VA_ARGS__); \ |
|---|
| 1182 | 1187 | } while (0) |
|---|
| 1183 | 1188 | |
|---|
| 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__) |
|---|
| 1202 | 1210 | |
|---|
| 1203 | 1211 | #endif |
|---|