drivers/hid/hid-steelseries.c
Source file repositories/reference/linux-study-clean/drivers/hid/hid-steelseries.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/hid-steelseries.c- Extension
.c- Size
- 22990 bytes
- Lines
- 754
- 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/usb.hlinux/leds.hhid-ids.h
Detected Declarations
struct steelseries_devicestruct steelseries_srws1_datafunction steelseries_srws1_set_ledsfunction steelseries_srws1_led_all_set_brightnessfunction steelseries_srws1_led_all_get_brightnessfunction steelseries_srws1_led_set_brightnessfunction steelseries_srws1_led_get_brightnessfunction steelseries_srws1_probefunction steelseries_headset_request_batteryfunction steelseries_headset_fetch_batteryfunction battery_capacity_to_levelfunction steelseries_headset_battery_timer_tickfunction steelseries_headset_battery_get_propertyfunction steelseries_headset_set_wireless_statusfunction steelseries_headset_battery_registerfunction steelseries_is_vendor_usage_pagefunction steelseries_probefunction steelseries_removefunction steelseries_headset_map_capacityfunction steelseries_headset_raw_event
Annotated Snippet
struct steelseries_device {
struct hid_device *hdev;
unsigned long quirks;
struct delayed_work battery_work;
spinlock_t lock;
bool removed;
struct power_supply_desc battery_desc;
struct power_supply *battery;
uint8_t battery_capacity;
bool headset_connected;
bool battery_charging;
};
#if IS_BUILTIN(CONFIG_LEDS_CLASS) || \
(IS_MODULE(CONFIG_LEDS_CLASS) && IS_MODULE(CONFIG_HID_STEELSERIES))
#define SRWS1_NUMBER_LEDS 15
struct steelseries_srws1_data {
__u16 led_state;
/* the last element is used for setting all leds simultaneously */
struct led_classdev *led[SRWS1_NUMBER_LEDS + 1];
};
#endif
/* Fixed report descriptor for Steelseries SRW-S1 wheel controller
*
* The original descriptor hides the sensitivity and assists dials
* a custom vendor usage page. This inserts a patch to make them
* appear in the 'Generic Desktop' usage.
*/
static const __u8 steelseries_srws1_rdesc_fixed[] = {
0x05, 0x01, /* Usage Page (Desktop) */
0x09, 0x08, /* Usage (MultiAxis), Changed */
0xA1, 0x01, /* Collection (Application), */
0xA1, 0x02, /* Collection (Logical), */
0x95, 0x01, /* Report Count (1), */
0x05, 0x01, /* Changed Usage Page (Desktop), */
0x09, 0x30, /* Changed Usage (X), */
0x16, 0xF8, 0xF8, /* Logical Minimum (-1800), */
0x26, 0x08, 0x07, /* Logical Maximum (1800), */
0x65, 0x14, /* Unit (Degrees), */
0x55, 0x0F, /* Unit Exponent (15), */
0x75, 0x10, /* Report Size (16), */
0x81, 0x02, /* Input (Variable), */
0x09, 0x31, /* Changed Usage (Y), */
0x15, 0x00, /* Logical Minimum (0), */
0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
0x75, 0x0C, /* Report Size (12), */
0x81, 0x02, /* Input (Variable), */
0x09, 0x32, /* Changed Usage (Z), */
0x15, 0x00, /* Logical Minimum (0), */
0x26, 0xFF, 0x03, /* Logical Maximum (1023), */
0x75, 0x0C, /* Report Size (12), */
0x81, 0x02, /* Input (Variable), */
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x39, /* Usage (Hat Switch), */
0x25, 0x07, /* Logical Maximum (7), */
0x35, 0x00, /* Physical Minimum (0), */
0x46, 0x3B, 0x01, /* Physical Maximum (315), */
0x65, 0x14, /* Unit (Degrees), */
0x75, 0x04, /* Report Size (4), */
0x95, 0x01, /* Report Count (1), */
0x81, 0x02, /* Input (Variable), */
0x25, 0x01, /* Logical Maximum (1), */
0x45, 0x01, /* Physical Maximum (1), */
0x65, 0x00, /* Unit, */
0x75, 0x01, /* Report Size (1), */
0x95, 0x03, /* Report Count (3), */
0x81, 0x01, /* Input (Constant), */
0x05, 0x09, /* Usage Page (Button), */
0x19, 0x01, /* Usage Minimum (01h), */
0x29, 0x11, /* Usage Maximum (11h), */
0x95, 0x11, /* Report Count (17), */
0x81, 0x02, /* Input (Variable), */
/* ---- Dial patch starts here ---- */
0x05, 0x01, /* Usage Page (Desktop), */
0x09, 0x33, /* Usage (RX), */
0x75, 0x04, /* Report Size (4), */
0x95, 0x02, /* Report Count (2), */
0x15, 0x00, /* Logical Minimum (0), */
0x25, 0x0b, /* Logical Maximum (b), */
0x81, 0x02, /* Input (Variable), */
0x09, 0x35, /* Usage (RZ), */
0x75, 0x04, /* Report Size (4), */
0x95, 0x01, /* Report Count (1), */
0x25, 0x03, /* Logical Maximum (3), */
0x81, 0x02, /* Input (Variable), */
/* ---- Dial patch ends here ---- */
Annotation
- Immediate include surface: `linux/device.h`, `linux/hid.h`, `linux/module.h`, `linux/usb.h`, `linux/leds.h`, `hid-ids.h`.
- Detected declarations: `struct steelseries_device`, `struct steelseries_srws1_data`, `function steelseries_srws1_set_leds`, `function steelseries_srws1_led_all_set_brightness`, `function steelseries_srws1_led_all_get_brightness`, `function steelseries_srws1_led_set_brightness`, `function steelseries_srws1_led_get_brightness`, `function steelseries_srws1_probe`, `function steelseries_headset_request_battery`, `function steelseries_headset_fetch_battery`.
- 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.