5 /* Grabbed from libusb (www.libusb.org) */
7 enum libusb_class_code
{
8 LIBUSB_CLASS_PER_INTERFACE
= 0,
9 LIBUSB_CLASS_AUDIO
= 1,
10 LIBUSB_CLASS_COMM
= 2,
12 LIBUSB_CLASS_PHYSICAL
= 5,
13 LIBUSB_CLASS_PRINTER
= 7,
15 LIBUSB_CLASS_IMAGE
= 6,
16 LIBUSB_CLASS_MASS_STORAGE
= 8,
18 LIBUSB_CLASS_DATA
= 10,
19 LIBUSB_CLASS_SMART_CARD
= 0x0b,
20 LIBUSB_CLASS_CONTENT_SECURITY
= 0x0d,
21 LIBUSB_CLASS_VIDEO
= 0x0e,
22 LIBUSB_CLASS_PERSONAL_HEALTHCARE
= 0x0f,
23 LIBUSB_CLASS_DIAGNOSTIC_DEVICE
= 0xdc,
24 LIBUSB_CLASS_WIRELESS
= 0xe0,
25 LIBUSB_CLASS_APPLICATION
= 0xfe,
26 LIBUSB_CLASS_VENDOR_SPEC
= 0xff
29 enum libusb_descriptor_type
{
30 LIBUSB_DT_DEVICE
= 0x01,
31 LIBUSB_DT_CONFIG
= 0x02,
32 LIBUSB_DT_STRING
= 0x03,
33 LIBUSB_DT_INTERFACE
= 0x04,
34 LIBUSB_DT_ENDPOINT
= 0x05,
36 LIBUSB_DT_DEVICE_CAPABILITY
= 0x10,
38 LIBUSB_DT_REPORT
= 0x22,
39 LIBUSB_DT_PHYSICAL
= 0x23,
41 LIBUSB_DT_SUPERSPEED_HUB
= 0x2a,
42 LIBUSB_DT_SS_ENDPOINT_COMPANION
= 0x30
45 #define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f
46 #define LIBUSB_ENDPOINT_DIR_MASK 0x80
48 enum libusb_endpoint_direction
{
49 LIBUSB_ENDPOINT_IN
= 0x80,
50 LIBUSB_ENDPOINT_OUT
= 0x00
53 #define LIBUSB_TRANSFER_TYPE_MASK 0x03
55 enum libusb_transfer_type
{
56 LIBUSB_TRANSFER_TYPE_CONTROL
= 0,
57 LIBUSB_TRANSFER_TYPE_ISOCHRONOUS
= 1,
58 LIBUSB_TRANSFER_TYPE_BULK
= 2,
59 LIBUSB_TRANSFER_TYPE_INTERRUPT
= 3,
60 LIBUSB_TRANSFER_TYPE_BULK_STREAM
= 4,
63 enum libusb_standard_request
{
64 LIBUSB_REQUEST_GET_STATUS
= 0x00,
65 LIBUSB_REQUEST_CLEAR_FEATURE
= 0x01,
66 LIBUSB_REQUEST_SET_FEATURE
= 0x03,
67 LIBUSB_REQUEST_SET_ADDRESS
= 0x05,
68 LIBUSB_REQUEST_GET_DESCRIPTOR
= 0x06,
69 LIBUSB_REQUEST_SET_DESCRIPTOR
= 0x07,
70 LIBUSB_REQUEST_GET_CONFIGURATION
= 0x08,
71 LIBUSB_REQUEST_SET_CONFIGURATION
= 0x09,
72 LIBUSB_REQUEST_GET_INTERFACE
= 0x0A,
73 LIBUSB_REQUEST_SET_INTERFACE
= 0x0B,
74 LIBUSB_REQUEST_SYNCH_FRAME
= 0x0C,
75 LIBUSB_REQUEST_SET_SEL
= 0x30,
76 LIBUSB_SET_ISOCH_DELAY
= 0x31,
79 enum libusb_request_type
{
80 LIBUSB_REQUEST_TYPE_STANDARD
= (0x00 << 5),
81 LIBUSB_REQUEST_TYPE_CLASS
= (0x01 << 5),
82 LIBUSB_REQUEST_TYPE_VENDOR
= (0x02 << 5),
83 LIBUSB_REQUEST_TYPE_RESERVED
= (0x03 << 5)
86 enum libusb_request_recipient
{
87 LIBUSB_RECIPIENT_DEVICE
= 0x00,
88 LIBUSB_RECIPIENT_INTERFACE
= 0x01,
89 LIBUSB_RECIPIENT_ENDPOINT
= 0x02,
90 LIBUSB_RECIPIENT_OTHER
= 0x03,
96 LIBUSB_ERROR_INVALID_PARAM
= -2,
97 LIBUSB_ERROR_ACCESS
= -3,
98 LIBUSB_ERROR_NO_DEVICE
= -4,
99 LIBUSB_ERROR_NOT_FOUND
= -5,
100 LIBUSB_ERROR_BUSY
= -6,
101 LIBUSB_ERROR_TIMEOUT
= -7,
102 LIBUSB_ERROR_OVERFLOW
= -8,
103 LIBUSB_ERROR_PIPE
= -9,
104 LIBUSB_ERROR_INTERRUPTED
= -10,
105 LIBUSB_ERROR_NO_MEM
= -11,
106 LIBUSB_ERROR_NOT_SUPPORTED
= -12,
107 LIBUSB_ERROR_OTHER
= -99,
110 #define LIBUSB_ERROR_COUNT 14
112 typedef struct libusb_device_descriptor
{
114 uint8_t bDescriptorType
;
116 uint8_t bDeviceClass
;
117 uint8_t bDeviceSubClass
;
118 uint8_t bDeviceProtocol
;
119 uint8_t bMaxPacketSize0
;
123 uint8_t iManufacturer
;
125 uint8_t iSerialNumber
;
126 uint8_t bNumConfigurations
;
127 } libusb_device_descriptor
;
129 struct libusb_endpoint_descriptor
{
131 uint8_t bDescriptorType
;
132 uint8_t bEndpointAddress
;
133 uint8_t bmAttributes
;
134 uint16_t wMaxPacketSize
;
137 uint8_t bSynchAddress
;
138 const unsigned char *extra
;
142 struct libusb_interface_descriptor
{
144 uint8_t bDescriptorType
;
145 uint8_t bInterfaceNumber
;
146 uint8_t bAlternateSetting
;
147 uint8_t bNumEndpoints
;
148 uint8_t bInterfaceClass
;
149 uint8_t bInterfaceSubClass
;
150 uint8_t bInterfaceProtocol
;
152 const struct libusb_endpoint_descriptor
*endpoint
;
153 const unsigned char *extra
;
157 struct libusb_interface
{
158 const struct libusb_interface_descriptor
*altsetting
;
162 struct libusb_config_descriptor
{
164 uint8_t bDescriptorType
;
165 uint16_t wTotalLength
;
166 uint8_t bNumInterfaces
;
167 uint8_t bConfigurationValue
;
168 uint8_t iConfiguration
;
169 uint8_t bmAttributes
;
171 const struct libusb_interface
*interface
;
172 const unsigned char *extra
;
176 typedef struct libusb_device libusb_device
;
177 typedef struct libusb_device_handle libusb_device_handle
;
179 extern int (*sceUsbdInit
)(void);
180 extern void (*sceUsbdExit
)(void);
182 extern ssize_t (*sceUsbdGetDeviceList
)(libusb_device
***list
);
183 extern void (*sceUsbdFreeDeviceList
)(libusb_device
**list
, int unrefDevices
);
185 extern int (*sceUsbdGetDeviceDescriptor
)(libusb_device
*device
, libusb_device_descriptor
*desc
);
187 extern int (*sceUsbdOpen
)(libusb_device
*dev
, libusb_device_handle
**devh
);
188 extern libusb_device_handle
*(*sceUsbdOpenDeviceWithVidPid
)(unsigned short vendorId
, unsigned short productId
);
189 extern void (*sceUsbdClose
)(libusb_device_handle
*devh
);
191 extern int (*sceUsbdSetInterfaceAltSetting
)(libusb_device_handle
*dev
, int interface_number
, int alternate_setting
);
192 extern int (*sceUsbdClearHalt
)(libusb_device_handle
*devh
, unsigned char endpoint
);
193 extern int (*sceUsbdResetDevice
)(libusb_device_handle
*devh
);
194 extern int (*sceUsbdCheckConnected
)(libusb_device_handle
*devh
);
196 extern int (*sceUsbdControlTransfer
)(libusb_device_handle
*devh
, uint8_t bmRequestType
, uint8_t bRequest
, uint16_t wValue
, uint16_t wIndex
, unsigned char *data
, uint16_t wLength
, unsigned int timeout
);
197 extern int (*sceUsbdBulkTransfer
)(struct libusb_device_handle
*devh
, unsigned char endpoint
, unsigned char *data
, int length
, int *transferred
, unsigned int timeout
);
198 extern int (*sceUsbdInterruptTransfer
)(struct libusb_device_handle
*devh
, unsigned char endpoint
, unsigned char *data
, int length
, int *transferred
, unsigned int timeout
);
200 extern int (*sceUsbdGetActiveConfigDescriptor
)(libusb_device
*dev
, struct libusb_config_descriptor
**config
);
201 extern int (*sceUsbdGetConfigDescriptor
)(libusb_device
*dev
, uint8_t config_index
, struct libusb_config_descriptor
**config
);
202 extern int (*sceUsbdGetConfigDescriptorByValue
)(libusb_device
*dev
, uint8_t bConfigurationValue
, struct libusb_config_descriptor
**config
);
203 extern void (*sceUsbdFreeConfigDescriptor
)(struct libusb_config_descriptor
*config
);