#ifndef __HID_H
#define __HID_H
#include <linux/bitops.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/mod_devicetable.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/input.h>
#include <linux/semaphore.h>
#include <linux/mutex.h>
#include <linux/power_supply.h>
#include <uapi/linux/hid.h>
#include <linux/hid_bpf.h>
struct hid_item { … };
#define HID_ITEM_FORMAT_SHORT …
#define HID_ITEM_FORMAT_LONG …
#define HID_ITEM_TAG_LONG …
#define HID_ITEM_TYPE_MAIN …
#define HID_ITEM_TYPE_GLOBAL …
#define HID_ITEM_TYPE_LOCAL …
#define HID_ITEM_TYPE_RESERVED …
#define HID_MAIN_ITEM_TAG_INPUT …
#define HID_MAIN_ITEM_TAG_OUTPUT …
#define HID_MAIN_ITEM_TAG_FEATURE …
#define HID_MAIN_ITEM_TAG_BEGIN_COLLECTION …
#define HID_MAIN_ITEM_TAG_END_COLLECTION …
#define HID_MAIN_ITEM_CONSTANT …
#define HID_MAIN_ITEM_VARIABLE …
#define HID_MAIN_ITEM_RELATIVE …
#define HID_MAIN_ITEM_WRAP …
#define HID_MAIN_ITEM_NONLINEAR …
#define HID_MAIN_ITEM_NO_PREFERRED …
#define HID_MAIN_ITEM_NULL_STATE …
#define HID_MAIN_ITEM_VOLATILE …
#define HID_MAIN_ITEM_BUFFERED_BYTE …
#define HID_COLLECTION_PHYSICAL …
#define HID_COLLECTION_APPLICATION …
#define HID_COLLECTION_LOGICAL …
#define HID_COLLECTION_NAMED_ARRAY …
#define HID_GLOBAL_ITEM_TAG_USAGE_PAGE …
#define HID_GLOBAL_ITEM_TAG_LOGICAL_MINIMUM …
#define HID_GLOBAL_ITEM_TAG_LOGICAL_MAXIMUM …
#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MINIMUM …
#define HID_GLOBAL_ITEM_TAG_PHYSICAL_MAXIMUM …
#define HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT …
#define HID_GLOBAL_ITEM_TAG_UNIT …
#define HID_GLOBAL_ITEM_TAG_REPORT_SIZE …
#define HID_GLOBAL_ITEM_TAG_REPORT_ID …
#define HID_GLOBAL_ITEM_TAG_REPORT_COUNT …
#define HID_GLOBAL_ITEM_TAG_PUSH …
#define HID_GLOBAL_ITEM_TAG_POP …
#define HID_LOCAL_ITEM_TAG_USAGE …
#define HID_LOCAL_ITEM_TAG_USAGE_MINIMUM …
#define HID_LOCAL_ITEM_TAG_USAGE_MAXIMUM …
#define HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX …
#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MINIMUM …
#define HID_LOCAL_ITEM_TAG_DESIGNATOR_MAXIMUM …
#define HID_LOCAL_ITEM_TAG_STRING_INDEX …
#define HID_LOCAL_ITEM_TAG_STRING_MINIMUM …
#define HID_LOCAL_ITEM_TAG_STRING_MAXIMUM …
#define HID_LOCAL_ITEM_TAG_DELIMITER …
#define HID_USAGE_PAGE …
#define HID_UP_UNDEFINED …
#define HID_UP_GENDESK …
#define HID_UP_SIMULATION …
#define HID_UP_GENDEVCTRLS …
#define HID_UP_KEYBOARD …
#define HID_UP_LED …
#define HID_UP_BUTTON …
#define HID_UP_ORDINAL …
#define HID_UP_TELEPHONY …
#define HID_UP_CONSUMER …
#define HID_UP_DIGITIZER …
#define HID_UP_PID …
#define HID_UP_BATTERY …
#define HID_UP_CAMERA …
#define HID_UP_HPVENDOR …
#define HID_UP_HPVENDOR2 …
#define HID_UP_MSVENDOR …
#define HID_UP_CUSTOM …
#define HID_UP_LOGIVENDOR …
#define HID_UP_LOGIVENDOR2 …
#define HID_UP_LOGIVENDOR3 …
#define HID_UP_LNVENDOR …
#define HID_UP_SENSOR …
#define HID_UP_ASUSVENDOR …
#define HID_UP_GOOGLEVENDOR …
#define HID_USAGE …
#define HID_GD_POINTER …
#define HID_GD_MOUSE …
#define HID_GD_JOYSTICK …
#define HID_GD_GAMEPAD …
#define HID_GD_KEYBOARD …
#define HID_GD_KEYPAD …
#define HID_GD_MULTIAXIS …
#define HID_GD_WIRELESS_RADIO_CTLS …
#define HID_GD_SYSTEM_MULTIAXIS …
#define HID_GD_X …
#define HID_GD_Y …
#define HID_GD_Z …
#define HID_GD_RX …
#define HID_GD_RY …
#define HID_GD_RZ …
#define HID_GD_SLIDER …
#define HID_GD_DIAL …
#define HID_GD_WHEEL …
#define HID_GD_HATSWITCH …
#define HID_GD_BUFFER …
#define HID_GD_BYTECOUNT …
#define HID_GD_MOTION …
#define HID_GD_START …
#define HID_GD_SELECT …
#define HID_GD_VX …
#define HID_GD_VY …
#define HID_GD_VZ …
#define HID_GD_VBRX …
#define HID_GD_VBRY …
#define HID_GD_VBRZ …
#define HID_GD_VNO …
#define HID_GD_FEATURE …
#define HID_GD_RESOLUTION_MULTIPLIER …
#define HID_GD_SYSTEM_CONTROL …
#define HID_GD_UP …
#define HID_GD_DOWN …
#define HID_GD_RIGHT …
#define HID_GD_LEFT …
#define HID_GD_RFKILL_BTN …
#define HID_GD_RFKILL_LED …
#define HID_GD_RFKILL_SWITCH …
#define HID_DC_BATTERYSTRENGTH …
#define HID_CP_CONSUMER_CONTROL …
#define HID_CP_AC_PAN …
#define HID_DG_DIGITIZER …
#define HID_DG_PEN …
#define HID_DG_LIGHTPEN …
#define HID_DG_TOUCHSCREEN …
#define HID_DG_TOUCHPAD …
#define HID_DG_WHITEBOARD …
#define HID_DG_STYLUS …
#define HID_DG_PUCK …
#define HID_DG_FINGER …
#define HID_DG_TIPPRESSURE …
#define HID_DG_BARRELPRESSURE …
#define HID_DG_INRANGE …
#define HID_DG_TOUCH …
#define HID_DG_UNTOUCH …
#define HID_DG_TAP …
#define HID_DG_TRANSDUCER_INDEX …
#define HID_DG_TABLETFUNCTIONKEY …
#define HID_DG_PROGRAMCHANGEKEY …
#define HID_DG_BATTERYSTRENGTH …
#define HID_DG_INVERT …
#define HID_DG_TILT_X …
#define HID_DG_TILT_Y …
#define HID_DG_TWIST …
#define HID_DG_TIPSWITCH …
#define HID_DG_TIPSWITCH2 …
#define HID_DG_BARRELSWITCH …
#define HID_DG_ERASER …
#define HID_DG_TABLETPICK …
#define HID_DG_PEN_COLOR …
#define HID_DG_PEN_LINE_WIDTH …
#define HID_DG_PEN_LINE_STYLE …
#define HID_DG_PEN_LINE_STYLE_INK …
#define HID_DG_PEN_LINE_STYLE_PENCIL …
#define HID_DG_PEN_LINE_STYLE_HIGHLIGHTER …
#define HID_DG_PEN_LINE_STYLE_CHISEL_MARKER …
#define HID_DG_PEN_LINE_STYLE_BRUSH …
#define HID_DG_PEN_LINE_STYLE_NO_PREFERENCE …
#define HID_CP_CONSUMERCONTROL …
#define HID_CP_NUMERICKEYPAD …
#define HID_CP_PROGRAMMABLEBUTTONS …
#define HID_CP_MICROPHONE …
#define HID_CP_HEADPHONE …
#define HID_CP_GRAPHICEQUALIZER …
#define HID_CP_FUNCTIONBUTTONS …
#define HID_CP_SELECTION …
#define HID_CP_MEDIASELECTION …
#define HID_CP_SELECTDISC …
#define HID_CP_VOLUMEUP …
#define HID_CP_VOLUMEDOWN …
#define HID_CP_PLAYBACKSPEED …
#define HID_CP_PROXIMITY …
#define HID_CP_SPEAKERSYSTEM …
#define HID_CP_CHANNELLEFT …
#define HID_CP_CHANNELRIGHT …
#define HID_CP_CHANNELCENTER …
#define HID_CP_CHANNELFRONT …
#define HID_CP_CHANNELCENTERFRONT …
#define HID_CP_CHANNELSIDE …
#define HID_CP_CHANNELSURROUND …
#define HID_CP_CHANNELLOWFREQUENCYENHANCEMENT …
#define HID_CP_CHANNELTOP …
#define HID_CP_CHANNELUNKNOWN …
#define HID_CP_APPLICATIONLAUNCHBUTTONS …
#define HID_CP_GENERICGUIAPPLICATIONCONTROLS …
#define HID_DG_DEVICECONFIG …
#define HID_DG_DEVICESETTINGS …
#define HID_DG_AZIMUTH …
#define HID_DG_CONFIDENCE …
#define HID_DG_WIDTH …
#define HID_DG_HEIGHT …
#define HID_DG_CONTACTID …
#define HID_DG_INPUTMODE …
#define HID_DG_DEVICEINDEX …
#define HID_DG_CONTACTCOUNT …
#define HID_DG_CONTACTMAX …
#define HID_DG_SCANTIME …
#define HID_DG_SURFACESWITCH …
#define HID_DG_BUTTONSWITCH …
#define HID_DG_BUTTONTYPE …
#define HID_DG_BARRELSWITCH2 …
#define HID_DG_TOOLSERIALNUMBER …
#define HID_DG_LATENCYMODE …
#define HID_BAT_ABSOLUTESTATEOFCHARGE …
#define HID_BAT_CHARGING …
#define HID_VD_ASUS_CUSTOM_MEDIA_KEYS …
#define HID_CONNECT_HIDINPUT …
#define HID_CONNECT_HIDINPUT_FORCE …
#define HID_CONNECT_HIDRAW …
#define HID_CONNECT_HIDDEV …
#define HID_CONNECT_HIDDEV_FORCE …
#define HID_CONNECT_FF …
#define HID_CONNECT_DRIVER …
#define HID_CONNECT_DEFAULT …
#define MAX_USBHID_BOOT_QUIRKS …
#define HID_QUIRK_NOTOUCH …
#define HID_QUIRK_IGNORE …
#define HID_QUIRK_NOGET …
#define HID_QUIRK_HIDDEV_FORCE …
#define HID_QUIRK_BADPAD …
#define HID_QUIRK_MULTI_INPUT …
#define HID_QUIRK_HIDINPUT_FORCE …
#define HID_QUIRK_ALWAYS_POLL …
#define HID_QUIRK_INPUT_PER_APP …
#define HID_QUIRK_X_INVERT …
#define HID_QUIRK_Y_INVERT …
#define HID_QUIRK_SKIP_OUTPUT_REPORTS …
#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID …
#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP …
#define HID_QUIRK_HAVE_SPECIAL_DRIVER …
#define HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE …
#define HID_QUIRK_NOINVERT …
#define HID_QUIRK_FULLSPEED_INTERVAL …
#define HID_QUIRK_NO_INIT_REPORTS …
#define HID_QUIRK_NO_IGNORE …
#define HID_QUIRK_NO_INPUT_SYNC …
#define HID_GROUP_GENERIC …
#define HID_GROUP_MULTITOUCH …
#define HID_GROUP_SENSOR_HUB …
#define HID_GROUP_MULTITOUCH_WIN_8 …
#define HID_GROUP_RMI …
#define HID_GROUP_WACOM …
#define HID_GROUP_LOGITECH_DJ_DEVICE …
#define HID_GROUP_STEAM …
#define HID_GROUP_LOGITECH_27MHZ_DEVICE …
#define HID_GROUP_VIVALDI …
#define HID_REPORT_PROTOCOL …
#define HID_BOOT_PROTOCOL …
struct hid_global { … };
#define HID_MAX_USAGES …
#define HID_DEFAULT_NUM_COLLECTIONS …
struct hid_local { … };
struct hid_collection { … };
struct hid_usage { … };
struct hid_input;
struct hid_field { … };
#define HID_MAX_FIELDS …
struct hid_field_entry { … };
struct hid_report { … };
#define HID_MAX_IDS …
struct hid_report_enum { … };
#define HID_MIN_BUFFER_SIZE …
#define HID_MAX_BUFFER_SIZE …
#define HID_CONTROL_FIFO_SIZE …
#define HID_OUTPUT_FIFO_SIZE …
struct hid_control_fifo { … };
struct hid_output_fifo { … };
#define HID_CLAIMED_INPUT …
#define HID_CLAIMED_HIDDEV …
#define HID_CLAIMED_HIDRAW …
#define HID_CLAIMED_DRIVER …
#define HID_STAT_ADDED …
#define HID_STAT_PARSED …
#define HID_STAT_DUP_DETECTED …
#define HID_STAT_REPROBED …
struct hid_input { … };
enum hid_type { … };
enum hid_battery_status { … };
struct hid_driver;
struct hid_ll_driver;
struct hid_device { … };
void hiddev_free(struct kref *ref);
#define to_hid_device(pdev) …
static inline void *hid_get_drvdata(struct hid_device *hdev)
{ … }
static inline void hid_set_drvdata(struct hid_device *hdev, void *data)
{ … }
#define HID_GLOBAL_STACK_SIZE …
#define HID_COLLECTION_STACK_SIZE …
#define HID_SCAN_FLAG_MT_WIN_8 …
#define HID_SCAN_FLAG_VENDOR_SPECIFIC …
#define HID_SCAN_FLAG_GD_POINTER …
struct hid_parser { … };
struct hid_class_descriptor { … } __attribute__ ((packed));
struct hid_descriptor { … } __attribute__ ((packed));
#define HID_DEVICE(b, g, ven, prod) …
#define HID_USB_DEVICE(ven, prod) …
#define HID_BLUETOOTH_DEVICE(ven, prod) …
#define HID_I2C_DEVICE(ven, prod) …
#define HID_REPORT_ID(rep) …
#define HID_USAGE_ID(uhid, utype, ucode) …
#define HID_TERMINATOR …
struct hid_report_id { … };
struct hid_usage_id { … };
struct hid_driver { … };
#define to_hid_driver(pdrv) …
struct hid_ll_driver { … };
extern bool hid_is_usb(const struct hid_device *hdev);
#define PM_HINT_FULLON …
#define PM_HINT_NORMAL …
#define IS_INPUT_APPLICATION(a) …
extern bool hid_ignore(struct hid_device *);
extern int hid_add_device(struct hid_device *);
extern void hid_destroy_device(struct hid_device *);
extern const struct bus_type hid_bus_type;
extern int __must_check __hid_register_driver(struct hid_driver *,
struct module *, const char *mod_name);
#define hid_register_driver(driver) …
extern void hid_unregister_driver(struct hid_driver *);
#define module_hid_driver(__hid_driver) …
extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report);
extern int hidinput_connect(struct hid_device *hid, unsigned int force);
extern void hidinput_disconnect(struct hid_device *);
struct hid_field *hid_find_field(struct hid_device *hdev, unsigned int report_type,
unsigned int application, unsigned int usage);
int hid_set_field(struct hid_field *, unsigned, __s32);
int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
int interrupt);
struct hid_field *hidinput_get_led_field(struct hid_device *hid);
unsigned int hidinput_count_leds(struct hid_device *hid);
__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
void hid_output_report(struct hid_report *report, __u8 *data);
int __hid_request(struct hid_device *hid, struct hid_report *rep, enum hid_class_request reqtype);
u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
struct hid_device *hid_allocate_device(void);
struct hid_report *hid_register_report(struct hid_device *device,
enum hid_report_type type, unsigned int id,
unsigned int application);
int hid_parse_report(struct hid_device *hid, const __u8 *start, unsigned size);
struct hid_report *hid_validate_values(struct hid_device *hid,
enum hid_report_type type, unsigned int id,
unsigned int field_index,
unsigned int report_counts);
void hid_setup_resolution_multiplier(struct hid_device *hid);
int hid_open_report(struct hid_device *device);
int hid_check_keys_pressed(struct hid_device *hid);
int hid_connect(struct hid_device *hid, unsigned int connect_mask);
void hid_disconnect(struct hid_device *hid);
bool hid_match_one_id(const struct hid_device *hdev,
const struct hid_device_id *id);
const struct hid_device_id *hid_match_id(const struct hid_device *hdev,
const struct hid_device_id *id);
const struct hid_device_id *hid_match_device(struct hid_device *hdev,
struct hid_driver *hdrv);
bool hid_compare_device_paths(struct hid_device *hdev_a,
struct hid_device *hdev_b, char separator);
s32 hid_snto32(__u32 value, unsigned n);
__u32 hid_field_extract(const struct hid_device *hid, __u8 *report,
unsigned offset, unsigned n);
#ifdef CONFIG_PM
int hid_driver_suspend(struct hid_device *hdev, pm_message_t state);
int hid_driver_reset_resume(struct hid_device *hdev);
int hid_driver_resume(struct hid_device *hdev);
#else
static inline int hid_driver_suspend(struct hid_device *hdev, pm_message_t state) { return 0; }
static inline int hid_driver_reset_resume(struct hid_device *hdev) { return 0; }
static inline int hid_driver_resume(struct hid_device *hdev) { return 0; }
#endif
static inline void hid_device_io_start(struct hid_device *hid) { … }
static inline void hid_device_io_stop(struct hid_device *hid) { … }
static inline void hid_map_usage(struct hid_input *hidinput,
struct hid_usage *usage, unsigned long **bit, int *max,
__u8 type, unsigned int c)
{ … }
static inline void hid_map_usage_clear(struct hid_input *hidinput,
struct hid_usage *usage, unsigned long **bit, int *max,
__u8 type, __u16 c)
{ … }
static inline int __must_check hid_parse(struct hid_device *hdev)
{ … }
int __must_check hid_hw_start(struct hid_device *hdev,
unsigned int connect_mask);
void hid_hw_stop(struct hid_device *hdev);
int __must_check hid_hw_open(struct hid_device *hdev);
void hid_hw_close(struct hid_device *hdev);
void hid_hw_request(struct hid_device *hdev,
struct hid_report *report, enum hid_class_request reqtype);
int __hid_hw_raw_request(struct hid_device *hdev,
unsigned char reportnum, __u8 *buf,
size_t len, enum hid_report_type rtype,
enum hid_class_request reqtype,
__u64 source, bool from_bpf);
int __hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len, __u64 source,
bool from_bpf);
int hid_hw_raw_request(struct hid_device *hdev,
unsigned char reportnum, __u8 *buf,
size_t len, enum hid_report_type rtype,
enum hid_class_request reqtype);
int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len);
static inline int hid_hw_power(struct hid_device *hdev, int level)
{ … }
static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle,
enum hid_class_request reqtype)
{ … }
static inline bool hid_hw_may_wakeup(struct hid_device *hdev)
{ … }
static inline void hid_hw_wait(struct hid_device *hdev)
{ … }
static inline u32 hid_report_len(struct hid_report *report)
{ … }
int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
int interrupt);
unsigned long hid_lookup_quirk(const struct hid_device *hdev);
int hid_quirks_init(char **quirks_param, __u16 bus, int count);
void hid_quirks_exit(__u16 bus);
#ifdef CONFIG_HID_PID
int hid_pidff_init(struct hid_device *hid);
#else
#define hid_pidff_init …
#endif
#define dbg_hid(fmt, ...) …
#define hid_err(hid, fmt, ...) …
#define hid_notice(hid, fmt, ...) …
#define hid_warn(hid, fmt, ...) …
#define hid_info(hid, fmt, ...) …
#define hid_dbg(hid, fmt, ...) …
#define hid_err_once(hid, fmt, ...) …
#define hid_notice_once(hid, fmt, ...) …
#define hid_warn_once(hid, fmt, ...) …
#define hid_info_once(hid, fmt, ...) …
#define hid_dbg_once(hid, fmt, ...) …
#endif