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.

Dependency Surface

Detected Declarations

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

Implementation Notes