1 [CCode (cprefix = "usb_", cheader_filename = "usb.h")]
3 [CCode (cprefix = "USB_CLASS_", cheader_filename = "usb.h")]
17 [CCode (cprefix = "USB_DT_", cheader_filename = "usb.h")]
18 public enum DescriptorType {
30 [CCode (cprefix = "USB_DT_", cheader_filename = "usb.h")]
31 public enum DescriptorSize {
32 [CCode (cname = "USB_DT_DEVICE_SIZE")]
34 [CCode (cname = "USB_DT_CONFIG_SIZE")]
36 [CCode (cname = "USB_DT_INTERFACE_SIZE")]
38 [CCode (cname = "USB_DT_ENDPOINT_SIZE")]
40 [CCode (cname = "USB_DT_ENDPOINT_AUDIO_SIZE")]
42 [CCode (cname = "USB_DT_HUB_NONVAR_SIZE")]
46 [CCode (cprefix = "USB_ENDPOINT_", cheader_filename = "usb.h")]
47 public enum EndpointAttribute {
58 [CCode (cprefix = "USB_ENDPOINT_", cheader_filename = "usb.h")]
59 public enum EndpointAddress {
66 [CCode (cprefix = "USB_REQ_", cheader_filename = "usb.h")]
81 [CCode (cprefix = "USB_TYPE_", cheader_filename = "usb.h")]
89 [CCode (cname = "struct usb_endpoint_descriptor", cheader_filename = "usb.h")]
90 public struct EndpointDescriptor {
92 public uint8 bDescriptorType;
93 public uint8 bEndpointAddress;
94 public uint8 bmAttributes;
95 public uint16 wMaxPacketSize;
96 public uint8 bInterval;
97 public uint8 bRefresh;
98 public uint8 bSynchAddress;
100 public uchar[] extra;
104 [CCode (cname = "struct usb_interface_descriptor", cheader_filename = "usb.h")]
105 public struct InterfaceDescriptor {
106 public uint8 bLength;
107 public uint8 bDescriptorType;
108 public uint8 bInterfaceNumber;
109 public uint8 bAlternateSetting;
110 public uint8 bNumEndpoints;
111 public uint8 bInterfaceClass;
112 public uint8 bInterfaceSubClass;
113 public uint8 bInterfaceProtocol;
114 public uint8 iInterface;
116 public EndpointDescriptor[] endpoint;
118 public uchar[] extra;
122 [CCode (cname = "struct usb_interface", cheader_filename = "usb.h")]
123 public struct Interface {
124 public InterfaceDescriptor[] altsetting;
125 public int num_altsetting;
128 [CCode (cname = "struct usd_config_descriptor")]
129 public struct ConfigDescriptor {
130 public uint8 bLength;
131 public uint8 bDescriptorType;
132 public uint16 wTotalLength;
133 public uint8 bNumInterfaces;
134 public uint8 bConfigurationValue;
135 public uint8 iConfiguration;
136 public uint8 bmAttributes;
137 public uint8 MaxPower;
140 public Interface[] @interface;
142 public uchar[] extra;
146 [CCode (cname = "struct usb_device_descriptor", cheader_filename = "usb.h")]
147 public struct DeviceDescriptor {
148 public uint8 bLength;
149 public uint8 bDescriptorType;
150 public uint16 bcdUSB;
151 public uint8 bDeviceClass;
152 public uint8 bDeviceSubClass;
153 public uint8 bDeviceProtocol;
154 public uint8 bMaxPacketSize0;
155 public uint16 idVendor;
156 public uint16 idProduct;
157 public uint16 bcdDevice;
158 public uint8 iManufacturer;
159 public uint8 iProduct;
160 public uint8 iSerialNumber;
161 public uint8 bNumConfigurations;
164 [CCode (cname = "struct usb_device", cprefix = "usb_", cheader_filename = "usb.h")]
165 public struct Device {
166 public Device * next;
167 public Device * prev;
168 public string filename;
170 public DeviceDescriptor descriptor;
172 public ConfigDescriptor[] config;
175 public uchar num_children;
176 public Device ** children;
179 [CCode (cname = "struct usb_bus", cheader_filename = "usb.h")]
183 public string dirname;
184 public Device * devices;
185 public uint32 location;
186 public Device * root_dev;
190 [CCode (cname = "usb_dev_handle", cprefix = "usb_", cheader_filename = "usb.h", free_function = "usb_close")]
191 public class DeviceHandle {
192 [CCode (cname = "usb_open")]
193 public DeviceHandle (Device * dev);
195 public int get_string (int index, int langid, char[] buf, size_t buflen);
197 public int get_string_simple (int index, char[] buf, size_t buflen);
199 public int get_descriptor_by_endpoint (int ep, uchar type, uchar index, void * buf, int size);
200 public int get_descriptor (uchar type, uchar index, void * buf, int size);
202 public int bulk_write (int ep, char[] bytes, int size, int timeout);
204 public int bulk_read (int ep, char[] bytes, int size, int timeout);
206 public int interrupt_write (int ep, char[] bytes, int size, int timeout);
208 public int interrupt_read (int ep, char[] bytes, int size, int timeout);
209 public int control_msg (int requesttype, int request, int value, int index, char[] bytes, int size, int timeout);
210 public int set_configuration (int configuration);
211 public int claim_interface (int @interface);
212 public int release_interface (int @interface);
213 public int set_altinterface (int alternate);
214 public int resetep (uint ep);
215 public int clear_halt (uint ep);
217 public Device * device ();
221 public static weak char[] strerror ();
222 public static void init ();
223 public static void set_debug (int level);
224 public static int find_busses ();
225 public static int find_devices ();
226 public static Bus * get_busses ();
227 [CCode (cname = "USB_LE16_TO_CPU")]
228 public static uint16 le16_to_cpu (uint16 x);