update for 0.4.0 release
[vala-lang.git] / vapi / libusb.vapi
blobc373e915fb67195fa85358efd6bd7de77b2a5655
1 [CCode (cprefix = "usb_", cheader_filename = "usb.h")]
2 namespace USB {
3         [CCode (cprefix = "USB_CLASS_", cheader_filename = "usb.h")]
4         public enum Class {
5                 PER_INTERFACE,
6                 AUDIO,
7                 COMM,
8                 HID,
9                 PRINTER,
10                 PTP,
11                 MASS_STORAGE,
12                 HUB,
13                 DATA,
14                 VENDOR_SPEC
15         }
17         [CCode (cprefix = "USB_DT_", cheader_filename = "usb.h")]
18         public enum DescriptorType {
19                 DEVICE,
20                 CONFIG,
21                 STRING,
22                 INTERFACE,
23                 ENDPOINT,
24                 HID,
25                 REPORT,
26                 PHYSICAL,
27                 HUB
28         }
30         [CCode (cprefix = "USB_DT_", cheader_filename = "usb.h")]
31         public enum DescriptorSize {
32                 [CCode (cname = "USB_DT_DEVICE_SIZE")]
33                 DEVICE,
34                 [CCode (cname = "USB_DT_CONFIG_SIZE")]
35                 CONFIG,
36                 [CCode (cname = "USB_DT_INTERFACE_SIZE")]
37                 INTERFACE,
38                 [CCode (cname = "USB_DT_ENDPOINT_SIZE")]
39                 ENDPOINT,
40                 [CCode (cname = "USB_DT_ENDPOINT_AUDIO_SIZE")]
41                 ENDPOINT_AUDIO,
42                 [CCode (cname = "USB_DT_HUB_NONVAR_SIZE")]
43                 HUB_NONVAR
44         }
46         [CCode (cprefix = "USB_ENDPOINT_", cheader_filename = "usb.h")]
47         public enum EndpointAttribute {
48                 ADDRESS_MASK,
49                 IN,
50                 OUT,
51                 TYPE_MASK,
52                 TYPE_CONTROL,
53                 TYPE_ISOCHRONOUS,
54                 TYPE_BULK,
55                 TYPE_INTERRUPT,
56         }
58         [CCode (cprefix = "USB_ENDPOINT_", cheader_filename = "usb.h")]
59         public enum EndpointAddress {
60                 ADDRESS_MASK,
61                 DIR_MASK,
62                 IN,
63                 OUT
64         }
66         [CCode (cprefix = "USB_REQ_", cheader_filename = "usb.h")]
67         public enum Request {
68                 GET_STATUS,
69                 CLEAR_FEATURE,
70                 SET_FEATURE,
71                 SET_ADDRESS,
72                 GET_DESCRIPTOR,
73                 SET_DESCRIPTOR,
74                 GET_CONFIGURATION,
75                 SET_CONFIGURATION,
76                 GET_INTERFACE,
77                 SET_INTERFACE,
78                 SYNCH_FRAME
79         }
81         [CCode (cprefix = "USB_TYPE_", cheader_filename = "usb.h")]
82         public enum Type {
83                 STANDARD,
84                 CLASS,
85                 VENDOR,
86                 RESERVED
87         }
89         [CCode (cname = "struct usb_endpoint_descriptor", cheader_filename = "usb.h")]
90         public struct EndpointDescriptor {
91                 public uint8 bLength;
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;
101                 public int extralen;
102         }
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;
119                 public int extralen;
120         }
122         [CCode (cname = "struct usb_interface", cheader_filename = "usb.h")]
123         public struct Interface {
124                 public InterfaceDescriptor[] altsetting;
125                 public int num_altsetting;
126         }
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;
139                 [NoArrayLength]
140                 public Interface[] @interface;
142                 public uchar[] extra;
143                 public int extralen;
144         }
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;
162         }
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;
169                 public Bus * bus;
170                 public DeviceDescriptor descriptor;
171                 [NoArrayLength]
172                 public ConfigDescriptor[] config;
173                 public void * dev;
174                 public uint8 devnum;
175                 public uchar num_children;
176                 public Device ** children;
177         }
179         [CCode (cname = "struct usb_bus", cheader_filename = "usb.h")]
180         public struct Bus {
181                 public Bus * next;
182                 public Bus * prev;
183                 public string dirname;
184                 public Device * devices;
185                 public uint32 location;
186                 public Device * root_dev;
187         }
189         [Compact]
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);
194                 [NoArrayLength]
195                 public int get_string (int index, int langid, char[] buf, size_t buflen);
196                 [NoArrayLength]
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);
201                 [NoArrayLength]
202                 public int bulk_write (int ep, char[] bytes, int size, int timeout);
203                 [NoArrayLength]
204                 public int bulk_read (int ep, char[] bytes, int size, int timeout);
205                 [NoArrayLength]
206                 public int interrupt_write (int ep, char[] bytes, int size, int timeout);
207                 [NoArrayLength]
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);
216                 public int reset ();
217                 public Device * device ();
218         }
220         [NoArrayLength]
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);