drivers/hid/hid-lg.c
Source file repositories/reference/linux-study-clean/drivers/hid/hid-lg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/hid-lg.c- Extension
.c- Size
- 41390 bytes
- Lines
- 947
- 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.
- 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/random.hlinux/sched.hlinux/usb.hlinux/wait.husbhid/usbhid.hhid-ids.hhid-lg.hhid-lg4ff.h
Detected Declarations
function lg_ultrax_remote_mappingfunction lg_wireless_mappingfunction lg_input_mappingfunction lg_input_mappedfunction lg_eventfunction lg_raw_eventfunction lg_probefunction lg_remove
Annotated Snippet
if (*rsize == FG_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Wingman Formula GP report descriptor\n");
*rsize = sizeof(fg_rdesc_fixed);
return fg_rdesc_fixed;
} else {
hid_info(hdev,
"rdesc size test failed for formula gp\n");
}
break;
case USB_DEVICE_ID_LOGITECH_WINGMAN_FFG:
if (*rsize == FFG_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Wingman Formula Force GP report descriptor\n");
*rsize = sizeof(ffg_rdesc_fixed);
return ffg_rdesc_fixed;
}
break;
/* Several wheels report as this id when operating in emulation mode. */
case USB_DEVICE_ID_LOGITECH_WHEEL:
if (*rsize == DF_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Driving Force report descriptor\n");
*rsize = sizeof(df_rdesc_fixed);
return df_rdesc_fixed;
}
break;
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL:
if (*rsize == MOMO_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Momo Force (Red) report descriptor\n");
*rsize = sizeof(momo_rdesc_fixed);
return momo_rdesc_fixed;
}
break;
case USB_DEVICE_ID_LOGITECH_MOMO_WHEEL2:
if (*rsize == MOMO2_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Momo Racing Force (Black) report descriptor\n");
*rsize = sizeof(momo2_rdesc_fixed);
return momo2_rdesc_fixed;
}
break;
case USB_DEVICE_ID_LOGITECH_VIBRATION_WHEEL:
if (*rsize == FV_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Formula Vibration report descriptor\n");
*rsize = sizeof(fv_rdesc_fixed);
return fv_rdesc_fixed;
}
break;
case USB_DEVICE_ID_LOGITECH_DFP_WHEEL:
if (*rsize == DFP_RDESC_ORIG_SIZE) {
hid_info(hdev,
"fixing up Logitech Driving Force Pro report descriptor\n");
*rsize = sizeof(dfp_rdesc_fixed);
return dfp_rdesc_fixed;
}
break;
case USB_DEVICE_ID_LOGITECH_WII_WHEEL:
if (*rsize >= 101 && rdesc[41] == 0x95 && rdesc[42] == 0x0B &&
rdesc[47] == 0x05 && rdesc[48] == 0x09) {
hid_info(hdev, "fixing up Logitech Speed Force Wireless report descriptor\n");
rdesc[41] = 0x05;
rdesc[42] = 0x09;
rdesc[47] = 0x95;
rdesc[48] = 0x0B;
}
break;
}
return rdesc;
}
#define lg_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
EV_KEY, (c))
static int lg_ultrax_remote_mapping(struct hid_input *hi,
struct hid_usage *usage, unsigned long **bit, int *max)
{
if ((usage->hid & HID_USAGE_PAGE) != HID_UP_LOGIVENDOR)
return 0;
Annotation
- Immediate include surface: `linux/device.h`, `linux/hid.h`, `linux/module.h`, `linux/random.h`, `linux/sched.h`, `linux/usb.h`, `linux/wait.h`, `usbhid/usbhid.h`.
- Detected declarations: `function lg_ultrax_remote_mapping`, `function lg_wireless_mapping`, `function lg_input_mapping`, `function lg_input_mapped`, `function lg_event`, `function lg_raw_event`, `function lg_probe`, `function lg_remove`.
- Atlas domain: Driver Families / drivers/hid.
- Implementation status: source 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.