drivers/hid/hid-wiimote.h

Source file repositories/reference/linux-study-clean/drivers/hid/hid-wiimote.h

File Facts

System
Linux kernel
Corpus path
drivers/hid/hid-wiimote.h
Extension
.h
Size
9443 bytes
Lines
379
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 wiimote_buf {
	__u8 data[HID_MAX_BUFFER_SIZE];
	size_t size;
};

struct wiimote_queue {
	spinlock_t lock;
	struct work_struct worker;
	__u8 head;
	__u8 tail;
	struct wiimote_buf outq[WIIMOTE_BUFSIZE];
};

struct wiimote_state {
	spinlock_t lock;
	__u32 flags;
	__u8 accel_split[2];
	__u8 drm;
	__u8 devtype;
	__u8 exttype;
	__u8 mp;

	/* synchronous cmd requests */
	struct mutex sync;
	struct completion ready;
	int cmd;
	__u32 opt;

	/* results of synchronous requests */
	__u8 cmd_battery;
	__u8 cmd_err;
	__u8 *cmd_read_buf;
	__u8 cmd_read_size;

	/* calibration/cache data */
	__u16 calib_bboard[4][3];
	__s16 calib_pro_sticks[4];
	__u8 pressure_drums[7];
	__u8 cache_rumble;
};

struct wiimote_data {
	struct hid_device *hdev;
	struct input_dev *input;
	struct work_struct rumble_worker;
	struct led_classdev *leds[4];
	struct input_dev *accel;
	struct input_dev *ir;
	struct power_supply *battery;
	struct power_supply_desc battery_desc;
	struct input_dev *mp;
	struct timer_list timer;
	struct wiimote_debug *debug;

	union {
		struct input_dev *input;
	} extension;

	struct wiimote_queue queue;
	struct wiimote_state state;
	struct work_struct init_worker;
};

extern bool wiimote_dpad_as_analog;

/* wiimote modules */

enum wiimod_module {
	WIIMOD_KEYS,
	WIIMOD_RUMBLE,
	WIIMOD_BATTERY,
	WIIMOD_LED1,
	WIIMOD_LED2,
	WIIMOD_LED3,
	WIIMOD_LED4,
	WIIMOD_ACCEL,
	WIIMOD_IR,
	WIIMOD_BUILTIN_MP,
	WIIMOD_NO_MP,
	WIIMOD_NUM,
	WIIMOD_NULL = WIIMOD_NUM,
};

#define WIIMOD_FLAG_INPUT		0x0001
#define WIIMOD_FLAG_EXT8		0x0002
#define WIIMOD_FLAG_EXT16		0x0004

struct wiimod_ops {
	__u16 flags;
	unsigned long arg;

Annotation

Implementation Notes