wut  v1.7.0
Wii U Toolchain
hid.h
Go to the documentation of this file.
1 #pragma once
2 #include <wut.h>
3 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 typedef struct HIDClient HIDClient;
14 typedef struct HIDDevice HIDDevice;
15 
16 typedef enum HIDAttachEvent
17 {
21 
22 typedef int32_t
23 (*HIDAttachCallback)(HIDClient *client,
24  HIDDevice *device,
25  HIDAttachEvent attach);
26 
27 typedef void
28 (*HIDCallback)(uint32_t handle,
29  int32_t error,
30  uint8_t *buffer,
31  uint32_t bytesTransferred,
32  void *userContext);
33 
34 struct HIDDevice
35 {
36  uint32_t handle;
38  uint16_t vid;
39  uint16_t pid;
40  uint8_t interfaceIndex;
41  uint8_t subClass;
42  uint8_t protocol;
43  WUT_PADDING_BYTES(1);
44  uint16_t maxPacketSizeRx;
45  uint16_t maxPacketSizeTx;
46 };
47 WUT_CHECK_OFFSET(HIDDevice, 0x00, handle);
48 WUT_CHECK_OFFSET(HIDDevice, 0x04, physicalDeviceInst);
49 WUT_CHECK_OFFSET(HIDDevice, 0x08, vid);
50 WUT_CHECK_OFFSET(HIDDevice, 0x0A, pid);
51 WUT_CHECK_OFFSET(HIDDevice, 0x0C, interfaceIndex);
52 WUT_CHECK_OFFSET(HIDDevice, 0x0D, subClass);
53 WUT_CHECK_OFFSET(HIDDevice, 0x0E, protocol);
54 WUT_CHECK_OFFSET(HIDDevice, 0x10, maxPacketSizeRx);
55 WUT_CHECK_OFFSET(HIDDevice, 0x12, maxPacketSizeTx);
56 WUT_CHECK_SIZE(HIDDevice, 0x14);
57 
58 struct HIDClient
59 {
62 };
63 WUT_CHECK_OFFSET(HIDClient, 0x00, next);
64 WUT_CHECK_OFFSET(HIDClient, 0x04, attachCallback);
65 WUT_CHECK_SIZE(HIDClient, 0x08);
66 
67 
68 int32_t
70 
71 int32_t
73 
74 int32_t
76  HIDAttachCallback attachCallback);
77 
78 int32_t
80 
81 int32_t
82 HIDGetDescriptor(uint32_t handle,
83  uint8_t descriptorType,
84  uint8_t descriptorIndex,
85  uint16_t languageId,
86  uint8_t *buffer,
87  uint32_t bufferLength,
88  HIDCallback callback,
89  void *userContext);
90 
91 int32_t
92 HIDSetDescriptor(uint32_t handle,
93  uint8_t descriptorType,
94  uint8_t descriptorIndex,
95  uint16_t languageId,
96  uint8_t *buffer,
97  uint32_t bufferLength,
98  HIDCallback callback,
99  void *userContext);
100 
101 int32_t
102 HIDGetReport(uint32_t handle,
103  uint8_t reportType,
104  uint8_t reportId,
105  uint8_t *buffer,
106  uint32_t bufferLength,
107  HIDCallback callback,
108  void *userContext);
109 
110 int32_t
111 HIDSetReport(uint32_t handle,
112  uint8_t reportType,
113  uint8_t reportId,
114  uint8_t *buffer,
115  uint32_t bufferLength,
116  HIDCallback callback,
117  void *userContext);
118 
119 int32_t
120 HIDGetIdle(uint32_t handle,
121  uint8_t interfaceIndex,
122  uint8_t reportId,
123  uint8_t* duration,
124  HIDCallback callback,
125  void *userContext);
126 
127 int32_t
128 HIDSetIdle(uint32_t handle,
129  uint8_t interfaceIndex,
130  uint8_t reportId,
131  uint8_t duration,
132  HIDCallback callback,
133  void *userContext);
134 
135 int32_t
136 HIDSetProtocol(uint32_t handle,
137  uint8_t interfaceIndex,
138  uint8_t protocol,
139  HIDCallback callback,
140  void *userContext);
141 
142 int32_t
143 HIDGetProtocol(uint32_t handle,
144  uint8_t interfaceIndex,
145  uint8_t *protocol,
146  HIDCallback callback,
147  void *userContext);
148 
149 int32_t
150 HIDRead(uint32_t handle,
151  uint8_t *buffer,
152  uint32_t bufferLength,
153  HIDCallback callback,
154  void *userContext);
155 
156 int32_t
157 HIDWrite(uint32_t handle,
158  uint8_t *buffer,
159  uint32_t bufferLength,
160  HIDCallback hc,
161  void *userContext);
162 
163 #ifdef __cplusplus
164 }
165 #endif
166 
uint8_t subClass
Definition: hid.h:41
HIDAttachCallback attachCallback
Definition: hid.h:61
uint16_t maxPacketSizeRx
Definition: hid.h:43
HIDClient * next
Definition: hid.h:60
uint8_t interfaceIndex
Definition: hid.h:40
uint16_t maxPacketSizeTx
Definition: hid.h:45
uint16_t pid
Definition: hid.h:39
uint32_t handle
Definition: hid.h:36
uint16_t vid
Definition: hid.h:38
uint8_t protocol
Definition: hid.h:42
uint32_t physicalDeviceInst
Definition: hid.h:37
HIDAttachEvent
Definition: hid.h:17
int32_t HIDGetDescriptor(uint32_t handle, uint8_t descriptorType, uint8_t descriptorIndex, uint16_t languageId, uint8_t *buffer, uint32_t bufferLength, HIDCallback callback, void *userContext)
int32_t(* HIDAttachCallback)(HIDClient *client, HIDDevice *device, HIDAttachEvent attach)
Definition: hid.h:23
int32_t HIDSetReport(uint32_t handle, uint8_t reportType, uint8_t reportId, uint8_t *buffer, uint32_t bufferLength, HIDCallback callback, void *userContext)
int32_t HIDAddClient(HIDClient *client, HIDAttachCallback attachCallback)
void(* HIDCallback)(uint32_t handle, int32_t error, uint8_t *buffer, uint32_t bytesTransferred, void *userContext)
Definition: hid.h:28
int32_t HIDTeardown()
int32_t HIDGetIdle(uint32_t handle, uint8_t interfaceIndex, uint8_t reportId, uint8_t *duration, HIDCallback callback, void *userContext)
int32_t HIDGetReport(uint32_t handle, uint8_t reportType, uint8_t reportId, uint8_t *buffer, uint32_t bufferLength, HIDCallback callback, void *userContext)
int32_t HIDWrite(uint32_t handle, uint8_t *buffer, uint32_t bufferLength, HIDCallback hc, void *userContext)
int32_t HIDDelClient(HIDClient *client)
int32_t HIDRead(uint32_t handle, uint8_t *buffer, uint32_t bufferLength, HIDCallback callback, void *userContext)
int32_t HIDSetup()
int32_t HIDSetIdle(uint32_t handle, uint8_t interfaceIndex, uint8_t reportId, uint8_t duration, HIDCallback callback, void *userContext)
int32_t HIDGetProtocol(uint32_t handle, uint8_t interfaceIndex, uint8_t *protocol, HIDCallback callback, void *userContext)
int32_t HIDSetDescriptor(uint32_t handle, uint8_t descriptorType, uint8_t descriptorIndex, uint16_t languageId, uint8_t *buffer, uint32_t bufferLength, HIDCallback callback, void *userContext)
int32_t HIDSetProtocol(uint32_t handle, uint8_t interfaceIndex, uint8_t protocol, HIDCallback callback, void *userContext)
@ HID_DEVICE_DETACH
Definition: hid.h:18
@ HID_DEVICE_ATTACH
Definition: hid.h:19
Definition: hid.h:59
Definition: hid.h:35