drivers/hid/hid-lenovo-go.c
Source file repositories/reference/linux-study-clean/drivers/hid/hid-lenovo-go.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/hid-lenovo-go.c- Extension
.c- Size
- 67209 bytes
- Lines
- 2510
- 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/array_size.hlinux/cleanup.hlinux/completion.hlinux/delay.hlinux/dev_printk.hlinux/device.hlinux/device/devres.hlinux/hid.hlinux/jiffies.hlinux/kstrtox.hlinux/led-class-multicolor.hlinux/mutex.hlinux/printk.hlinux/sysfs.hlinux/types.hlinux/unaligned.hlinux/usb.hlinux/workqueue.hlinux/workqueue_types.hhid-ids.h
Detected Declarations
struct go_cfg_attrstruct command_reportenum command_idenum mcu_command_indexenum dev_typeenum enabled_status_indexenum version_data_indexenum feature_status_indexenum fps_switch_status_indexenum gamepad_mode_indexenum motor_cfg_indexenum intensity_indexenum rumble_mode_indexenum cal_device_typeenum cal_enableenum cal_status_indexenum rgb_config_indexenum rgb_mode_indexenum rgb_effect_indexenum device_status_indexenum os_mode_cfg_indexenum os_mode_type_indexfunction hid_go_version_eventfunction hid_go_feature_status_eventfunction hid_go_motor_eventfunction hid_go_fps_dpi_eventfunction hid_go_light_eventfunction hid_go_device_status_eventfunction hid_go_os_mode_cfg_eventfunction hid_go_set_event_returnfunction get_endpoint_addressfunction hid_go_raw_eventfunction mcu_property_outfunction version_showfunction feature_status_storefunction feature_status_showfunction feature_status_optionsfunction motor_config_storefunction motor_config_showfunction motor_config_optionsfunction fps_mode_dpi_storefunction fps_mode_dpi_showfunction fps_mode_dpi_index_showfunction device_status_showfunction calibrate_config_storefunction calibrate_config_optionsfunction os_mode_storefunction os_mode_show
Annotated Snippet
struct go_cfg_attr {
u8 index;
};
struct command_report {
u8 report_id;
u8 id;
u8 cmd;
u8 sub_cmd;
u8 device_type;
u8 data[59];
} __packed;
enum command_id {
MCU_CONFIG_DATA = 0x00,
OS_MODE_DATA = 0x06,
GAMEPAD_DATA = 0x3c,
};
enum mcu_command_index {
GET_VERSION_DATA = 0x02,
GET_FEATURE_STATUS,
SET_FEATURE_STATUS,
GET_MOTOR_CFG,
SET_MOTOR_CFG,
GET_DPI_CFG,
SET_DPI_CFG,
SET_TRIGGER_CFG = 0x0a,
SET_JOYSTICK_CFG = 0x0c,
SET_GYRO_CFG = 0x0e,
GET_RGB_CFG,
SET_RGB_CFG,
GET_DEVICE_STATUS = 0xa0,
};
enum dev_type {
UNSPECIFIED,
USB_MCU,
TX_DONGLE,
LEFT_CONTROLLER,
RIGHT_CONTROLLER,
};
enum enabled_status_index {
FEATURE_UNKNOWN,
FEATURE_ENABLED,
FEATURE_DISABLED,
};
static const char *const enabled_status_text[] = {
[FEATURE_UNKNOWN] = "unknown",
[FEATURE_ENABLED] = "true",
[FEATURE_DISABLED] = "false",
};
enum version_data_index {
PRODUCT_VERSION = 0x02,
PROTOCOL_VERSION,
FIRMWARE_VERSION,
HARDWARE_VERSION,
HARDWARE_GENERATION,
};
enum feature_status_index {
FEATURE_RESET_GAMEPAD = 0x02,
FEATURE_IMU_BYPASS,
FEATURE_IMU_ENABLE = 0x05,
FEATURE_TOUCHPAD_ENABLE = 0x07,
FEATURE_LIGHT_ENABLE,
FEATURE_AUTO_SLEEP_TIME,
FEATURE_FPS_SWITCH_STATUS = 0x0b,
FEATURE_GAMEPAD_MODE = 0x0e,
};
#define FEATURE_OS_MODE 0x69
enum fps_switch_status_index {
FPS_STATUS_UNKNOWN,
GAMEPAD,
FPS,
};
static const char *const fps_switch_text[] = {
[FPS_STATUS_UNKNOWN] = "unknown",
[GAMEPAD] = "gamepad",
[FPS] = "fps",
};
enum gamepad_mode_index {
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/cleanup.h`, `linux/completion.h`, `linux/delay.h`, `linux/dev_printk.h`, `linux/device.h`, `linux/device/devres.h`, `linux/hid.h`.
- Detected declarations: `struct go_cfg_attr`, `struct command_report`, `enum command_id`, `enum mcu_command_index`, `enum dev_type`, `enum enabled_status_index`, `enum version_data_index`, `enum feature_status_index`, `enum fps_switch_status_index`, `enum gamepad_mode_index`.
- 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.