 CONSTANT: LIBUSB_ENDPOINT_ADDRESS_MASK    HEX: 0f
 CONSTANT: LIBUSB_ENDPOINT_DIR_MASK        HEX: 80
 
-CONSTANT: LIBUSB_ENDPOINT_IN  HEX: 80
-CONSTANT: LIBUSB_ENDPOINT_OUT HEX: 00
-TYPEDEF: int libusb_endpoint_direction
+C-ENUM: libusb_endpoint_direction
+    { LIBUSB_ENDPOINT_IN  HEX: 80 }
+    { LIBUSB_ENDPOINT_OUT HEX: 00 } ;
 
 CONSTANT: LIBUSB_TRANSFER_TYPE_MASK HEX: 03
 
-CONSTANT: LIBUSB_TRANSFER_TYPE_CONTROL     0
-CONSTANT: LIBUSB_TRANSFER_TYPE_ISOCHRONOUS 1
-CONSTANT: LIBUSB_TRANSFER_TYPE_BULK        2
-CONSTANT: LIBUSB_TRANSFER_TYPE_INTERRUPT   3
-TYPEDEF: int libusb_transfer_type
-
-CONSTANT: LIBUSB_REQUEST_GET_STATUS        HEX: 00
-CONSTANT: LIBUSB_REQUEST_CLEAR_FEATURE     HEX: 01
-CONSTANT: LIBUSB_REQUEST_SET_FEATURE       HEX: 03
-CONSTANT: LIBUSB_REQUEST_SET_ADDRESS       HEX: 05
-CONSTANT: LIBUSB_REQUEST_GET_DESCRIPTOR    HEX: 06
-CONSTANT: LIBUSB_REQUEST_SET_DESCRIPTOR    HEX: 07
-CONSTANT: LIBUSB_REQUEST_GET_CONFIGURATION HEX: 08
-CONSTANT: LIBUSB_REQUEST_SET_CONFIGURATION HEX: 09
-CONSTANT: LIBUSB_REQUEST_GET_INTERFACE     HEX: 0A
-CONSTANT: LIBUSB_REQUEST_SET_INTERFACE     HEX: 0B
-CONSTANT: LIBUSB_REQUEST_SYNCH_FRAME       HEX: 0C
-TYPEDEF: int libusb_standard_request
-
-CONSTANT: LIBUSB_REQUEST_TYPE_STANDARD HEX: 00
-CONSTANT: LIBUSB_REQUEST_TYPE_CLASS    HEX: 20
-CONSTANT: LIBUSB_REQUEST_TYPE_VENDOR   HEX: 40
-CONSTANT: LIBUSB_REQUEST_TYPE_RESERVED HEX: 60
-
-CONSTANT: LIBUSB_RECIPIENT_DEVICE    HEX: 00
-CONSTANT: LIBUSB_RECIPIENT_INTERFACE HEX: 01
-CONSTANT: LIBUSB_RECIPIENT_ENDPOINT  HEX: 02
-CONSTANT: LIBUSB_RECIPIENT_OTHER     HEX: 03
-TYPEDEF: int libusb_request_recipient
+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
 
-CONSTANT: LIBUSB_ISO_SYNC_TYPE_NONE     0
-CONSTANT: LIBUSB_ISO_SYNC_TYPE_ASYNC    1
-CONSTANT: LIBUSB_ISO_SYNC_TYPE_ADAPTIVE 2
-CONSTANT: LIBUSB_ISO_SYNC_TYPE_SYNC     3
-TYPEDEF: int libusb_iso_sync_type
+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
 
-CONSTANT: LIBUSB_ISO_USAGE_TYPE_DATA     0
-CONSTANT: LIBUSB_ISO_USAGE_TYPE_FEEDBACK 1
-CONSTANT: LIBUSB_ISO_USAGE_TYPE_IMPLICIT 2
-TYPEDEF: int libusb_iso_usage_type
+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  }

    LIBUSB_TRANSFER_NO_DEVICE
    LIBUSB_TRANSFER_OVERFLOW ;

CONSTANT: LIBUSB_TRANSFER_SHORT_NOT_OK  1
CONSTANT: LIBUSB_TRANSFER_FREE_BUFFER   2
CONSTANT: LIBUSB_TRANSFER_FREE_TRANSFER 4
TYPEDEF: int libusb_transfer_flags

STRUCT: libusb_iso_packet_descriptor
    { length        uint                   }

C-TYPE: libusb_device
C-TYPE: libusb_device_handle

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
