linux/include/linux/hid.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 *  Copyright (c) 1999 Andreas Gal
 *  Copyright (c) 2000-2001 Vojtech Pavlik
 *  Copyright (c) 2006-2007 Jiri Kosina
 */
/*
 *
 * Should you need to contact me, the author, you can do so either by
 * e-mail - mail your message to <[email protected]>, or by paper mail:
 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
 */
#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> /* hid_device_id */
#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>

/*
 * We parse each description item into this structure. Short items data
 * values are expanded to 32-bit signed int, long items contain a pointer
 * into the data area.
 */

struct hid_item {};

/*
 * HID report item format
 */

#define HID_ITEM_FORMAT_SHORT
#define HID_ITEM_FORMAT_LONG

/*
 * Special tag indicating long items
 */

#define HID_ITEM_TAG_LONG

/*
 * HID report descriptor item type (prefix bit 2,3)
 */

#define HID_ITEM_TYPE_MAIN
#define HID_ITEM_TYPE_GLOBAL
#define HID_ITEM_TYPE_LOCAL
#define HID_ITEM_TYPE_RESERVED

/*
 * HID report descriptor main item tags
 */

#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

/*
 * HID report descriptor main item contents
 */

#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

/*
 * HID report descriptor collection item types
 */

#define HID_COLLECTION_PHYSICAL
#define HID_COLLECTION_APPLICATION
#define HID_COLLECTION_LOGICAL
#define HID_COLLECTION_NAMED_ARRAY

/*
 * HID report descriptor global item tags
 */

#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

/*
 * HID report descriptor local item tags
 */

#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

/*
 * HID usage tables
 */

#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
/*
 * Microsoft Win8 Wireless Radio Controls extensions CA, see:
 * http://www.usb.org/developers/hidpage/HUTRR40RadioHIDUsagesFinal.pdf
 */
#define HID_GD_WIRELESS_RADIO_CTLS
/*
 * System Multi-Axis, see:
 * http://www.usb.org/developers/hidpage/HUTRR62_-_Generic_Desktop_CA_for_System_Multi-Axis_Controllers.txt
 */
#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
/* Microsoft Win8 Wireless Radio Controls CA usage codes */
#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

/*
 * HID connect requests
 */

#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

/*
 * HID device quirks.
 */

/*
 * Increase this if you need to configure more HID quirks at module load time
 */
#define MAX_USBHID_BOOT_QUIRKS

/**
 * DOC: HID quirks
 * | @HID_QUIRK_NOTOUCH:
 * | @HID_QUIRK_IGNORE: ignore this device
 * | @HID_QUIRK_NOGET:
 * | @HID_QUIRK_HIDDEV_FORCE:
 * | @HID_QUIRK_BADPAD:
 * | @HID_QUIRK_MULTI_INPUT:
 * | @HID_QUIRK_HIDINPUT_FORCE:
 * | @HID_QUIRK_ALWAYS_POLL:
 * | @HID_QUIRK_INPUT_PER_APP:
 * | @HID_QUIRK_X_INVERT:
 * | @HID_QUIRK_Y_INVERT:
 * | @HID_QUIRK_SKIP_OUTPUT_REPORTS:
 * | @HID_QUIRK_SKIP_OUTPUT_REPORT_ID:
 * | @HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP:
 * | @HID_QUIRK_HAVE_SPECIAL_DRIVER:
 * | @HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE:
 * | @HID_QUIRK_FULLSPEED_INTERVAL:
 * | @HID_QUIRK_NO_INIT_REPORTS:
 * | @HID_QUIRK_NO_IGNORE:
 * | @HID_QUIRK_NO_INPUT_SYNC:
 */
/* BIT(0) reserved for backward compatibility, was HID_QUIRK_INVERT */
#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
/* BIT(8) reserved for backward compatibility, was HID_QUIRK_NO_EMPTY_INPUT */
/* BIT(9) reserved for backward compatibility, was NO_INIT_INPUT_REPORTS */
#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

/*
 * HID device groups
 *
 * Note: HID_GROUP_ANY is declared in linux/mod_devicetable.h
 * and has a value of 0x0000
 */
