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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/completion.hlinux/device.hlinux/hid.hlinux/input.hlinux/leds.hlinux/module.hlinux/mutex.hlinux/power_supply.hlinux/spinlock.hlinux/timer.h
Detected Declarations
struct wiimote_bufstruct wiimote_queuestruct wiimote_statestruct wiimote_datastruct wiimod_opsenum wiiproto_keysenum wiimote_devtypeenum wiimote_exttypeenum wiimote_mptypeenum wiimod_moduleenum wiiproto_reqsfunction wiidebug_initfunction wiidebug_deinitfunction wiimote_cmd_completefunction wiimote_cmd_abortfunction wiimote_cmd_acquirefunction wiimote_cmd_acquire_nointfunction wiimote_cmd_setfunction wiimote_cmd_releasefunction wiimote_cmd_waitfunction wiimote_cmd_wait_noint
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
- Immediate include surface: `linux/completion.h`, `linux/device.h`, `linux/hid.h`, `linux/input.h`, `linux/leds.h`, `linux/module.h`, `linux/mutex.h`, `linux/power_supply.h`.
- Detected declarations: `struct wiimote_buf`, `struct wiimote_queue`, `struct wiimote_state`, `struct wiimote_data`, `struct wiimod_ops`, `enum wiiproto_keys`, `enum wiimote_devtype`, `enum wiimote_exttype`, `enum wiimote_mptype`, `enum wiimod_module`.
- 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.