1[CCode (cprefix = "libusb_", cheader_filename = "libusb.h")]
2namespace LibUSB {
3	[CCode (cname = "enum libusb_class_code", cprefix = "LIBUSB_CLASS_", has_type_id = false)]
4	public enum ClassCode {
5		PER_INTERFACE,
6		AUDIO,
7		COMM,
8		HID,
9		PRINTER,
10		PTP,
11		MASS_STORAGE,
12		HUB,
13		DATA,
14		VENDOR_SPEC
15	}
16
17	[CCode (cname = "enum libusb_descriptor_type", cprefix = "LIBUSB_DT_", has_type_id = false)]
18	public enum DescriptorType {
19		DEVICE,
20		CONFIG,
21		STRING,
22		INTERFACE,
23		ENDPOINT,
24		BOS,
25		DEVICE_CAPABILITY,
26		HID,
27		REPORT,
28		PHYSICAL,
29		HUB,
30		SUPERSPEED_HUB,
31		SS_ENDPOINT_COMPANION
32	}
33
34	namespace DescriptorTypeSize {
35		[CCode (cname = "LIBUSB_DT_DEVICE_SIZE")]
36		public const int DEVICE_SIZE;
37		[CCode (cname = "LIBUSB_DT_CONFIG_SIZE")]
38		public const int CONFIG_SIZE;
39		[CCode (cname = "LIBUSB_DT_INTERFACE_SIZE")]
40		public const int INTERFACE_SIZE;
41		[CCode (cname = "LIBUSB_DT_ENDPOINT_SIZE")]
42		public const int ENDPOINT_SIZE;
43		[CCode (cname = "LIBUSB_DT_ENDPOINT_AUDIO_SIZE")]
44		public const int ENDPOINT_AUDIO_SIZE;
45		[CCode (cname = "LIBUSB_DT_HUB_NONVAR_SIZE")]
46		public const int HUB_NONVAR_SIZE;
47		[CCode (cname = "LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE")]
48		public const int SS_ENDPOINT_COMPANION_SIZE;
49		[CCode (cname = "LIBUSB_DT_BOS_SIZE")]
50		public const int BOS_SIZE;
51		[CCode (cname = "LIBUSB_DT_DEVICE_CAPABILITY_SIZE")]
52		public const int DEVICE_CAPABILITY_SIZE;
53		[CCode (cname = "LIBUSB_BT_USB_2_0_EXTENSION_SIZE")]
54		public const int USB_2_0_EXTENSION_SIZE;
55		[CCode (cname = "LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE")]
56		public const int SS_USB_DEVICE_CAPABILITY_SIZE;
57		[CCode (cname = "LIBUSB_BT_CONTAINER_ID_SIZE")]
58		public const int CONTAINER_ID_SIZE;
59		[CCode (cname = "LIBUSB_DT_BOS_MAX_SIZE")]
60		public const int BOS_MAX_SIZE;
61	}
62
63	namespace EndpointMask {
64		[CCode (cname = "LIBUSB_ENDPOINT_ADDRESS_MASK")]
65		public const int ADDRESS;
66		[CCode (cname = "LIBUSB_ENDPOINT_DIR_MASK")]
67		public const int DIR;
68		[CCode (cname = "LIBUSB_ENDPOINT_DIR_MASK")]
69		public const int DIRECTION;
70	}
71
72	[CCode (cname = "enum libusb_endpoint_direction", cprefix = "LIBUSB_ENDPOINT_", has_type_id = false)]
73	public enum EndpointDirection {
74		IN,
75		OUT,
76		[CCode (cname = "LIBUSB_ENDPOINT_DIR_MASK")]
77		MASK
78	}
79
80	[CCode (cname = "enum libusb_transfer_type", cprefix = "LIBUSB_TRANSFER_TYPE_", has_type_id = false)]
81	public enum TransferType {
82		CONTROL,
83		ISOCHRONOUS,
84		BULK,
85		INTERRUPT,
86		BULK_STREAM
87	}
88
89	[CCode (cname = "enum libusb_standard_request", cprefix = "LIBUSB_REQUEST_", has_type_id = false)]
90	public enum StandardRequest {
91		GET_STATUS,
92		CLEAR_FEATURE,
93		SET_FEATURE,
94		SET_ADDRESS,
95		GET_DESCRIPTOR,
96		SET_DESCRIPTOR,
97		GET_CONFIGURATION,
98		SET_CONFIGURATION,
99		GET_INTERFACE,
100		SET_INTERFACE,
101		SYNCH_FRAME,
102		SET_SEL,
103		[CCode (cname = "LIBUSB_SET_ISOCH_DELAY")]
104		SET_ISOCH_DELAY
105	}
106
107	[CCode (cname = "enum libusb_request_type", cprefix = "LIBUSB_REQUEST_TYPE_", has_type_id = false)]
108	public enum RequestType {
109		STANDARD,
110		CLASS,
111		VENDOR,
112		RESERVED
113	}
114
115	[CCode (cname = "enum libusb_request_recipient", cprefix = "LIBUSB_RECIPIENT_", has_type_id = false)]
116	public enum RequestRecipient {
117		DEVICE,
118		INTERFACE,
119		ENDPOINT,
120		OTHER
121	}
122
123	[CCode (cname =	"enum libusb_iso_sync_type", cprefix = "LIBUSB_ISO_SYNC_TYPE_", has_type_id = false)]
124	public enum IsoSyncType {
125		NONE,
126		ASYNC,
127		ADAPTIVE,
128		SYNC,
129		MASK
130	}
131
132	[CCode (cname = "enum libusb_iso_usage_type", cprefix = "LIBUSB_ISO_USAGE_TYPE_", has_type_id = false)]
133	public enum IsoUsageType {
134		DATA,
135		FEEDBACK,
136		IMPLICIT,
137		MASK
138	}
139
140	[CCode (cname = "enum libusb_error", cprefix = "LIBUSB_ERROR_", has_type_id = false)]
141	public enum Error {
142		[CCode (cname = "LIBUSB_SUCCESS")]
143		SUCCESS,
144		IO,
145		INVALID_PARAM,
146		ACCESS,
147		NO_DEVICE,
148		NOT_FOUND,
149		BUSY,
150		TIMEOUT,
151		OVERFLOW,
152		PIPE,
153		INTERRUPTED,
154		NO_MEM,
155		NOT_SUPPORTED,
156		OTHER;
157		[CCode (cname = "libusb_strerror")]
158		public unowned string get_description ();
159		[CCode (cname = "libusb_error_name")]
160		public unowned string get_name ();
161	}
162
163	[CCode (cname = "enum libusb_transfer_flags", cprefix = "LIBUSB_TRANSFER_", has_type_id = false)]
164	public enum TransferFlags {
165		SHORT_NOT_OK,
166		FREE_BUFFER,
167		FREE_TRANSFER,
168		ADD_ZERO_PACKET
169	}
170
171	[CCode (cname = "enum libusb_speed", cprefix = "LIBUSB_SPEED_", has_type_id = false)]
172	public enum Speed {
173		UNKNOWN,
174		LOW,
175		FULL,
176		HIGH,
177		SUPER
178	}
179
180	[Flags]
181	[CCode (cname = "enum libusb_supported_speed", has_type_id = false)]
182	public enum SupportedSpeed {
183		[CCode (cname = "LIBUSB_LOW_SPEED_OPERATION")]
184		LOW,
185		[CCode (cname = "LIBUSB_FULL_SPEED_OPERATION")]
186		FULL,
187		[CCode (cname = "LIBUSB_HIGH_SPEED_OPERATION")]
188		HIGH,
189		[CCode (cname = "LIBUSB_SUPER_SPEED_OPERATION")]
190		SUPER
191	}
192
193	[Flags]
194	[CCode (cname = "enum libusb_usb_2_0_extension_attributes", has_type_id = false)]
195	public enum USB_2_0_ExtensionAttributes {
196		[CCode (cname = "LIBUSB_BM_LPM_SUPPORT")]
197		LPM_SUPPORT
198	}
199
200	[Flags]
201	[CCode (cname = "enum libusb_ss_usb_device_capability_attributes", has_type_id = false)]
202	public enum SSUsbDeviceCapabilityAttributes {
203		[CCode (cname = "LIBUSB_BM_LTM_SUPPORT")]
204		LTM_SUPPORT
205	}
206
207	[CCode (cname = "enum libusb_bos_type", cprefix = "LIBUSB_BT_", has_type_id = false)]
208	public enum BosType {
209		WIRELESS_USB_DEVICE_CAPABILITY,
210		USB_2_0_EXTENSION,
211		SS_USB_DEVICE_CAPABILITY,
212		CONTAINER_ID
213	}
214
215	[CCode (cname = "struct libusb_device_descriptor", has_type_id = false)]
216	public struct DeviceDescriptor {
217		public uint8 bLength;
218		public uint8 bDescriptorType;
219		public uint16 bcdUSB;
220		public uint8 bDeviceClass;
221		public uint8 bDeviceSubClass;
222		public uint8 bDeviceProtocol;
223		public uint8 bMaxPacketSize0;
224		public uint16 idVendor;
225		public uint16 idProduct;
226		public uint16 bcdDevice;
227		public uint8 iManufacturer;
228		public uint8 iProduct;
229		public uint8 iSerialNumber;
230		public uint8 bNumConfigurations;
231
232		[CCode (cname = "libusb_get_device_descriptor", instance_pos = -1)]
233		public DeviceDescriptor (Device device);
234	}
235
236	[CCode (cname = "struct libusb_endpoint_descriptor", cprefix = "libusb_", has_type_id = false)]
237	public struct EndpointDescriptor {
238		public uint8 bLength;
239		public uint8 bDescriptorType;
240		public uint8 bEndpointAddress;
241		public uint8 bmAttributes;
242		public uint16 wMaxPacketSize;
243		public uint8 bInterval;
244		public uint8 bRefresh;
245		public uint8 bSynchAddress;
246		[CCode (array_length_cname = "extra_length")]
247		public unowned uint8[] extra;
248	}
249
250	[CCode (cname = "struct libusb_interface_descriptor", has_type_id = false)]
251	public struct InterfaceDescriptor {
252		public uint8 bLength;
253		public uint8 bDescriptorType;
254		public uint8 bInterfaceNumber;
255		public uint8 bAlternateSetting;
256		public uint8 bNumEndpoints;
257		public uint8 bInterfaceClass;
258		public uint8 bInterfaceSubClass;
259		public uint8 bInterfaceProtocol;
260		public uint8 iInterface;
261		[CCode (array_length_cname = "bNumEndpoints", array_length_type = "uint8_t")]
262		public unowned EndpointDescriptor[] endpoint;
263		[CCode (array_length_cname = "extra_length")]
264		public unowned uint8[] extra;
265	}
266
267	[CCode (cname = "struct libusb_interface", has_type_id = false)]
268	public struct Interface {
269		[CCode (array_length_cname = "num_altsetting")]
270		public unowned InterfaceDescriptor[] altsetting;
271	}
272
273	[CCode (cname = "struct libusb_config_descriptor", free_function = "libusb_free_config_descriptor")]
274	[Compact]
275	public class ConfigDescriptor {
276		public uint8 bLength;
277		public uint8 bDescriptorType;
278		public uint16 wTotalLength;
279		public uint8 bNumInterfaces;
280		public uint8 bConfigurationValue;
281		public uint8 iConfiguration;
282		public uint8 bmAttributes;
283		public uint8 MaxPower;
284		[CCode (array_length_cname = "bNumInterfaces")]
285		public Interface[] @interface;
286		[CCode (array_length_cname = "extra_length")]
287		public uint8[] extra;
288	}
289
290	[CCode (cname = "struct libusb_ss_endpoint_companion_descriptor", free_function = "libusb_free_ss_endpoint_companion_descriptor")]
291	[Compact]
292	public class SSEndpointCompanionDescriptor {
293		public uint8 bLength;
294		public uint8 bDescriptorType;
295		public uint8 bMaxBurst;
296		public uint8 bmAttributes;
297		public uint16 wBytesPerInterval;
298	}
299
300	[CCode (cname = "struct libusb_bos_dev_capability_descriptor", has_type_id = false)]
301	public struct BosDevCapabilityDescriptor {
302		public uint8 bLength;
303		public uint8 bDescriptorType;
304		public uint8 bDevCapabilityType;
305		public uint8 dev_capability_data[0];
306	}
307
308	[CCode (cname = "struct libusb_bos_descriptor", free_function = "libusb_free_bos_descriptor")]
309	[Compact]
310	public class BosDescriptor {
311		public uint8 bLength;
312		public uint8 bDescriptorType;
313		public uint16 wTotalLength;
314		public uint8 bNumDeviceCaps;
315		public BosDevCapabilityDescriptor dev_capability[0];
316	}
317
318	[CCode (cname = "struct libusb_usb_2_0_extension_descriptor", free_function = "libusb_free_usb_2_0_extension_descriptor")]
319	[Compact]
320	public class USB_2_0_ExtensionDescriptor {
321		public uint8 bLength;
322		public uint8 bDescriptorType;
323		public uint8 bDevCapabilityType;
324		public uint32 bmAttributes;
325	}
326
327	[CCode (cname = "struct libusb_ss_usb_device_capability_descriptor", free_function = "libusb_free_ss_usb_device_capability_descriptor")]
328	[Compact]
329	public class SSUsbDeviceCapabilityDescriptor {
330		public uint8 bLength;
331		public uint8 bDescriptorType;
332		public uint8 bDevCapabilityType;
333		public uint8 bmAttributes;
334		public uint16 wSpeedSupported;
335		public uint8 bFunctionalitySupport;
336		public uint8 bU1DevExitLat;
337		public uint8 bU2DevExitLat;
338	}
339
340	[CCode (cname = "struct libusb_container_id_descriptor", free_function = "libusb_free_container_id_descriptor")]
341	[Compact]
342	public class ContainerIdDescriptor {
343		public uint8 bLength;
344		public uint8 bDescriptorType;
345		public uint8 bDevCapabilityType;
346		public uint8 bReserved;
347		public uint8 ContainerID[16];
348	}
349
350	[CCode (cname = "libusb_device_handle", cprefix = "libusb_", free_function = "libusb_close")]
351	[Compact]
352	public class DeviceHandle {
353		[CCode (cname = "_vala_libusb_device_handle_from_device")]
354		public DeviceHandle from_device (Device device) {
355			DeviceHandle handle;
356			device.open (out handle);
357			return handle;
358		}
359
360		[CCode (cname = "libusb_open_device_with_vid_pid")]
361		public DeviceHandle.from_vid_pid (Context? context, uint16 vendor_id, uint16 product_id);
362		public unowned Device get_device ();
363		public LibUSB.Error get_configuration (out int config);
364		public LibUSB.Error set_configuration (int configuration);
365		public LibUSB.Error claim_interface (int interface_number);
366		public LibUSB.Error release_interface (int interface_number);
367		public LibUSB.Error set_interface_alt_setting (int interface_number, int alternate_setting);
368		public LibUSB.Error clear_halt (uchar endpoint);
369		[CCode (cname = "libusb_reset_device")]
370		public LibUSB.Error reset ();
371		public LibUSB.Error kernel_driver_active (int @interface);
372		public LibUSB.Error detach_kernel_driver (int @interface);
373		public LibUSB.Error attach_kernel_driver (int @interface);
374		public LibUSB.Error set_auto_detach_kernel_driver (bool enable);
375
376		public LibUSB.Error get_string_descriptor_ascii (uint8 desc_index, uint8[] data);
377		public LibUSB.Error get_descriptor (uint8 desc_type, uint8 desc_index, uint8[] data);
378		public LibUSB.Error get_string_descriptor (uint desc_index, uint16 langid, uint8[] data);
379		public LibUSB.Error get_bos_descriptor (out BosDescriptor bos);
380
381		public LibUSB.Error control_transfer (uint8 bmRequestType, uint8 bRequest, uint16 wValue, uint16 wIndex, [CCode (array_length = false)] uint8[] data, uint16 wLength, uint timeout);
382		public LibUSB.Error bulk_transfer (uint8 endpoint, uint8[] data, out int transferred, uint timeout);
383		public LibUSB.Error interrupt_transfer (uint8 endpoint, uint8[] data, out int transferred, uint timeout);
384	}
385
386	[CCode (cname = "libusb_device", cprefix = "libusb_", ref_function = "libusb_ref_device", unref_function = "libusb_unref_device")]
387	[Compact]
388	public class Device {
389		public uint8 get_bus_number ();
390		public uint8 get_port_number ();
391		public int get_port_numbers (uint8[] port_numbers);
392		public uint8 get_device_address ();
393		public int get_max_packet_size (uint8 endpoint);
394		public int get_max_iso_packet_size (uint8 endpoint);
395		public Speed get_device_speed ();
396		public LibUSB.Error open (out DeviceHandle handle);
397
398		public LibUSB.Error get_active_config_descriptor (out ConfigDescriptor config);
399		public LibUSB.Error get_config_descriptor (uint8 config_index, out ConfigDescriptor config);
400		public LibUSB.Error get_config_descriptor_by_value (uint8 ConfigurationValue, out ConfigDescriptor config);
401		public LibUSB.Error get_device_descriptor (out DeviceDescriptor desc);
402		public unowned Device get_parent ();
403	}
404
405	[CCode (cname = "enum libusb_log_level", cprefix = "LIBUSB_LOG_LEVEL_", has_type_id = false)]
406	public enum LogLevel {
407		NONE,
408		ERROR,
409		WARNING,
410		INFO,
411		DEBUG
412	}
413
414	[CCode (cname = "libusb_context", cprefix = "libusb_", free_function = "libusb_exit")]
415	[Compact]
416	public class Context {
417		protected Context ();
418		public static LibUSB.Error init (out Context context);
419		public void set_debug (LogLevel level);
420		[CCode (cname = "libusb_get_device_list")]
421		public ssize_t _get_device_list ([CCode (array_length = false, array_null_terminated = true)] out Device[] list);
422		[CCode (cname = "_vala_libusb_get_device_list")]
423		public Device[] get_device_list () {
424			Device[] result;
425			var result_length = _get_device_list (out result);
426			result.length = (int) result_length;
427			return (owned) result;
428		}
429		public DeviceHandle open_device_with_vid_pid (uint16 vendor_id, uint16 product_id);
430
431		public LibUSB.Error try_lock_events ();
432		public void lock_events ();
433		public void unlock_events ();
434		public LibUSB.Error event_handling_ok ();
435		public LibUSB.Error event_handler_active ();
436		public void interrupt_event_handler ();
437		public void lock_event_waiters ();
438		public void unlock_event_waiters ();
439		public LibUSB.Error wait_for_event (Posix.timeval tv);
440		public LibUSB.Error handle_events_timeout (Posix.timeval tv);
441		public LibUSB.Error handle_events_timeout_completed (Posix.timeval tv, out int completed);
442		public LibUSB.Error handle_events ();
443		public LibUSB.Error handle_events_completed (out int completed);
444		public LibUSB.Error handle_events_locked (Posix.timeval tv);
445		public LibUSB.Error pollfds_handle_timeouts ();
446		public LibUSB.Error get_next_timeout (out Posix.timeval tv);
447		public void set_pollfd_notifiers (pollfd_added_cb added_cb, pollfd_removed_cb removed_cb, void* user_data);
448		[CCode (array_length = false, array_null_terminated = true)]
449		public PollFD[] get_pollfds ();
450
451		public LibUSB.Error get_ss_endpoint_companion_descriptor (EndpointDescriptor config, out SSEndpointCompanionDescriptor ep_comp);
452		public LibUSB.Error get_usb_2_0_extension_descriptor (BosDevCapabilityDescriptor dev_cap, out USB_2_0_ExtensionDescriptor usb_2_0_extension);
453		public LibUSB.Error get_ss_usb_device_capability_descriptor (BosDevCapabilityDescriptor dev_cap, out SSUsbDeviceCapabilityDescriptor usb_2_0_extension);
454		public LibUSB.Error get_container_id_descriptor (BosDevCapabilityDescriptor dev_cap, out ContainerIdDescriptor container_id);
455		public LibUSB.Error hotplug_register_callback (HotPlugEvent events, HotPlugFlags flags, int vendor_id, int product_id, int dev_class, HotPlugCb cb_fn, out HotCallbackHandle callback_handle);
456		public LibUSB.Error hotplug_deregister_callback (HotCallbackHandle callback_handle);
457	}
458
459	[CCode (cname = "libusb_le16_to_cpu")]
460	public static uint16 le16_to_cpu (uint16 n);
461	[CCode (cname = "libusb_cpu_to_le16")]
462	public static uint16 cpu_to_le16 (uint16 n);
463
464	[CCode (cname = "struct libusb_control_setup")]
465	[Compact]
466	public class ControlSetup {
467		public uint8 bmRequestType;
468		public int8 bRequest;
469		public uint16 wValue;
470		public uint16 wIndex;
471		public uint16 wLength;
472	}
473
474	[CCode (cname = "enum libusb_capability", cprefix = "LIBUSB_CAP_", has_type_id = false)]
475	public enum Capability {
476		HAS_CAPABILITY,
477		HAS_HOTPLUG,
478		HAS_HID_ACCESS,
479		SUPPORTS_DETACH_KERNEL_DRIVER
480	}
481
482	[CCode (cname = "enum libusb_transfer_status", cprefix = "LIBUSB_TRANSFER_", has_type_id = false)]
483	public enum TransferStatus {
484		COMPLETED,
485		ERROR,
486		TIMED_OUT,
487		CANCELLED,
488		STALL,
489		NO_DEVICE,
490		OVERFLOW
491	}
492
493	[CCode (cname = "libusb_hotplug_event", cprefix = "LIBUSB_HOTPLUG_EVENT_", has_type_id = false)]
494	public enum HotPlugEvent {
495		DEVICE_ARRIVED,
496		DEVICE_LEFT,
497		[CCode (cname = "LIBUSB_HOTPLUG_MATCH_ANY")]
498		MATCH_ANY
499	}
500
501	[CCode (cname = "libusb_hotplug_flag", cprefix = "LIBUSB_HOTPLUG_", has_type_id = false)]
502	public enum HotPlugFlags {
503		NO_FLAGS,
504		ENUMERATE
505	}
506
507	[CCode (cname = "libusb_hotplug_callback_handle", has_type_id = false)]
508	[SimpleType]
509	public struct HotCallbackHandle : int {
510	}
511
512	[CCode (cname = "struct libusb_iso_packet_descriptor", has_type_id = false)]
513	public struct IsoPacketDescriptor {
514		public uint length;
515		public uint actual_length;
516		public TransferStatus status;
517	}
518
519	[CCode (cname = "libusb_transfer_cb_fn")]
520	public delegate void TransferCb (Transfer transfer);
521
522	[CCode (cname = "struct libusb_transfer", cprefix = "libusb_", free_function = "libusb_free_transfer")]
523	[Compact]
524	public class Transfer {
525		public DeviceHandle dev_handle;
526		public uint8 flags;
527		public uint8 endpoint;
528		public uint8 type;
529		public uint timeout;
530		public TransferStatus status;
531		public int length;
532		public int actual_length;
533		[CCode (delegate_target_cname = "user_data")]
534		public TransferCb @callback;
535		[CCode (array_length_cname = "length")]
536		public uint8[] buffer;
537		public int num_iso_packets;
538		[CCode (array_length = false)]
539		public IsoPacketDescriptor[] iso_packet_desc;
540
541		[CCode (cname = "libusb_alloc_transfer")]
542		public Transfer (int iso_packets = 0);
543		[CCode (cname = "libusb_submit_transfer")]
544		public LibUSB.Error submit ();
545		[CCode (cname = "libusb_cancel_transfer")]
546		public LibUSB.Error cancel ();
547		[CCode (cname = "libusb_control_transfer_get_data", array_length = false)]
548		public unowned char[] control_get_data ();
549		[CCode (cname = "libusb_control_transfer_get_setup")]
550		public unowned ControlSetup control_get_setup ();
551
552		public static void fill_control_setup ([CCode (array_length = false)] uint8[] buffer, uint8 bmRequestType, uint8 bRequest, uint16 wValue, uint16 wIndex, uint16 wLength);
553		public void fill_control_transfer (DeviceHandle dev_handle, [CCode (array_length = false)] uint8[] buffer, TransferCb @callback, uint timeout);
554		public void fill_bulk_transfer (DeviceHandle dev_handle, uint8 endpoint, uint8[] buffer, TransferCb @callback, uint timeout);
555		public void fill_interrupt_transfer (DeviceHandle dev_handle, uint8 endpoint, uint8[] buffer, TransferCb @callback, uint timeout);
556		public void fill_iso_transfer (DeviceHandle dev_handle, uint8 endpoint, uint8[] buffer, int num_iso_packets, TransferCb @callback, uint timeout);
557		public void set_iso_packet_lengths (uint length);
558		[CCode (array_length = false)]
559		public unowned uint8[] get_iso_packet_buffer (uint packet);
560		[CCode (array_length = false)]
561		public unowned uint8[] get_iso_packet_buffer_simple (int packet);
562	}
563
564	[CCode (has_target = false)]
565	public delegate void pollfd_added_cb (int fd, short events, void* user_data);
566	[CCode (has_target = false)]
567	public delegate void pollfd_removed_cb (int fd, void* user_data);
568
569	[CCode (cname = "libusb_hotplug_callback_fn")]
570	public delegate void HotPlugCb (Context ctx, Device device, HotPlugEvent event);
571
572	[CCode (cname = "struct libusb_pollfd")]
573	[Compact]
574	public class PollFD {
575		public int fd;
576		public short events;
577	}
578
579	[CCode (cname = "libusb_has_capability")]
580	public static int has_capability (Capability capability);
581}
582