1 #pragma once 2 #include <wiiu/types.h> 3 4 typedef struct 5 { 6 uint32_t handle; 7 uint32_t physical_device_inst; 8 uint16_t vid; 9 uint16_t pid; 10 uint8_t interface_index; 11 uint8_t sub_class; 12 uint8_t protocol; 13 14 uint16_t max_packet_size_rx; 15 uint16_t max_packet_size_tx; 16 17 } HIDDevice; 18 19 typedef struct _HIDClient HIDClient; 20 21 #define HID_DEVICE_DETACH 0 22 #define HID_DEVICE_ATTACH 1 23 24 typedef int32_t (*HIDAttachCallback)(HIDClient *p_hc,HIDDevice *p_hd,uint32_t attach); 25 26 struct _HIDClient 27 { 28 HIDClient *next; 29 HIDAttachCallback attach_cb; 30 }; 31 32 typedef void (*HIDCallback)(uint32_t handle,int32_t error,uint8_t *p_buffer,uint32_t bytes_transferred,void *p_user); 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 int32_t 39 HIDSetup(void); 40 41 int32_t 42 HIDTeardown(void); 43 44 int32_t 45 HIDAddClient(HIDClient *p_client, 46 HIDAttachCallback attach_callback); 47 int32_t 48 HIDDelClient(HIDClient *p_client); 49 50 int32_t 51 HIDGetDescriptor(uint32_t handle, 52 uint8_t descriptor_type, 53 uint8_t descriptor_index, 54 uint16_t language_id, 55 uint8_t *p_buffer, 56 uint32_t buffer_length, 57 HIDCallback hc, 58 void *p_user); 59 60 int32_t 61 HIDSetDescriptor(uint32_t handle, 62 uint8_t descriptor_type, 63 uint8_t descriptor_index, 64 uint16_t language_id, 65 uint8_t *p_buffer, 66 uint32_t buffer_length, 67 HIDCallback hc, 68 void *p_user); 69 70 int32_t 71 HIDGetReport(uint32_t handle, 72 uint8_t report_type, 73 uint8_t report_id, 74 uint8_t *p_buffer, 75 uint32_t buffer_length, 76 HIDCallback hc, 77 void *p_user); 78 79 int32_t 80 HIDSetReport(uint32_t handle, 81 uint8_t report_type, 82 uint8_t report_id, 83 uint8_t *p_buffer, 84 uint32_t buffer_length, 85 HIDCallback hc, 86 void *p_user); 87 88 int32_t 89 HIDSetIdle(uint32_t handle, 90 uint8_t interface_index, 91 uint8_t duration, 92 HIDCallback hc, 93 void *p_user); 94 95 int32_t 96 HIDSetProtocol(uint32_t handle, 97 uint8_t interface_index, 98 uint8_t protocol, 99 HIDCallback hc, 100 void *p_user); 101 102 int32_t 103 HIDGetProtocol(uint32_t handle, 104 uint8_t interface_index, 105 uint8_t * protocol, 106 HIDCallback hc, 107 void *p_user); 108 109 int32_t 110 HIDRead(uint32_t handle, 111 uint8_t *p_buffer, 112 uint32_t buffer_length, 113 HIDCallback hc, 114 void *p_user); 115 116 int32_t 117 HIDWrite(uint32_t handle, 118 uint8_t *p_buffer, 119 uint32_t buffer_length, 120 HIDCallback hc, 121 void *p_user); 122 123 #ifdef __cplusplus 124 } 125 #endif 126