Revert "Fix make check"
[vala-gnome.git] / vapi / libusb.vapi
blob8438cb19908ac3186e40b067704173f73e049217
1 [CCode (cprefix = "usb_", cheader_filename = "usb.h")]
2 namespace USB {
3         [CCode (cprefix = "USB_CLASS_", cheader_filename = "usb.h", has_type_id = false)]
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", has_type_id = false)]
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", has_type_id = false)]
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", has_type_id = false)]
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", has_type_id = false)]
59         public enum EndpointAddress {
60                 ADDRESS_MASK,
61                 DIR_MASK,
62                 IN,
63                 OUT
64         }
66         [CCode (cprefix = "USB_REQ_", cheader_filename = "usb.h", has_type_id = false)]
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", has_type_id = false)]
82         public enum Type {
83                 STANDARD,
84                 CLASS,
85                 VENDOR,
86                 RESERVED
87         }
89         [CCode (cname = "struct usb_endpoint_descriptor", cheader_filename = "usb.h", has_type_id = false)]
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                 [CCode (array_length_cname = "extralen")]
101                 public uchar[] extra;
102         }
104         [CCode (cname = "struct usb_interface_descriptor", cheader_filename = "usb.h", has_type_id = false)]
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                 [CCode (array_length_cname = "bNumEndpoints", array_length_type = "uint8_t")]
117                 public EndpointDescriptor[] endpoint;
119                 [CCode (array_length_cname = "extralen")]
120                 public uchar[] extra;
121         }
123         [CCode (cname = "struct usb_interface", cheader_filename = "usb.h", has_type_id = false)]
124         public struct Interface {
125                 [CCode (array_length_cname = "num_altsetting")]
126                 public InterfaceDescriptor[] altsetting;
127         }
129         [Compact, CCode (cname = "struct usd_config_descriptor")]
130         public class ConfigDescriptor {
131                 public uint8 bLength;
132                 public uint8 bDescriptorType;
133                 public uint16 wTotalLength;
134                 public uint8 bNumInterfaces;
135                 public uint8 bConfigurationValue;
136                 public uint8 iConfiguration;
137                 public uint8 bmAttributes;
138                 public uint8 MaxPower;
140                 [CCode (array_length_cname = "bNumInterfaces", array_length_type = "uint8_t")]
141                 public Interface[] @interface;
142           [CCode (array_length_cname = "extralen")]
143                 public uchar[] extra;
144         }
146         [CCode (cname = "struct usb_device_descriptor", cheader_filename = "usb.h", has_type_id = false)]
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         [Compact, CCode (cname = "struct usb_device", cprefix = "usb_", cheader_filename = "usb.h")]
165         public class Device {
166                 public Device next;
167                 public Device prev;
168                 public string filename;
169                 public Bus bus;
170                 public DeviceDescriptor descriptor;
171                 [CCode (array_length = false)]
172                 public ConfigDescriptor config;
173                 public void * dev;
174                 public uint8 devnum;
175                 public uchar num_children;
176                 [CCode (array_length_cname = "num_children", array_length_type = "unsigned char")]
177                 public Device[] children;
178         }
180         [Compact, CCode (cname = "struct usb_bus", cheader_filename = "usb.h")]
181         public class Bus {
182                 public Bus next;
183                 public Bus prev;
184                 public string dirname;
185                 public Device devices;
186                 public uint32 location;
187                 public Device root_dev;
188         }
190         [Compact, 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                 public int get_string (int index, int langid, [CCode (array_length = false)] char[] buf, size_t buflen);
195                 public int get_string_simple (int index, [CCode (array_length = false)] char[] buf, size_t buflen);
197                 public int get_descriptor_by_endpoint (int ep, uchar type, uchar index, void * buf, int size);
198                 public int get_descriptor (uchar type, uchar index, void * buf, int size);
199                 public int bulk_write (int ep, [CCode (array_length = false)] char[] bytes, int size, int timeout);
200                 public int bulk_read (int ep, [CCode (array_length = false)] char[] bytes, int size, int timeout);
201                 public int interrupt_write (int ep, [CCode (array_length = false)] char[] bytes, int size, int timeout);
202                 public int interrupt_read (int ep, [CCode (array_length = false)] char[] bytes, int size, int timeout);
203                 public int control_msg (int requesttype, int request, int value, int index, char[] bytes, int size, int timeout);
204                 public int set_configuration (int configuration);
205                 public int claim_interface (int @interface);
206                 public int release_interface (int @interface);
207                 public int set_altinterface (int alternate);
208                 public int resetep (uint ep);
209                 public int clear_halt (uint ep);
210                 public int reset ();
211                 public unowned Device device ();
212         }
214         [CCode (array_length = false)]
215         public static unowned char[] strerror ();
216         public static void init ();
217         public static void set_debug (int level);
218         public static int find_busses ();
219         public static int find_devices ();
220         public static unowned Bus get_busses ();
221         [CCode (cname = "USB_LE16_TO_CPU")]
222         public static uint16 le16_to_cpu (uint16 x);