#define HID_GROUP_GENERIC
#define HID_GROUP_MULTITOUCH
#define HID_GROUP_SENSOR_HUB
#define HID_GROUP_MULTITOUCH_WIN_8

/*
 * Vendor specific HID device groups
 */
#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

/*
 * HID protocol status
 */
#define HID_REPORT_PROTOCOL
#define HID_BOOT_PROTOCOL

/*
 * This is the global environment of the parser. This information is
 * persistent for main-items. The global environment can be saved and
 * restored with PUSH/POP statements.
 */

struct hid_global {};

/*
 * This is the local environment. It is persistent up the next main-item.
 */

#define HID_MAX_USAGES
#define HID_DEFAULT_NUM_COLLECTIONS

struct hid_local {};

/*
 * This is the collection stack. We climb up the stack to determine
 * application and function of each field.
 */

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)
/* we don't want to catch types and codes equal to 0 */
#define HID_TERMINATOR

struct hid_report_id {};
struct hid_usage_id {};

/**
 * struct hid_driver
 * @name: driver name (e.g. "Footech_bar-wheel")
 * @id_table: which devices is this driver for (must be non-NULL for probe
 * 	      to be called)
 * @dyn_list: list of dynamically added device ids
 * @dyn_lock: lock protecting @dyn_list
 * @match: check if the given device is handled by this driver
 * @probe: new device inserted
 * @remove: device removed (NULL if not a hot-plug capable driver)
 * @report_table: on which reports to call raw_event (NULL means all)
 * @raw_event: if report in report_table, this hook is called (NULL means nop)
 * @usage_table: on which events to call event (NULL means all)
 * @event: if usage in usage_table, this hook is called (NULL means nop)
 * @report: this hook is called after parsing a report (NULL means nop)
 * @report_fixup: called before report descriptor parsing (NULL means nop)
 * @input_mapping: invoked on input registering before mapping an usage
 * @input_mapped: invoked on input registering after mapping an usage
 * @input_configured: invoked just before the device is registered
 * @feature_mapping: invoked on feature registering
 * @suspend: invoked on suspend (NULL means nop)
 * @resume: invoked on resume if device was not reset (NULL means nop)
 * @reset_resume: invoked on resume if device was reset (NULL means nop)
 *
 * probe should return -errno on error, or 0 on success. During probe,
 * input will not be passed to raw_event unless hid_device_io_start is
 * called.
 *
 * raw_event and event should return negative on error, any other value will
 * pass the event on to .event() typically return 0 for success.
 *
 * input_mapping shall return a negative value to completely ignore this usage
 * (e.g. doubled or invalid usage), zero to continue with parsing of this
 * usage by generic code (no special handling needed) or positive to skip
 * generic parsing (needed special handling which was done in the hook already)
 * input_mapped shall return negative to inform the layer that this usage
 * should not be considered for further processing or zero to notify that
 * no processing was performed and should be done in a generic manner
 * Both these functions may be NULL which means the same behavior as returning
 * zero from them.
 */
struct hid_driver {};

#define to_hid_driver(pdrv)

/**
 * struct hid_ll_driver - low level driver callbacks
 * @start: called on probe to start the device
 * @stop: called on remove
 * @open: called by input layer on open
 * @close: called by input layer on close
 * @power: request underlying hardware to enter requested power mode
 * @parse: this method is called only once to parse the device data,
 *	   shouldn't allocate anything to not leak memory
 * @request: send report request to device (e.g. feature report)
 * @wait: wait for buffered io to complete (send/recv reports)
 * @raw_request: send raw report request to device (e.g. feature report)
 * @output_report: send output report to device
 * @idle: send idle request to device
 * @may_wakeup: return if device may act as a wakeup source during system-suspend
 * @max_buffer_size: over-ride maximum data buffer size (default: HID_MAX_BUFFER_SIZE)
 */
struct hid_ll_driver {};

extern bool hid_is_usb(const struct hid_device *hdev);

#define PM_HINT_FULLON
#define PM_HINT_NORMAL

/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
/* We ignore a few input applications that are not widely used */
#define IS_INPUT_APPLICATION(a)

