drivers/hid/hid-logitech-hidpp.c
Source file repositories/reference/linux-study-clean/drivers/hid/hid-logitech-hidpp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/hid-logitech-hidpp.c- Extension
.c- Size
- 139832 bytes
- Lines
- 4788
- Domain
- Driver Families
- Bucket
- drivers/hid
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/input.hlinux/usb.hlinux/hid.hlinux/module.hlinux/slab.hlinux/sched.hlinux/sched/clock.hlinux/kfifo.hlinux/input/mt.hlinux/workqueue.hlinux/atomic.hlinux/fixp-arith.hlinux/unaligned.husbhid/usbhid.hhid-ids.h
Detected Declarations
struct fapstruct rapstruct hidpp_reportstruct hidpp_batterystruct hidpp_scroll_counterstruct hidpp_devicestruct hidpp_touchpad_fw_itemsstruct hidpp_touchpad_raw_infostruct hidpp_touchpad_raw_xy_fingerstruct hidpp_touchpad_raw_xystruct hidpp_ff_private_datastruct hidpp_ff_work_datastruct wtp_datastruct k400_private_datafunction __hidpp_send_reportfunction hidpp_send_message_syncfunction hidpp_send_message_syncfunction hidpp_send_fap_command_syncfunction hidpp_send_rap_command_syncfunction hidpp_match_answerfunction hidpp_match_errorfunction hidpp_report_is_connect_eventfunction hidpp_prefix_namefunction hidpp_update_usb_wireless_statusfunction hidpp_scroll_counter_handle_scrollfunction detentsfunction hidpp10_set_registerfunction hidpp10_enable_battery_reportingfunction hidpp10_enable_scrolling_accelerationfunction hidpp10_battery_status_map_levelfunction hidpp10_battery_status_map_statusfunction hidpp10_query_battery_statusfunction hidpp10_battery_mileage_map_statusfunction hidpp10_query_battery_mileagefunction hidpp10_battery_eventfunction hidpp_unifying_get_serialfunction hidpp_unifying_initfunction hidpp_root_get_featurefunction hidpp_root_get_protocol_versionfunction hidpp_get_serialfunction hidpp_serial_initfunction hidpp_devicenametype_get_countfunction hidpp_devicenametype_get_device_namefunction hidpp_map_battery_levelfunction hidpp20_batterylevel_map_status_capacityfunction hidpp20_batterylevel_get_battery_capacityfunction hidpp20_batterylevel_get_battery_infofunction hidpp20_query_battery_info_1000
Annotated Snippet
struct fap {
u8 feature_index;
u8 funcindex_clientid;
u8 params[HIDPP_REPORT_VERY_LONG_MAX_LENGTH - 4U];
};
struct rap {
u8 sub_id;
u8 reg_address;
u8 params[HIDPP_REPORT_VERY_LONG_MAX_LENGTH - 4U];
};
struct hidpp_report {
u8 report_id;
u8 device_index;
union {
struct fap fap;
struct rap rap;
u8 rawbytes[sizeof(struct fap)];
};
} __packed;
struct hidpp_battery {
u8 feature_index;
u8 solar_feature_index;
u8 voltage_feature_index;
u8 adc_measurement_feature_index;
struct power_supply_desc desc;
struct power_supply *ps;
char name[64];
int status;
int capacity;
int level;
int voltage;
int charge_type;
bool online;
u8 supported_levels_1004;
};
/**
* struct hidpp_scroll_counter - Utility class for processing high-resolution
* scroll events.
* @wheel_multiplier: the scalar multiplier to be applied to each wheel event
* @remainder: counts the number of high-resolution units moved since the last
* low-resolution event (REL_WHEEL or REL_HWHEEL) was sent. Should
* only be used by class methods.
* @direction: direction of last movement (1 or -1)
* @last_time: last event time, used to reset remainder after inactivity
*/
struct hidpp_scroll_counter {
int wheel_multiplier;
int remainder;
int direction;
unsigned long long last_time;
};
struct hidpp_device {
struct hid_device *hid_dev;
struct input_dev *input;
struct mutex send_mutex;
void *send_receive_buf;
char *name; /* will never be NULL and should not be freed */
wait_queue_head_t wait;
int very_long_report_length;
bool answer_available;
u8 protocol_major;
u8 protocol_minor;
void *private_data;
struct work_struct work;
struct work_struct reset_hi_res_work;
struct kfifo delayed_work_fifo;
struct input_dev *delayed_input;
unsigned long quirks;
unsigned long capabilities;
u8 supported_reports;
struct hidpp_battery battery;
struct hidpp_scroll_counter vertical_wheel_counter;
u8 wireless_feature_index;
int hires_wheel_multiplier;
u8 hires_wheel_feature_index;
bool connected_once;
};
Annotation
- Immediate include surface: `linux/device.h`, `linux/input.h`, `linux/usb.h`, `linux/hid.h`, `linux/module.h`, `linux/slab.h`, `linux/sched.h`, `linux/sched/clock.h`.
- Detected declarations: `struct fap`, `struct rap`, `struct hidpp_report`, `struct hidpp_battery`, `struct hidpp_scroll_counter`, `struct hidpp_device`, `struct hidpp_touchpad_fw_items`, `struct hidpp_touchpad_raw_info`, `struct hidpp_touchpad_raw_xy_finger`, `struct hidpp_touchpad_raw_xy`.
- Atlas domain: Driver Families / drivers/hid.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.