 C-TYPE: libusb_device
 C-TYPE: libusb_device_handle
 
-CONSTANT: LIBUSB_SUCCESS             0
-CONSTANT: LIBUSB_ERROR_IO            -1
-CONSTANT: LIBUSB_ERROR_INVALID_PARAM -2
-CONSTANT: LIBUSB_ERROR_ACCESS        -3
-CONSTANT: LIBUSB_ERROR_NO_DEVICE     -4
-CONSTANT: LIBUSB_ERROR_NOT_FOUND     -5
-CONSTANT: LIBUSB_ERROR_BUSY          -6
-CONSTANT: LIBUSB_ERROR_TIMEOUT       -7
-CONSTANT: LIBUSB_ERROR_OVERFLOW      -8
-CONSTANT: LIBUSB_ERROR_PIPE          -9
-CONSTANT: LIBUSB_ERROR_INTERRUPTED   -10
-CONSTANT: LIBUSB_ERROR_NO_MEM        -11
-CONSTANT: LIBUSB_ERROR_NOT_SUPPORTED -12
-CONSTANT: LIBUSB_ERROR_OTHER         -99
-TYPEDEF: int libusb_error
+C-ENUM: libusb_error
+    { LIBUSB_SUCCESS             0 }
+    { LIBUSB_ERROR_IO            -1 }
+    { LIBUSB_ERROR_INVALID_PARAM -2 }
+    { LIBUSB_ERROR_ACCESS        -3 }
+    { LIBUSB_ERROR_NO_DEVICE     -4 }
+    { LIBUSB_ERROR_NOT_FOUND     -5 }
+    { LIBUSB_ERROR_BUSY          -6 }
+    { LIBUSB_ERROR_TIMEOUT       -7 }
+    { LIBUSB_ERROR_OVERFLOW      -8 }
+    { LIBUSB_ERROR_PIPE          -9 }
+    { LIBUSB_ERROR_INTERRUPTED   -10 }
+    { LIBUSB_ERROR_NO_MEM        -11 }
+    { LIBUSB_ERROR_NOT_SUPPORTED -12 }
+    { LIBUSB_ERROR_OTHER         -99 } ;
 
 C-ENUM: libusb_transfer_status
     LIBUSB_TRANSFER_COMPLETED


ALIAS: libusb_le16_to_cpu libusb_cpu_to_le16

CONSTANT: LIBUSB_CLASS_PER_INTERFACE 0
CONSTANT: LIBUSB_CLASS_AUDIO         1
CONSTANT: LIBUSB_CLASS_COMM          2
CONSTANT: LIBUSB_CLASS_HID           3
CONSTANT: LIBUSB_CLASS_PRINTER       7
CONSTANT: LIBUSB_CLASS_PTP           6
CONSTANT: LIBUSB_CLASS_MASS_STORAGE  8
CONSTANT: LIBUSB_CLASS_HUB           9
CONSTANT: LIBUSB_CLASS_DATA          10
CONSTANT: LIBUSB_CLASS_VENDOR_SPEC HEX: ff
TYPEDEF: int libusb_class_code

CONSTANT: LIBUSB_DT_DEVICE    HEX: 01
CONSTANT: LIBUSB_DT_CONFIG    HEX: 02
CONSTANT: LIBUSB_DT_STRING    HEX: 03
CONSTANT: LIBUSB_DT_INTERFACE HEX: 04
CONSTANT: LIBUSB_DT_ENDPOINT  HEX: 05
CONSTANT: LIBUSB_DT_HID       HEX: 21
CONSTANT: LIBUSB_DT_REPORT    HEX: 22
CONSTANT: LIBUSB_DT_PHYSICAL  HEX: 23
CONSTANT: LIBUSB_DT_HUB       HEX: 29
TYPEDEF: int libusb_descriptor_type

CONSTANT: LIBUSB_DT_DEVICE_SIZE           18
CONSTANT: LIBUSB_DT_CONFIG_SIZE           9

CONSTANT: LIBUSB_ENDPOINT_ADDRESS_MASK    HEX: 0f
CONSTANT: LIBUSB_ENDPOINT_DIR_MASK        HEX: 80

C-ENUM: libusb_endpoint_direction
    { LIBUSB_ENDPOINT_IN  HEX: 80 }
    { LIBUSB_ENDPOINT_OUT HEX: 00 } ;

CONSTANT: LIBUSB_TRANSFER_TYPE_MASK HEX: 03

C-ENUM: libusb_transfer_type
    { LIBUSB_TRANSFER_TYPE_CONTROL     0 }
    { LIBUSB_TRANSFER_TYPE_ISOCHRONOUS 1 }
    { LIBUSB_TRANSFER_TYPE_BULK        2 }
    { LIBUSB_TRANSFER_TYPE_INTERRUPT   3 } ;

C-ENUM: libusb_standard_request
    { LIBUSB_REQUEST_GET_STATUS        HEX: 00 }
    { LIBUSB_REQUEST_CLEAR_FEATURE     HEX: 01 }
    { LIBUSB_REQUEST_SET_FEATURE       HEX: 03 }
    { LIBUSB_REQUEST_SET_ADDRESS       HEX: 05 }
    { LIBUSB_REQUEST_GET_DESCRIPTOR    HEX: 06 }
    { LIBUSB_REQUEST_SET_DESCRIPTOR    HEX: 07 }
    { LIBUSB_REQUEST_GET_CONFIGURATION HEX: 08 }
    { LIBUSB_REQUEST_SET_CONFIGURATION HEX: 09 }
    { LIBUSB_REQUEST_GET_INTERFACE     HEX: 0A }
    { LIBUSB_REQUEST_SET_INTERFACE     HEX: 0B }
    { LIBUSB_REQUEST_SYNCH_FRAME       HEX: 0C } ;

C-ENUM: libusb_request_type
    { LIBUSB_REQUEST_TYPE_STANDARD HEX: 00 }
    { LIBUSB_REQUEST_TYPE_CLASS    HEX: 20 }
    { LIBUSB_REQUEST_TYPE_VENDOR   HEX: 40 }
    { LIBUSB_REQUEST_TYPE_RESERVED HEX: 60 } ;

C-ENUM: libusb_request_recipient
    { LIBUSB_RECIPIENT_DEVICE    HEX: 00 }
    { LIBUSB_RECIPIENT_INTERFACE HEX: 01 }
    { LIBUSB_RECIPIENT_ENDPOINT  HEX: 02 }
    { LIBUSB_RECIPIENT_OTHER     HEX: 03 } ;

CONSTANT: LIBUSB_ISO_SYNC_TYPE_MASK HEX: 0C

C-ENUM: libusb_iso_sync_type
    { LIBUSB_ISO_SYNC_TYPE_NONE     0 }
    { LIBUSB_ISO_SYNC_TYPE_ASYNC    1 }
    { LIBUSB_ISO_SYNC_TYPE_ADAPTIVE 2 }
    { LIBUSB_ISO_SYNC_TYPE_SYNC     3 } ;

CONSTANT: LIBUSB_ISO_USAGE_TYPE_MASK HEX: 30

C-ENUM: libusb_iso_usage_type
    { LIBUSB_ISO_USAGE_TYPE_DATA     0 }
    { LIBUSB_ISO_USAGE_TYPE_FEEDBACK 1 }
    { LIBUSB_ISO_USAGE_TYPE_IMPLICIT 2 } ;

STRUCT: libusb_device_descriptor
    { bLength             uint8_t  }
