drivers/hid/hid-logitech-dj.c
Source file repositories/reference/linux-study-clean/drivers/hid/hid-logitech-dj.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/hid-logitech-dj.c- Extension
.c- Size
- 75363 bytes
- Lines
- 2172
- 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/hid.hlinux/module.hlinux/kfifo.hlinux/delay.hlinux/usb.hlinux/unaligned.hhid-ids.h
Detected Declarations
struct dj_reportstruct hidpp_eventstruct dj_receiver_devstruct dj_devicestruct dj_workitemenum recvr_typefunction recvr_type_is_bluetoothfunction dj_release_receiver_devfunction dj_put_receiver_devfunction logi_dj_recv_destroy_djhid_devicefunction logi_dj_recv_add_djhid_devicefunction delayedwork_callbackfunction logi_dj_recv_queue_unknown_workfunction logi_dj_recv_queue_notificationfunction logi_hidpp_dev_conn_notif_equadfunction logi_hidpp_dev_conn_notif_27mhzfunction logi_hidpp_recv_queue_notiffunction logi_dj_recv_forward_null_reportfunction logi_dj_recv_forward_djfunction logi_dj_recv_forward_reportfunction logi_dj_recv_forward_input_reportfunction logi_dj_recv_send_reportfunction logi_dj_recv_query_hidpp_devicesfunction logi_dj_recv_query_paired_devicesfunction logi_dj_recv_switch_to_dj_modefunction logi_dj_ll_openfunction logi_dj_ll_closefunction logi_dj_ll_raw_requestfunction rdcatfunction logi_dj_ll_parsefunction logi_dj_ll_startfunction logi_dj_ll_stopfunction logi_dj_ll_may_wakeupfunction logi_dj_dj_eventfunction devicefunction logi_dj_hidpp_eventfunction logi_dj_raw_eventfunction receiverfunction logi_dj_probefunction logi_dj_reset_resumefunction logi_dj_remove
Annotated Snippet
struct dj_report {
u8 report_id;
u8 device_index;
u8 report_type;
u8 report_params[DJREPORT_SHORT_LENGTH - 3];
};
struct hidpp_event {
u8 report_id;
u8 device_index;
u8 sub_id;
u8 params[HIDPP_REPORT_LONG_LENGTH - 3U];
} __packed;
struct dj_receiver_dev {
struct hid_device *mouse;
struct hid_device *keyboard;
struct hid_device *hidpp;
struct dj_device *paired_dj_devices[DJ_MAX_PAIRED_DEVICES +
DJ_DEVICE_INDEX_MIN];
struct list_head list;
struct kref kref;
struct work_struct work;
struct kfifo notif_fifo;
unsigned long last_query; /* in jiffies */
bool ready;
bool dj_mode;
enum recvr_type type;
unsigned int unnumbered_application;
spinlock_t lock;
};
struct dj_device {
struct hid_device *hdev;
struct dj_receiver_dev *dj_receiver_dev;
u64 reports_supported;
u8 device_index;
};
#define WORKITEM_TYPE_EMPTY 0
#define WORKITEM_TYPE_PAIRED 1
#define WORKITEM_TYPE_UNPAIRED 2
#define WORKITEM_TYPE_UNKNOWN 255
struct dj_workitem {
u8 type; /* WORKITEM_TYPE_* */
u8 device_index;
u8 device_type;
u8 quad_id_msb;
u8 quad_id_lsb;
u64 reports_supported;
};
/* Keyboard descriptor (1) */
static const char kbd_descriptor[] = {
0x05, 0x01, /* USAGE_PAGE (generic Desktop) */
0x09, 0x06, /* USAGE (Keyboard) */
0xA1, 0x01, /* COLLECTION (Application) */
0x85, 0x01, /* REPORT_ID (1) */
0x95, 0x08, /* REPORT_COUNT (8) */
0x75, 0x01, /* REPORT_SIZE (1) */
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
0x05, 0x07, /* USAGE_PAGE (Keyboard) */
0x19, 0xE0, /* USAGE_MINIMUM (Left Control) */
0x29, 0xE7, /* USAGE_MAXIMUM (Right GUI) */
0x81, 0x02, /* INPUT (Data,Var,Abs) */
0x95, 0x06, /* REPORT_COUNT (6) */
0x75, 0x08, /* REPORT_SIZE (8) */
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
0x26, 0xFF, 0x00, /* LOGICAL_MAXIMUM (255) */
0x05, 0x07, /* USAGE_PAGE (Keyboard) */
0x19, 0x00, /* USAGE_MINIMUM (no event) */
0x2A, 0xFF, 0x00, /* USAGE_MAXIMUM (reserved) */
0x81, 0x00, /* INPUT (Data,Ary,Abs) */
0x85, 0x0e, /* REPORT_ID (14) */
0x05, 0x08, /* USAGE PAGE (LED page) */
0x95, 0x05, /* REPORT COUNT (5) */
0x75, 0x01, /* REPORT SIZE (1) */
0x15, 0x00, /* LOGICAL_MINIMUM (0) */
0x25, 0x01, /* LOGICAL_MAXIMUM (1) */
0x19, 0x01, /* USAGE MINIMUM (1) */
0x29, 0x05, /* USAGE MAXIMUM (5) */
0x91, 0x02, /* OUTPUT (Data, Variable, Absolute) */
0x95, 0x01, /* REPORT COUNT (1) */
0x75, 0x03, /* REPORT SIZE (3) */
0x91, 0x01, /* OUTPUT (Constant) */
0xC0
};
Annotation
- Immediate include surface: `linux/device.h`, `linux/hid.h`, `linux/module.h`, `linux/kfifo.h`, `linux/delay.h`, `linux/usb.h`, `linux/unaligned.h`, `hid-ids.h`.
- Detected declarations: `struct dj_report`, `struct hidpp_event`, `struct dj_receiver_dev`, `struct dj_device`, `struct dj_workitem`, `enum recvr_type`, `function recvr_type_is_bluetooth`, `function dj_release_receiver_dev`, `function dj_put_receiver_dev`, `function logi_dj_recv_destroy_djhid_device`.
- 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.