/* HID core API */

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);

/* use a define to avoid include chaining to get THIS_MODULE & friends */
#define hid_register_driver(driver)

extern void hid_unregister_driver(struct hid_driver *);

/**
 * module_hid_driver() - Helper macro for registering a HID driver
 * @__hid_driver: hid_driver struct
 *
 * Helper macro for HID drivers which do not do anything special in module
 * init/exit. This eliminates a lot of boilerplate. Each module may only
 * use this macro once, and calling it replaces module_init() and module_exit()
 */
#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 *);

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, __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

/**
 * hid_device_io_start - enable HID input during probe, remove
 *
 * @hid: the device
 *
 * This should only be called during probe or remove and only be
 * called by the thread calling probe or remove. It will allow
 * incoming packets to be delivered to the driver.
 */
static inline void hid_device_io_start(struct hid_device *hid) {}

/**
 * hid_device_io_stop - disable HID input during probe, remove
 *
 * @hid: the device
 *
 * Should only be called after hid_device_io_start. It will prevent
 * incoming packets from going to the driver for the duration of
 * probe, remove. If called during probe, packets will still go to the
 * driver after probe is complete. This function should only be called
 * by the thread calling probe or remove.
 */
static inline void hid_device_io_stop(struct hid_device *hid) {}

/**
 * hid_map_usage - map usage input bits
 *
 * @hidinput: hidinput which we are interested in
 * @usage: usage to fill in
 * @bit: pointer to input->{}bit (out parameter)
 * @max: maximal valid usage->code to consider later (out parameter)
 * @type: input event type (EV_KEY, EV_REL, ...)
 * @c: code which corresponds to this usage and type
 *
 * The value pointed to by @bit will be set to NULL if either @type is
 * an unhandled event type, or if @c is out of range for @type. This
 * can be used as an error condition.
 */
static inline void hid_map_usage(struct hid_input *hidinput,
		struct hid_usage *usage, unsigned long **bit, int *max,
		__u8 type, unsigned int c)
{}

/**
 * hid_map_usage_clear - map usage input bits and clear the input bit
 *
 * @hidinput: hidinput which we are interested in
 * @usage: usage to fill in
 * @bit: pointer to input->{}bit (out parameter)
 * @max: maximal valid usage->code to consider later (out parameter)
 * @type: input event type (EV_KEY, EV_REL, ...)
 * @c: code which corresponds to this usage and type
 *
 * The same as hid_map_usage, except the @c bit is also cleared in supported
 * bits (@bit).
 */
static inline void hid_map_usage_clear(struct hid_input *hidinput,
		struct hid_usage *usage, unsigned long **bit, int *max,
		__u8 type, __u16 c)
{}

/**
 * hid_parse - parse HW reports
 *
 * @hdev: hid device
 *
 * Call this from probe after you set up the device (if needed). Your
 * report_fixup will be called (if non-NULL) after reading raw report from
 * device before passing it to hid layer for real parsing.
 */
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);

/**
 * hid_hw_power - requests underlying HW to go into given power mode
 *
 * @hdev: hid device
 * @level: requested power level (one of %PM_HINT_* defines)
 *
 * This function requests underlying hardware to enter requested power
 * mode.
 */

static inline int hid_hw_power(struct hid_device *hdev, int level)
{}


/**
 * hid_hw_idle - send idle request to device
 *
 * @hdev: hid device
 * @report: report to control
 * @idle: idle state
 * @reqtype: hid request type
 */
static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle,
		enum hid_class_request reqtype)
{}

/**
 * hid_hw_may_wakeup - return if the hid device may act as a wakeup source during system-suspend
 *
 * @hdev: hid device
 */
static inline bool hid_hw_may_wakeup(struct hid_device *hdev)
{}

/**
 * hid_hw_wait - wait for buffered io to complete
 *
 * @hdev: hid device
 */
static inline void hid_hw_wait(struct hid_device *hdev)
{}

/**
 * hid_report_len - calculate the report length
 *
 * @report: the report we want to know the length
 */
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);

/* HID quirks API */
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