1 /**
2  * Converted/butchered LIBUSB header to a D-Language interface
3  *
4  * Authors: Ross Lonstein <lonstein@brightboxcharge.com>
5  * License: LGPL
6  * Copyright: 2015, Brightbox, Inc.
7  * See_Also: http://www.libusb.org
8  * Notes: Libusb itself is Copyright
9  * $(UL
10  *   $(LI 2001 Johannes Erdfelt <johannes@erdfelt.com>)
11  *   $(LI 2007-2008 Daniel Drake <dsd@gentoo.org>)
12  *   $(LI 2012 Pete Batard <pete@akeo.ie>)
13  *   $(LI 2012 Nathan Hjelm <hjelmn@cs.unm.edu>) )
14  *
15  */
16 
17 module consts;
18 
19 import structs : libusb_control_setup;
20 
21 /** LIBUSB API Version */
22 const LIBUSBX_API_VERSION =  0x01000102;
23 
24 const LIBUSB_DT_DEVICE_SIZE                = 18; /** Device descriptor size */
25 const LIBUSB_DT_CONFIG_SIZE                = 9;  /** Config descriptor size */
26 const LIBUSB_DT_INTERFACE_SIZE             = 9;  /** Interface descriptor size */
27 const LIBUSB_DT_ENDPOINT_SIZE              = 7;  /** Endpoint descriptor size */
28 const LIBUSB_DT_ENDPOINT_AUDIO_SIZE        = 9;  /** Audio extension descriptor size */
29 const LIBUSB_DT_HUB_NONVAR_SIZE            = 7;  /** Hub descriptor size */
30 const LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE = 6;  /** SuperSpeed (SS) Endpoint Companion descriptor size */
31 const LIBUSB_DT_BOS_SIZE                   = 5;  /** Binary Device Object Store (BOS) descriptor size */
32 const LIBUSB_DT_DEVICE_CAPABILITY_SIZE     = 3;  /** Device Capability descriptor size */
33 
34 /* Binary Device Object Store (BOS) descriptor sizes */
35 const LIBUSB_BT_USB_2_0_EXTENSION_SIZE        =  7;  /** BOS USB 2.0 Extension descriptor size */
36 const LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE = 10;  /** BOS SS USB Device Capability descriptor size */
37 const LIBUSB_BT_CONTAINER_ID_SIZE             = 20;  /** BOS Container ID descriptor size */
38 
39 /* We unwrap the BOS => define its max size */
40 const LIBUSB_DT_BOS_MAX_SIZE =
41   ((LIBUSB_DT_BOS_SIZE)+(LIBUSB_BT_USB_2_0_EXTENSION_SIZE)
42    + (LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE)+(LIBUSB_BT_CONTAINER_ID_SIZE)); //* BOS max size */
43 
44 const LIBUSB_ENDPOINT_ADDRESS_MASK = 0x0f;  /** Endpoint Address Mask */ /* in bEndpointAddress */
45 const LIBUSB_ENDPOINT_DIR_MASK     = 0x80;  /** Endpoint Direction Mask */
46 const LIBUSB_TRANSFER_TYPE_MASK = 0x03;     /** Transfer Type Mask */   /* in bmAttributes */
47 const LIBUSB_ISO_SYNC_TYPE_MASK = 0x0C;     /** ISO Sync Type Mask */
48 const LIBUSB_ISO_USAGE_TYPE_MASK = 0x30;    /** ISO Usage Type Mask */
49 
50 const LIBUSB_CONTROL_SETUP_SIZE = libusb_control_setup.sizeof; /** Control Setup Size */
51 
52 /**
53  * Wildcard matching for hotplug events */
54 const LIBUSB_HOTPLUG_MATCH_ANY = -1; /** Hotplug "match any" wildcard */
55