include/linux/hid.h
Source file repositories/reference/linux-study-clean/include/linux/hid.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/hid.h- Extension
.h- Size
- 44270 bytes
- Lines
- 1347
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/types.hlinux/slab.hlinux/list.hlinux/mod_devicetable.hlinux/timer.hlinux/workqueue.hlinux/input.hlinux/semaphore.hlinux/mutex.hlinux/power_supply.huapi/linux/hid.hlinux/hid_bpf.h
Detected Declarations
struct hid_itemstruct hid_globalstruct hid_localstruct hid_collectionstruct hid_usagestruct hid_inputstruct hid_fieldstruct hid_field_entrystruct hid_reportstruct hid_report_enumstruct hid_control_fifostruct hid_output_fifostruct hid_inputstruct hid_batterystruct hid_driverstruct hid_ll_driverstruct hid_devicestruct hid_parserstruct hid_class_descriptorstruct hid_descriptorstruct hid_report_idstruct hid_usage_idstruct hid_driverstruct hid_ll_driverenum hid_typeenum hid_battery_statusfunction hid_set_drvdatafunction hid_driver_suspendfunction hid_driver_reset_resumefunction hid_driver_resumefunction hid_device_io_startfunction hid_device_io_stopfunction hid_map_usagefunction bitsfunction devicefunction hid_hw_powerfunction hid_hw_idlefunction hid_hw_may_wakeupfunction hid_hw_waitfunction hid_report_len
Annotated Snippet
struct device_driver driver;
};
#define to_hid_driver(pdrv) \
container_of(pdrv, struct hid_driver, driver)
/**
* 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 {
int (*start)(struct hid_device *hdev);
void (*stop)(struct hid_device *hdev);
int (*open)(struct hid_device *hdev);
void (*close)(struct hid_device *hdev);
int (*power)(struct hid_device *hdev, int level);
int (*parse)(struct hid_device *hdev);
void (*request)(struct hid_device *hdev,
struct hid_report *report, int reqtype);
int (*wait)(struct hid_device *hdev);
int (*raw_request) (struct hid_device *hdev, unsigned char reportnum,
__u8 *buf, size_t len, unsigned char rtype,
int reqtype);
int (*output_report) (struct hid_device *hdev, __u8 *buf, size_t len);
int (*idle)(struct hid_device *hdev, int report, int idle, int reqtype);
bool (*may_wakeup)(struct hid_device *hdev);
unsigned int max_buffer_size;
};
extern bool hid_is_usb(const struct hid_device *hdev);
#define PM_HINT_FULLON 1<<5
#define PM_HINT_NORMAL 1<<1
/* 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) \
(((a >= HID_UP_GENDESK) && (a <= HID_GD_MULTIAXIS)) \
|| ((a >= HID_DG_DIGITIZER) && (a <= HID_DG_WHITEBOARD)) \
|| (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL) \
|| (a == HID_GD_WIRELESS_RADIO_CTLS))
/* 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) \
__hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
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) \
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/types.h`, `linux/slab.h`, `linux/list.h`, `linux/mod_devicetable.h`, `linux/timer.h`, `linux/workqueue.h`, `linux/input.h`.
- Detected declarations: `struct hid_item`, `struct hid_global`, `struct hid_local`, `struct hid_collection`, `struct hid_usage`, `struct hid_input`, `struct hid_field`, `struct hid_field_entry`, `struct hid_report`, `struct hid_report_enum`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.