mirror of
https://github.com/wiiu-env/wut.git
synced 2025-01-08 11:40:42 +01:00
Reformat hid.h
This commit is contained in:
parent
55edba512f
commit
71c6521a38
@ -5,118 +5,146 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct HIDClient HIDClient;
|
||||||
|
typedef struct HIDDevice HIDDevice;
|
||||||
|
|
||||||
|
typedef enum HIDAttachEvent
|
||||||
{
|
{
|
||||||
uint32_t handle;
|
HID_DEVICE_ATTACH = 0,
|
||||||
uint32_t physical_device_inst;
|
HID_DEVICE_DETACH = 1,
|
||||||
uint16_t vid;
|
} HIDAttachEvent;
|
||||||
uint16_t pid;
|
|
||||||
uint8_t interface_index;
|
|
||||||
uint8_t sub_class;
|
|
||||||
uint8_t protocol;
|
|
||||||
|
|
||||||
uint16_t max_packet_size_rx;
|
typedef int32_t
|
||||||
uint16_t max_packet_size_tx;
|
(*HIDAttachCallback)(HIDClient *client,
|
||||||
} HIDDevice;
|
HIDDevice *device,
|
||||||
|
HIDAttachEvent attach);
|
||||||
|
|
||||||
#define HID_DEVICE_DETACH 0
|
typedef void
|
||||||
#define HID_DEVICE_ATTACH 1
|
(*HIDCallback)(uint32_t handle,
|
||||||
|
int32_t error,
|
||||||
|
uint8_t *buffer,
|
||||||
|
uint32_t bytesTransferred,
|
||||||
|
void *userContext);
|
||||||
|
|
||||||
typedef struct _HIDClient HIDClient;
|
struct HIDDevice
|
||||||
|
|
||||||
typedef int32_t (*HIDAttachCallback)(HIDClient *p_hc,HIDDevice *p_hd,uint32_t attach);
|
|
||||||
|
|
||||||
struct _HIDClient
|
|
||||||
{
|
{
|
||||||
HIDClient *next;
|
uint32_t handle;
|
||||||
HIDAttachCallback attach_cb;
|
uint32_t physicalDeviceInst;
|
||||||
|
uint16_t vid;
|
||||||
|
uint16_t pid;
|
||||||
|
uint8_t interfaceIndex;
|
||||||
|
uint8_t subClass;
|
||||||
|
uint8_t protocol;
|
||||||
|
PADDING(1);
|
||||||
|
uint16_t maxPacketSizeRx;
|
||||||
|
uint16_t maxPacketSizeTx;
|
||||||
};
|
};
|
||||||
|
CHECK_OFFSET(HIDDevice, 0x00, handle);
|
||||||
|
CHECK_OFFSET(HIDDevice, 0x04, physicalDeviceInst);
|
||||||
|
CHECK_OFFSET(HIDDevice, 0x08, vid);
|
||||||
|
CHECK_OFFSET(HIDDevice, 0x0A, pid);
|
||||||
|
CHECK_OFFSET(HIDDevice, 0x0C, interfaceIndex);
|
||||||
|
CHECK_OFFSET(HIDDevice, 0x0D, subClass);
|
||||||
|
CHECK_OFFSET(HIDDevice, 0x0E, protocol);
|
||||||
|
CHECK_OFFSET(HIDDevice, 0x10, maxPacketSizeRx);
|
||||||
|
CHECK_OFFSET(HIDDevice, 0x12, maxPacketSizeTx);
|
||||||
|
CHECK_SIZE(HIDDevice, 0x14);
|
||||||
|
|
||||||
|
struct HIDClient
|
||||||
|
{
|
||||||
|
HIDClient *next;
|
||||||
|
HIDAttachCallback attachCallback;
|
||||||
|
};
|
||||||
|
CHECK_OFFSET(HIDClient, 0x00, next);
|
||||||
|
CHECK_OFFSET(HIDClient, 0x04, attachCallback);
|
||||||
|
CHECK_SIZE(HIDClient, 0x08);
|
||||||
|
|
||||||
typedef void HIDCallback(uint32_t handle,int32_t error,uint8_t *p_buffer,uint32_t bytes_transferred,void *p_user);
|
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDSetup(void);
|
HIDSetup();
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDTeardown(void);
|
HIDTeardown();
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDAddClient(HIDClient *p_client, HIDAttachCallback attach_callback);
|
HIDAddClient(HIDClient *client,
|
||||||
|
HIDAttachCallback attachCallback);
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDDelClient(HIDClient *p_client);
|
HIDDelClient(HIDClient *client);
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDGetDescriptor(uint32_t handle,
|
HIDGetDescriptor(uint32_t handle,
|
||||||
uint8_t descriptor_type,
|
uint8_t descriptorType,
|
||||||
uint8_t descriptor_index,
|
uint8_t descriptorIndex,
|
||||||
uint16_t language_id,
|
uint16_t languageId,
|
||||||
uint8_t *p_buffer,
|
uint8_t *buffer,
|
||||||
uint32_t buffer_length,
|
uint32_t bufferLength,
|
||||||
HIDCallback hc, void *p_user);
|
HIDCallback callback,
|
||||||
|
void *userContext);
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDSetDescriptor(uint32_t handle,
|
HIDSetDescriptor(uint32_t handle,
|
||||||
uint8_t descriptor_type,
|
uint8_t descriptorType,
|
||||||
uint8_t descriptor_index,
|
uint8_t descriptorIndex,
|
||||||
uint16_t language_id,
|
uint16_t languageId,
|
||||||
uint8_t *p_buffer,
|
uint8_t *buffer,
|
||||||
uint32_t buffer_length,
|
uint32_t bufferLength,
|
||||||
HIDCallback hc,
|
HIDCallback callback,
|
||||||
void *p_user);
|
void *userContext);
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDGetReport(uint32_t handle,
|
HIDGetReport(uint32_t handle,
|
||||||
uint8_t report_type,
|
uint8_t reportType,
|
||||||
uint8_t report_id,
|
uint8_t reportId,
|
||||||
uint8_t *p_buffer,
|
uint8_t *buffer,
|
||||||
uint32_t buffer_length,
|
uint32_t bufferLength,
|
||||||
HIDCallback hc,
|
HIDCallback callback,
|
||||||
void *p_user);
|
void *userContext);
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDSetReport(uint32_t handle,
|
HIDSetReport(uint32_t handle,
|
||||||
uint8_t report_type,
|
uint8_t reportType,
|
||||||
uint8_t report_id,
|
uint8_t reportId,
|
||||||
uint8_t *p_buffer,
|
uint8_t *buffer,
|
||||||
uint32_t buffer_length,
|
uint32_t bufferLength,
|
||||||
HIDCallback hc,
|
HIDCallback callback,
|
||||||
void *p_user);
|
void *userContext);
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDSetIdle(uint32_t handle,
|
HIDSetIdle(uint32_t handle,
|
||||||
uint8_t interface_index,
|
uint8_t interfaceIndex,
|
||||||
uint8_t duration,
|
uint8_t duration,
|
||||||
HIDCallback hc,
|
HIDCallback callback,
|
||||||
void *p_user);
|
void *userContext);
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDSetProtocol(uint32_t handle,
|
HIDSetProtocol(uint32_t handle,
|
||||||
uint8_t interface_index,
|
uint8_t interfaceIndex,
|
||||||
uint8_t protocol,
|
uint8_t protocol,
|
||||||
HIDCallback hc,
|
HIDCallback callback,
|
||||||
void *p_user);
|
void *userContext);
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDGetProtocol(uint32_t handle,
|
HIDGetProtocol(uint32_t handle,
|
||||||
uint8_t interface_index,
|
uint8_t interfaceIndex,
|
||||||
uint8_t * protocol,
|
uint8_t *protocol,
|
||||||
HIDCallback hc,
|
HIDCallback callback,
|
||||||
void *p_user);
|
void *userContext);
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDRead(uint32_t handle,
|
HIDRead(uint32_t handle,
|
||||||
uint8_t *p_buffer,
|
uint8_t *buffer,
|
||||||
uint32_t buffer_length,
|
uint32_t bufferLength,
|
||||||
HIDCallback hc,
|
HIDCallback callback,
|
||||||
void *p_user);
|
void *userContext);
|
||||||
|
|
||||||
int32_t
|
int32_t
|
||||||
HIDWrite(uint32_t handle,
|
HIDWrite(uint32_t handle,
|
||||||
uint8_t *p_buffer,
|
uint8_t *buffer,
|
||||||
uint32_t buffer_length,
|
uint32_t bufferLength,
|
||||||
HIDCallback hc,
|
HIDCallback hc,
|
||||||
void *p_user);
|
void *userContext);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user