/' * Public libusb header file * Copyright © 2001 Johannes Erdfelt * Copyright © 2007-2008 Daniel Drake * Copyright © 2012 Pete Batard * Copyright © 2012 Nathan Hjelm * For more information, please visit: http://libusb.info * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA '/ 'Ported to freeBasic by grindstone Feb/2018 #Ifndef LIBUSB_H #define LIBUSB_H #Inclib "usb-1.0" #Include Once "crt\stdint.bi" #Include Once "crt\sys\types.bi" #If Defined(__FB_LINUX__ ) Or Defined(__FB_CYGWIN__) #Include Once "crt\time.bi" #EndIf #Include Once "crt\limits.bi" /' 'interface' might be defined as a macro on Windows, so we need to * undefine it so as not to break the current libusb API, because * libusb_config_descriptor has an 'interface' member * As this can be problematic if you include windows.bi after libusb.bi * in your sources, we force windows.h to be included first. '/ #If Defined(__FB_WIN32__) Or Defined(__FB_CYGWIN__) #Include Once "windows.bi" #If Defined(interface) #Undef interface #EndIf #If Not Defined(__FB_CYGWIN__) #Include Once "win\winsock.bi" #EndIf #EndIf #If Defined(__FB_LINUX__) #Include Once "crt/sys/socket.bi" #EndIf Dim As ULong libusb_device = 0 /'* \def LIBUSB_CALL * \ingroup libusb_misc * libusb's Windows calling convention. * * Under Windows, the selection of available compilers and configurations * means that, unlike other platforms, there is not one true calling * convention (calling convention: the manner in which parameters are * passed to functions in the generated assembly code). * * Matching the Windows API itself, libusb uses the WINAPI convention (which * translates to the stdcall convention) and guarantees that the * library is compiled in this way. The public header file also includes * appropriate annotations so that your own software will use the right * convention, even if another convention is being used by default within * your codebase. * * The one consideration that you must apply in your software is to mark * all functions which you use as libusb callbacks with this LIBUSB_CALL * annotation, so that they too get compiled for the correct calling * convention. * * On non-Windows operating systems, this macro is defined as nothing. This * means that you can apply it to your code without worrying about * cross-platform compatibility. '/ /' LIBUSB_CALL must be defined on both definition and declaration of libusb * functions. You'd think that declaration would be enough, but cygwin will * complain about conflicting types unless both are marked this way. * The placement of this macro is important too; it must appear after the * return type, before the function name. See internal documentation for * API_EXPORTED. '/ /'* \def LIBUSB_API_VERSION * \ingroup libusb_misc * libusb's API version. * * Since version 1.0.13, to help with feature detection, libusb defines * a LIBUSB_API_VERSION macro that gets increased every time there is a * significant change to the API, such as the introduction of a new call, * the definition of a new macro/enum member, or any other element that * libusb applications may want to detect at compilation time. * * The macro is typically used in an application as follows: * \code * #if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= &h01001234) * // Use one of the newer features from the libusb API * #endif * \endcode * * Internally, LIBUSB_API_VERSION is defined as follows: * (libusb major Shl 24) | (libusb minor Shl 16) | (16 bit incremental) '/ #define LIBUSB_API_VERSION &h01000105 /' The following is kept for compatibility, but will be deprecated in the future '/ #define LIBUSBX_API_VERSION LIBUSB_API_VERSION #If Defined(__FB_WIN32__) #Define LIBUSB_CALL WINAPI Extern "Windows-MS" #Else #Define LIBUSB_CALL Extern "C" #EndIf /'* * \ingroup libusb_misc * Convert a 16-bit value from host-endian to little-endian format. On * little endian systems, this function does nothing. On big endian systems, * the bytes are swapped. * \param x the host-endian value to convert * \returns the value in little-endian byte order '/ Function libusb_cpu_to_le16(x As Const uint16_t) As uint16_t Union _tmp As uint8_t b8(1) As uint16_t b16 End Union Dim _tmp As _tmp _tmp.b8(1) = Cast(uint8_t, (x Shr 8)) _tmp.b8(0) = Cast(uint8_t, (x And &hff)) Return _tmp.b16 End Function /'* \def libusb_le16_to_cpu * \ingroup libusb_misc * Convert a 16-bit value from little-endian to host-endian format. On * little endian systems, this function does nothing. On big endian systems, * the bytes are swapped. * \param x the little-endian value to convert * \returns the value in host-endian byte order '/ #define libusb_le16_to_cpu libusb_cpu_to_le16 /' standard USB stuff '/ /'* \ingroup libusb_desc * Device and/or Interface Class codes '/ Enum libusb_class_code /'* In the context of a \ref libusb_device_descriptor "device descriptor", * this bDeviceClass value indicates that each interface specifies its * own class information and all interfaces operate independently. '/ LIBUSB_CLASS_PER_INTERFACE = 0 /'* Audio class '/ LIBUSB_CLASS_AUDIO = 1 /'* Communications class '/ LIBUSB_CLASS_COMM = 2 /'* Human Interface Device class '/ LIBUSB_CLASS_HID = 3 /'* Physical '/ LIBUSB_CLASS_PHYSICAL = 5 /'* Printer class '/ LIBUSB_CLASS_PRINTER = 7 /'* Image class '/ LIBUSB_CLASS_PTP = 6, /' legacy name from libusb-0.1 usb.h '/ LIBUSB_CLASS_IMAGE = 6 /'* Mass storage class '/ LIBUSB_CLASS_MASS_STORAGE = 8 /'* Hub class '/ LIBUSB_CLASS_HUB = 9 /'* Data class '/ LIBUSB_CLASS_DATA = 10 /'* Smart Card '/ LIBUSB_CLASS_SMART_CARD = &h0b /'* Content Security '/ LIBUSB_CLASS_CONTENT_SECURITY = &h0d /'* Video '/ LIBUSB_CLASS_VIDEO = &h0e, /'* Personal Healthcare '/ LIBUSB_CLASS_PERSONAL_HEALTHCARE = &h0f /'* Diagnostic Device '/ LIBUSB_CLASS_DIAGNOSTIC_DEVICE = &hdc /'* Wireless class '/ LIBUSB_CLASS_WIRELESS = &he0 /'* Application class '/ LIBUSB_CLASS_APPLICATION = &hfe /'* Class is vendor-specific '/ LIBUSB_CLASS_VENDOR_SPEC = &hff End Enum /'* \ingroup libusb_desc * Descriptor types as defined by the USB specification. '/ Enum libusb_descriptor_type /'* Device descriptor. See libusb_device_descriptor. '/ LIBUSB_DT_DEVICE = &h01 /'* Configuration descriptor. See libusb_config_descriptor. '/ LIBUSB_DT_CONFIG = &h02 /'* String descriptor '/ LIBUSB_DT_STRING = &h03 /'* Interface descriptor. See libusb_interface_descriptor. '/ LIBUSB_DT_INTERFACE = &h04 /'* Endpoint descriptor. See libusb_endpoint_descriptor. '/ LIBUSB_DT_ENDPOINT = &h05 /'* BOS descriptor '/ LIBUSB_DT_BOS = &h0f /'* Device Capability descriptor '/ LIBUSB_DT_DEVICE_CAPABILITY = &h10 /'* HID descriptor '/ LIBUSB_DT_HID = &h21 /'* HID report descriptor '/ LIBUSB_DT_REPORT = &h22 /'* Physical descriptor '/ LIBUSB_DT_PHYSICAL = &h23 /'* Hub descriptor '/ LIBUSB_DT_HUB = &h29 /'* SuperSpeed Hub descriptor '/ LIBUSB_DT_SUPERSPEED_HUB = &h2a /'* SuperSpeed Endpoint Companion descriptor '/ LIBUSB_DT_SS_ENDPOINT_COMPANION = &h30 End Enum /' Descriptor sizes per descriptor type '/ #define LIBUSB_DT_DEVICE_SIZE 18 #define LIBUSB_DT_CONFIG_SIZE 9 #define LIBUSB_DT_INTERFACE_SIZE 9 #define LIBUSB_DT_ENDPOINT_SIZE 7 #define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 /' Audio extension '/ #define LIBUSB_DT_HUB_NONVAR_SIZE 7 #define LIBUSB_DT_SS_ENDPOINT_COMPANION_SIZE 6 #define LIBUSB_DT_BOS_SIZE 5 #define LIBUSB_DT_DEVICE_CAPABILITY_SIZE 3 /' BOS descriptor sizes '/ #define LIBUSB_BT_USB_2_0_EXTENSION_SIZE 7 #define LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE 10 #define LIBUSB_BT_CONTAINER_ID_SIZE 20 /' We unwrap the BOS => define its max size '/ #define LIBUSB_DT_BOS_MAX_SIZE ((LIBUSB_DT_BOS_SIZE) + _ (LIBUSB_BT_USB_2_0_EXTENSION_SIZE) + _ (LIBUSB_BT_SS_USB_DEVICE_CAPABILITY_SIZE) + _ (LIBUSB_BT_CONTAINER_ID_SIZE)) #define LIBUSB_ENDPOINT_ADDRESS_MASK &h0f /' in bEndpointAddress '/ #define LIBUSB_ENDPOINT_DIR_MASK &h80 /'* \ingroup libusb_desc * Endpoint direction. Values for bit 7 of the * \ref libusb_endpoint_descriptor::bEndpointAddress "endpoint address" scheme. '/ Enum libusb_endpoint_direction /'* In: device-to-host '/ LIBUSB_ENDPOINT_IN = &h80 /'* Out: host-to-device '/ LIBUSB_ENDPOINT_OUT = &h00 End Enum #define LIBUSB_TRANSFER_TYPE_MASK &h03 /' in bmAttributes '/ /'* \ingroup libusb_desc * Endpoint transfer type. Values for bits 0:1 of the * \ref libusb_endpoint_descriptor::bmAttributes "endpoint attributes" field. '/ Enum libusb_transfer_type /'* Control endpoint '/ LIBUSB_TRANSFER_TYPE_CONTROL = 0 /'* Isochronous endpoint '/ LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1 /'* Bulk endpoint '/ LIBUSB_TRANSFER_TYPE_BULK = 2 /'* Interrupt endpoint '/ LIBUSB_TRANSFER_TYPE_INTERRUPT = 3 /'* Stream endpoint '/ LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4 End Enum /'* \ingroup libusb_misc * Standard requests, as defined in table 9-5 of the USB 3.0 specifications '/ Enum libusb_standard_request /'* Request status of the specific recipient '/ LIBUSB_REQUEST_GET_STATUS = &h00 /'* Clear or disable a specific feature '/ LIBUSB_REQUEST_CLEAR_FEATURE = &h01 /' &h02 is reserved '/ /'* Set or enable a specific feature '/ LIBUSB_REQUEST_SET_FEATURE = &h03 /' &h04 is reserved '/ /'* Set device address for all future accesses '/ LIBUSB_REQUEST_SET_ADDRESS = &h05 /'* Get the specified descriptor '/ LIBUSB_REQUEST_GET_DESCRIPTOR = &h06 /'* Used to update existing descriptors or add new descriptors '/ LIBUSB_REQUEST_SET_DESCRIPTOR = &h07 /'* Get the current device configuration value '/ LIBUSB_REQUEST_GET_CONFIGURATION = &h08 /'* Set device configuration '/ LIBUSB_REQUEST_SET_CONFIGURATION = &h09 /'* Return the selected alternate setting for the specified interface '/ LIBUSB_REQUEST_GET_INTERFACE = &h0A /'* Select an alternate interface for the specified interface '/ LIBUSB_REQUEST_SET_INTERFACE = &h0B ' Set then report an endpoint's synchronization frame '/ LIBUSB_REQUEST_SYNCH_FRAME = &h0C /'* Sets both the U1 and U2 Exit Latency '/ LIBUSB_REQUEST_SET_SEL = &h30 /'* Delay from the time a host transmits a packet to the time it is * received by the device. '/ LIBUSB_SET_ISOCH_DELAY = &h31 End Enum /'* \ingroup libusb_misc * Request type bits of the * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control * transfers. '/ Enum libusb_request_type /'* Standard '/ LIBUSB_REQUEST_TYPE_STANDARD = (&h00 Shl 5) /'* Class '/ LIBUSB_REQUEST_TYPE_CLASS = (&h01 Shl 5) /'* Vendor '/ LIBUSB_REQUEST_TYPE_VENDOR = (&h02 Shl 5) /'* Reserved '/ LIBUSB_REQUEST_TYPE_RESERVED = (&h03 Shl 5) End Enum /'* \ingroup libusb_misc * Recipient bits of the * \ref libusb_control_setup::bmRequestType "bmRequestType" field in control * transfers. Values 4 through 31 are reserved. '/ Enum libusb_request_recipient /'* Device '/ LIBUSB_RECIPIENT_DEVICE = &h00 /'* Interface '/ LIBUSB_RECIPIENT_INTERFACE = &h01 /'* Endpoint '/ LIBUSB_RECIPIENT_ENDPOINT = &h02 /'* Other '/ LIBUSB_RECIPIENT_OTHER = &h03 End Enum #define LIBUSB_ISO_SYNC_TYPE_MASK &h0C /'* \ingroup libusb_desc * Synchronization type for isochronous endpoints. Values for bits 2:3 of the * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in * libusb_endpoint_descriptor. '/ Enum libusb_iso_sync_type /'* No synchronization '/ LIBUSB_ISO_SYNC_TYPE_NONE = 0 /'* Asynchronous '/ LIBUSB_ISO_SYNC_TYPE_ASYNC = 1 /'* Adaptive '/ LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 2 /'* Synchronous '/ LIBUSB_ISO_SYNC_TYPE_SYNC = 3 End Enum #define LIBUSB_ISO_USAGE_TYPE_MASK &h30 /'* \ingroup libusb_desc * Usage type for isochronous endpoints. Values for bits 4:5 of the * \ref libusb_endpoint_descriptor::bmAttributes "bmAttributes" field in * libusb_endpoint_descriptor. '/ Enum libusb_iso_usage_type /'* Data endpoint '/ LIBUSB_ISO_USAGE_TYPE_DATA = 0 /'* Feedback endpoint '/ LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 1 /'* Implicit feedback Data endpoint '/ LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 2 End Enum /'* \ingroup libusb_desc * A structure representing the standard USB device descriptor. This * descriptor is documented in section 9.6.1 of the USB 3.0 specification. * All multiple-byte fields are represented in host-endian format. '/ Type libusb_device_descriptor /'* Size of this descriptor (in bytes) '/ As uint8_t bLength /'* Descriptor type. Will have value * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE LIBUSB_DT_DEVICE in this * context. '/ As uint8_t bDescriptorType /'* USB specification release number in binary-coded decimal. A value of * &h0200 indicates USB 2.0, &h0110 indicates USB 1.1, etc. '/ As uint16_t bcdUSB /'* USB-IF class code for the device. See \ref libusb_class_code. '/ As uint8_t bDeviceClass /'* USB-IF subclass code for the device, qualified by the bDeviceClass * value '/ As uint8_t bDeviceSubClass /'* USB-IF protocol code for the device, qualified by the bDeviceClass and * bDeviceSubClass values '/ As uint8_t bDeviceProtocol /'* Maximum packet size for endpoint 0 '/ As uint8_t bMaxPacketSize0 /'* USB-IF vendor ID '/ As uint16_t idVendor /'* USB-IF product ID '/ As uint16_t idProduct /'* Device release number in binary-coded decimal '/ As uint16_t bcdDevice /'* Index of string descriptor describing manufacturer '/ As uint8_t iManufacturer /'* Index of string descriptor describing product '/ As uint8_t iProduct /'* Index of string descriptor containing device serial number '/ As uint8_t iSerialNumber /'* Number of possible configurations '/ As uint8_t bNumConfigurations End Type /'* \ingroup libusb_desc * A structure representing the standard USB endpoint descriptor. This * descriptor is documented in section 9.6.6 of the USB 3.0 specification. * All multiple-byte fields are represented in host-endian format. '/ Type libusb_endpoint_descriptor /'* Size of this descriptor (in bytes) '/ As uint8_t bLength /'* Descriptor type. Will have value * \ref libusb_descriptor_type::LIBUSB_DT_ENDPOINT LIBUSB_DT_ENDPOINT in * this context. '/ As uint8_t bDescriptorType /'* The address of the endpoint described by this descriptor. Bits 0:3 are * the endpoint number. Bits 4:6 are reserved. Bit 7 indicates direction, * see \ref libusb_endpoint_direction. '/ As uint8_t bEndpointAddress /'* Attributes which apply to the endpoint when it is configured using * the bConfigurationValue. Bits 0:1 determine the transfer type and * correspond to \ref libusb_transfer_type. Bits 2:3 are only used for * isochronous endpoints and correspond to \ref libusb_iso_sync_type. * Bits 4:5 are also only used for isochronous endpoints and correspond to * \ref libusb_iso_usage_type. Bits 6:7 are reserved. '/ As uint8_t bmAttributes /'* Maximum packet size this endpoint is capable of sending/receiving. '/ As uint16_t wMaxPacketSize /'* Interval for polling endpoint for data transfers. '/ As uint8_t bInterval /'* For audio devices only: the rate at which synchronization feedback * is provided. '/ As uint8_t bRefresh /'* For audio devices only: the address if the synch endpoint '/ As uint8_t bSynchAddress /'* Extra descriptors. If libusb encounters unknown endpoint descriptors, * it will store them here, should you wish to parse them. '/ As UByte Ptr extra /'* Length of the extra descriptors, in bytes. '/ As Long extra_length End Type /'* \ingroup libusb_desc * A structure representing the standard USB interface descriptor. This * descriptor is documented in section 9.6.5 of the USB 3.0 specification. * All multiple-byte fields are represented in host-endian format. '/ Type libusb_interface_descriptor /'* Size of this descriptor (in bytes) '/ As uint8_t bLength /'* Descriptor type. Will have value * \ref libusb_descriptor_type::LIBUSB_DT_INTERFACE LIBUSB_DT_INTERFACE * in this context. '/ As uint8_t bDescriptorType /'* Number of this interface '/ As uint8_t bInterfaceNumber /'* Value used to select this alternate setting for this interface '/ As uint8_t bAlternateSetting /'* Number of endpoints used by this interface (excluding the control * endpoint). '/ As uint8_t bNumEndpoints /'* USB-IF class code for this interface. See \ref libusb_class_code. '/ As uint8_t bInterfaceClass /'* USB-IF subclass code for this interface, qualified by the * bInterfaceClass value '/ As uint8_t bInterfaceSubClass /'* USB-IF protocol code for this interface, qualified by the * bInterfaceClass and bInterfaceSubClass values '/ As uint8_t bInterfaceProtocol /'* Index of string descriptor describing this interface '/ As uint8_t iInterface /'* Array of endpoint descriptors. This length of this array is determined * by the bNumEndpoints field. '/ 'As Const libusb_endpoint_descriptor Ptr endpoint As libusb_endpoint_descriptor Ptr endpoint /'* Extra descriptors. If libusb encounters unknown interface descriptors, * it will store them here, should you wish to parse them. '/ 'As Const UByte Ptr extra As UByte Ptr extra /'* Length of the extra descriptors, in bytes. '/ As Long extra_length End Type /'* \ingroup libusb_desc * A collection of alternate settings for a particular USB interface. '/ Type libusb_interface /'* Array of interface descriptors. The length of this array is determined * by the num_altsetting field. '/ As Const libusb_interface_descriptor Ptr altsetting /'* The number of alternate settings that belong to this interface '/ As Long num_altsetting End Type /'* \ingroup libusb_desc * A structure representing the standard USB configuration descriptor. This * descriptor is documented in section 9.6.3 of the USB 3.0 specification. * All multiple-byte fields are represented in host-endian format. '/ Type libusb_config_descriptor /'* Size of this descriptor (in bytes) '/ As uint8_t bLength /'* Descriptor type. Will have value * \ref libusb_descriptor_type::LIBUSB_DT_CONFIG LIBUSB_DT_CONFIG * in this context. '/ As uint8_t bDescriptorType /'* Total length of data returned for this configuration '/ As uint16_t wTotalLength /'* Number of interfaces supported by this configuration '/ As uint8_t bNumInterfaces /'* Identifier value for this configuration '/ As uint8_t bConfigurationValue /'* Index of string descriptor describing this configuration '/ As uint8_t iConfiguration /'* Configuration characteristics '/ As uint8_t bmAttributes /'* Maximum power consumption of the USB device from this bus in this * configuration when the device is fully operation. Expressed in units * of 2 mA when the device is operating in high-speed mode and in units * of 8 mA when the device is operating in super-speed mode. '/ As uint8_t MaxPower /'* Array of interfaces supported by this configuration. The length of * this array is determined by the bNumInterfaces field. '/ As Const libusb_interface Ptr interface 'As libusb_interface Ptr interface /'* Extra descriptors. If libusb encounters unknown configuration * descriptors, it will store them here, should you wish to parse them. '/ 'As Const UByte Ptr extra As UByte Ptr extra /'* Length of the extra descriptors, in bytes. '/ As Long extra_length End Type /'* \ingroup libusb_desc * A structure representing the superspeed endpoint companion * descriptor. This descriptor is documented in section 9.6.7 of * the USB 3.0 specification. All multiple-byte fields are represented in * host-endian format. '/ Type libusb_ss_endpoint_companion_descriptor /'* Size of this descriptor (in bytes) '/ As uint8_t bLength /'* Descriptor type. Will have value * \ref libusb_descriptor_type::LIBUSB_DT_SS_ENDPOINT_COMPANION in * this context. '/ As uint8_t bDescriptorType /'* The maximum number of packets the endpoint can send or * receive as part of a burst. '/ As uint8_t bMaxBurst /'* In bulk EP: bits 4:0 represents the maximum number of * streams the EP supports. In isochronous EP: bits 1:0 * represents the Mult - a zero based value that determines * the maximum number of packets within a service interval '/ As uint8_t bmAttributes /'* The total number of bytes this EP will transfer every * service interval. valid only for periodic EPs. '/ As uint16_t wBytesPerInterval End Type #If Defined(__STDC_VERSION__) #If (__STDC_VERSION__ >= 199901) #Define __STDC_VERSION_DEF__ #EndIf #EndIf /'* \ingroup libusb_desc * A generic representation of a BOS Device Capability descriptor. It is * advised to check bDevCapabilityType and call the matching * libusb_get_*_descriptor function to get a structure fully matching the type. '/ Type libusb_bos_dev_capability_descriptor /'* Size of this descriptor (in bytes) '/ As uint8_t bLength /'* Descriptor type. Will have value * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY * LIBUSB_DT_DEVICE_CAPABILITY in this context. '/ As uint8_t bDescriptorType /'* Device Capability type '/ As uint8_t bDevCapabilityType /'* Device Capability data (bLength - 3 bytes) '/ #If Defined(__STDC_VERSION_DEF__) As uint8_t dev_capability_data(Any) /' valid C99 code '/ #Else As uint8_t dev_capability_data(0) /' non-standard, but usually working code '/ #EndIf End Type /'* \ingroup libusb_desc * A structure representing the Binary Device Object Store (BOS) descriptor. * This descriptor is documented in section 9.6.2 of the USB 3.0 specification. * All multiple-byte fields are represented in host-endian format. '/ Type libusb_bos_descriptor /'* Size of this descriptor (in bytes) '/ As uint8_t bLength /'* Descriptor type. Will have value * \ref libusb_descriptor_type::LIBUSB_DT_BOS LIBUSB_DT_BOS * in this context. '/ As uint8_t bDescriptorType /'* Length of this descriptor and all of its sub descriptors '/ As uint16_t wTotalLength /'* The number of separate device capability descriptors in * the BOS '/ As uint8_t bNumDeviceCaps /'* bNumDeviceCap Device Capability Descriptors '/ #If Defined(__STDC_VERSION_DEF__) As libusb_bos_dev_capability_descriptor Ptr dev_capability(Any) /' valid C99 code '/ #Else As libusb_bos_dev_capability_descriptor Ptr dev_capability(0) /' non-standard, but usually working code '/ #EndIf End Type /'* \ingroup libusb_desc * A structure representing the USB 2.0 Extension descriptor * This descriptor is documented in section 9.6.2.1 of the USB 3.0 specification. * All multiple-byte fields are represented in host-endian format. '/ Type libusb_usb_2_0_extension_descriptor /'* Size of this descriptor (in bytes) '/ As uint8_t bLength /'* Descriptor type. Will have value * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY * LIBUSB_DT_DEVICE_CAPABILITY in this context. '/ As uint8_t bDescriptorType /'* Capability type. Will have value * \ref libusb_capability_type::LIBUSB_BT_USB_2_0_EXTENSION * LIBUSB_BT_USB_2_0_EXTENSION in this context. '/ As uint8_t bDevCapabilityType /'* Bitmap encoding of supported device level features. * A value of one in a bit location indicates a feature is * supported; a value of zero indicates it is not supported. * See \ref libusb_usb_2_0_extension_attributes. '/ As uint32_t bmAttributes End Type /'* \ingroup libusb_desc * A structure representing the SuperSpeed USB Device Capability descriptor * This descriptor is documented in section 9.6.2.2 of the USB 3.0 specification. * All multiple-byte fields are represented in host-endian format. '/ Type libusb_ss_usb_device_capability_descriptor /'* Size of this descriptor (in bytes) '/ As uint8_t bLength /'* Descriptor type. Will have value * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY * LIBUSB_DT_DEVICE_CAPABILITY in this context. '/ As uint8_t bDescriptorType /'* Capability type. Will have value * \ref libusb_capability_type::LIBUSB_BT_SS_USB_DEVICE_CAPABILITY * LIBUSB_BT_SS_USB_DEVICE_CAPABILITY in this context. '/ As uint8_t bDevCapabilityType /'* Bitmap encoding of supported device level features. * A value of one in a bit location indicates a feature is * supported; a value of zero indicates it is not supported. * See \ref libusb_ss_usb_device_capability_attributes. '/ As uint8_t bmAttributes /'* Bitmap encoding of the speed supported by this device when * operating in SuperSpeed mode. See \ref libusb_supported_speed. '/ As uint16_t wSpeedSupported /'* The lowest speed at which all the functionality supported * by the device is available to the user. For example if the * device supports all its functionality when connected at * full speed and above then it sets this value to 1. '/ As uint8_t bFunctionalitySupport /'* U1 Device Exit Latency. '/ As uint8_t bU1DevExitLat /'* U2 Device Exit Latency. '/ As uint16_t bU2DevExitLat End Type /'* \ingroup libusb_desc * A structure representing the Container ID descriptor. * This descriptor is documented in section 9.6.2.3 of the USB 3.0 specification. * All multiple-byte fields, except UUIDs, are represented in host-endian format. '/ Type libusb_container_id_descriptor /'* Size of this descriptor (in bytes) '/ As uint8_t bLength /'* Descriptor type. Will have value * \ref libusb_descriptor_type::LIBUSB_DT_DEVICE_CAPABILITY * LIBUSB_DT_DEVICE_CAPABILITY in this context. '/ As uint8_t bDescriptorType /'* Capability type. Will have value * \ref libusb_capability_type::LIBUSB_BT_CONTAINER_ID * LIBUSB_BT_CONTAINER_ID in this context. '/ As uint8_t bDevCapabilityType /'* Reserved field '/ As uint8_t bReserved /'* 128 bit UUID '/ As uint8_t ContainerID(16) End Type /'* \ingroup libusb_asyncio * Setup packet for control transfers. '/ Type libusb_control_setup /'* Request type. Bits 0:4 determine recipient, see * \ref libusb_request_recipient. Bits 5:6 determine type, see * \ref libusb_request_type. Bit 7 determines data transfer direction, see * \ref libusb_endpoint_direction. '/ As uint8_t bmRequestType /'* Request. If the type bits of bmRequestType are equal to * \ref libusb_request_type::LIBUSB_REQUEST_TYPE_STANDARD * "LIBUSB_REQUEST_TYPE_STANDARD" then this field refers to * \ref libusb_standard_request. For other cases, use of this field is * application-specific. '/ As uint8_t bRequest /'* Value. Varies according to request '/ As uint16_t wValue /'* Index. Varies according to request, typically used to pass an index * or offset '/ As uint16_t wIndex /'* Number of bytes to transfer '/ As uint16_t wLength End Type #define LIBUSB_CONTROL_SETUP_SIZE (SizeOf(libusb_control_setup)) /' libusb '/ Type libusb_context As libusb_context Type libusb_device As libusb_device Type libusb_device_handle As libusb_device_handle /'* \ingroup libusb_lib * Structure providing the version of the libusb runtime '/ Type libusb_version /'* Library major version. '/ As uint16_t major /'* Library minor version. '/ 'As Const uint16_t minor As uint16_t minor /'* Library micro version. '/ 'As Const uint16_t micro As uint16_t micro /'* Library nano version. '/ 'As Const uint16_t nano As uint16_t nano /'* Library release candidate suffix string, e.g. "-rc4". '/ 'As Const UByte Ptr rc As UByte Ptr rc /'* For ABI compatibility only. '/ As UByte Ptr describe End Type /'* \ingroup libusb_lib * Structure representing a libusb session. The concept of individual libusb * sessions allows for your program to use two libraries (or dynamically * load two modules) which both independently use libusb. This will prevent * interference between the individual libusb users - for example * libusb_set_debug() will not affect the other user of the library, and * libusb_exit() will not destroy resources that the other user is still * using. * * Sessions are created by libusb_init() and destroyed through libusb_exit(). * If your application is guaranteed to only ever include a single libusb * user (i.e. you), you do not have to worry about contexts: pass NULL in * every function call where a context is required. The default context * will be used. * * For more information, see \ref libusb_contexts. '/ Type libusb_context As libusb_context /'* \ingroup libusb_dev * Structure representing a USB device detected on the system. This is an * opaque type for which you are only ever provided with a pointer, usually * originating from libusb_get_device_list(). * * Certain operations can be performed on a device, but in order to do any * I/O you will have to first obtain a device handle using libusb_open(). * * Devices are reference counted with libusb_ref_device() and * libusb_unref_device(), and are freed when the reference count reaches 0. * New devices presented by libusb_get_device_list() have a reference count of * 1, and libusb_free_device_list() can optionally decrease the reference count * on all devices in the list. libusb_open() adds another reference which is * later destroyed by libusb_close(). '/ Type libusb_device As libusb_device /'* \ingroup libusb_dev * Structure representing a handle on a USB device. This is an opaque type for * which you are only ever provided with a pointer, usually originating from * libusb_open(). * * A device handle is used to perform I/O and other operations. When finished * with a device handle, you should call libusb_close(). '/ Type libusb_device_handle As libusb_device_handle /'* \ingroup libusb_dev * Speed codes. Indicates the speed at which the device is operating. '/ Enum libusb_speed '* The OS doesn't report or know the device speed. '/ LIBUSB_SPEED_UNKNOWN = 0 /'* The device is operating at low speed (1.5MBit/s). '/ LIBUSB_SPEED_LOW = 1 /'* The device is operating at full speed (12MBit/s). '/ LIBUSB_SPEED_FULL = 2 /'* The device is operating at high speed (480MBit/s). '/ LIBUSB_SPEED_HIGH = 3 /'* The device is operating at super speed (5000MBit/s). '/ LIBUSB_SPEED_SUPER = 4 End Enum /'* \ingroup libusb_dev * Supported speeds (wSpeedSupported) bitfield. Indicates what * speeds the device supports. '/ Enum libusb_supported_speed /'* Low speed operation supported (1.5MBit/s). '/ LIBUSB_LOW_SPEED_OPERATION = 1 /'* Full speed operation supported (12MBit/s). '/ LIBUSB_FULL_SPEED_OPERATION = 2 /'* High speed operation supported (480MBit/s). '/ LIBUSB_HIGH_SPEED_OPERATION = 4 /'* Superspeed operation supported (5000MBit/s). '/ LIBUSB_SUPER_SPEED_OPERATION = 8 End Enum /'* \ingroup libusb_dev * Masks for the bits of the * \ref libusb_usb_2_0_extension_descriptor::bmAttributes "bmAttributes" field * of the USB 2.0 Extension descriptor. '/ Enum libusb_usb_2_0_extension_attributes /'* Supports Link Power Management (LPM) '/ LIBUSB_BM_LPM_SUPPORT = 2 End Enum /'* \ingroup libusb_dev * Masks for the bits of the * \ref libusb_ss_usb_device_capability_descriptor::bmAttributes "bmAttributes" field * field of the SuperSpeed USB Device Capability descriptor. '/ Enum libusb_ss_usb_device_capability_attributes /'* Supports Latency Tolerance Messages (LTM) '/ LIBUSB_BM_LTM_SUPPORT = 2 End Enum /'* \ingroup libusb_dev * USB capability types '/ Enum libusb_bos_type /'* Wireless USB device capability '/ LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 1 /'* USB 2.0 extensions '/ LIBUSB_BT_USB_2_0_EXTENSION = 2 /'* SuperSpeed USB device capability '/ LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 3 /'* Container ID type '/ LIBUSB_BT_CONTAINER_ID = 4 End Enum /'* \ingroup libusb_misc * Error codes. Most libusb functions return 0 on success or one of these * codes on failure. * You can call libusb_error_name() to retrieve a string representation of an * error code or libusb_strerror() to get an end-user suitable description of * an error code. '/ Enum libusb_error /'* Success (no error) '/ LIBUSB_SUCCESS = 0 /'* Input/output error '/ LIBUSB_ERROR_IO = -1 /'* Invalid parameter '/ LIBUSB_ERROR_INVALID_PARAM = -2 /'* Access denied (insufficient permissions) '/ LIBUSB_ERROR_ACCESS = -3 /'* No such device (it may have been disconnected) '/ LIBUSB_ERROR_NO_DEVICE = -4 /'* Entity not found '/ LIBUSB_ERROR_NOT_FOUND = -5 /'* Resource busy '/ LIBUSB_ERROR_BUSY = -6 /'* Operation timed out '/ LIBUSB_ERROR_TIMEOUT = -7 /'* Overflow '/ LIBUSB_ERROR_OVERFLOW = -8 /'* Pipe error '/ LIBUSB_ERROR_PIPE = -9 /'* System call interrupted (perhaps due to signal) '/ LIBUSB_ERROR_INTERRUPTED = -10 /'* Insufficient memory '/ LIBUSB_ERROR_NO_MEM = -11 /'* Operation not supported or unimplemented on this platform '/ LIBUSB_ERROR_NOT_SUPPORTED = -12 /' NB: Remember to update LIBUSB_ERROR_COUNT below as well as the message strings in strerror.c when adding new error codes here. '/ /'* Other error '/ LIBUSB_ERROR_OTHER = -99 End Enum /' Total number of error codes in enum libusb_error '/ #define LIBUSB_ERROR_COUNT 14 /'* \ingroup libusb_asyncio * Transfer status codes '/ Enum libusb_transfer_status /'* Transfer completed without error. Note that this does not indicate * that the entire amount of requested data was transferred. '/ LIBUSB_TRANSFER_COMPLETED /'* Transfer failed '/ LIBUSB_TRANSFER_ERROR /'* Transfer timed out '/ LIBUSB_TRANSFER_TIMED_OUT /'* Transfer was cancelled '/ LIBUSB_TRANSFER_CANCELLED /'* For bulk/interrupt endpoints: halt condition detected (endpoint * stalled). For control endpoints: control request not supported. '/ LIBUSB_TRANSFER_STALL /'* Device was disconnected '/ LIBUSB_TRANSFER_NO_DEVICE /'* Device sent more data than requested '/ LIBUSB_TRANSFER_OVERFLOW /' NB! Remember to update libusb_error_name() when adding new status codes here. '/ End Enum /'* \ingroup libusb_asyncio * libusb_transfer.flags values '/ Enum libusb_transfer_flags /'* Report short frames as errors '/ LIBUSB_TRANSFER_SHORT_NOT_OK = 1 Shl 0 /'* Automatically free() transfer buffer during libusb_free_transfer(). * Note that buffers allocated with libusb_dev_mem_alloc() should not * be attempted freed in this way, since free() is not an appropriate * way to release such memory. '/ LIBUSB_TRANSFER_FREE_BUFFER = 1 Shl 1 /'* Automatically call libusb_free_transfer() after callback returns. * If this flag is set, it is illegal to call libusb_free_transfer() * from your transfer callback, as this will result in a double-free * when this flag is acted upon. '/ LIBUSB_TRANSFER_FREE_TRANSFER = 1 Shl 2 /'* Terminate transfers that are a multiple of the endpoint's * wMaxPacketSize with an extra zero length packet. This is useful * when a device protocol mandates that each logical request is * terminated by an incomplete packet (i.e. the logical requests are * not separated by other means). * * This flag only affects host-to-device transfers to bulk and interrupt * endpoints. In other situations, it is ignored. * * This flag only affects transfers with a length that is a multiple of * the endpoint's wMaxPacketSize. On transfers of other lengths, this * flag has no effect. Therefore, if you are working with a device that * needs a ZLP whenever the end of the logical request falls on a packet * boundary, then it is sensible to set this flag on every * transfer (you do not have to worry about only setting it on transfers * that end on the boundary). * * This flag is currently only supported on Linux. * On other systems, libusb_submit_transfer() will return * LIBUSB_ERROR_NOT_SUPPORTED for every transfer where this flag is set. * * Available since libusb-1.0.9. '/ LIBUSB_TRANSFER_ADD_ZERO_PACKET = 1 Shl 3, End Enum /'* \ingroup libusb_asyncio * Isochronous packet descriptor. '/ Type libusb_iso_packet_descriptor /'* Length of data to request in this packet '/ As ULong length /'* Amount of data that was actually transferred '/ As ULong actual_length /'* Status code for this packet '/ As libusb_transfer_status status End Type Type fw_libusb_transfer As libusb_transfer /'* \ingroup libusb_asyncio * Asynchronous transfer callback function type. When submitting asynchronous * transfers, you pass a pointer to a callback function of this type via the * \ref libusb_transfer::callback "callback" member of the libusb_transfer * structure. libusb will call this function later, when the transfer has * completed or failed. See \ref libusb_asyncio for more information. * \param transfer The libusb_transfer struct the callback function is being * notified about. '/ Type libusb_transfer_cb_fn As Sub(transfer As fw_libusb_transfer Ptr) /'* \ingroup libusb_asyncio * The generic USB transfer structure. The user populates this structure and * then submits it in order to request a transfer. After the transfer has * completed, the library populates the transfer with the results and passes * it back to the user. '/ Type libusb_transfer /'* Handle of the device that this transfer will be submitted to '/ As libusb_device_handle Ptr dev_handle /'* A bitwise OR combination of \ref libusb_transfer_flags. '/ As uint8_t flags /'* Address of the endpoint where this transfer will be sent. '/ As UByte endpoint /'* Type of the endpoint from \ref libusb_transfer_type '/ As UByte Type /'* Timeout for this transfer in millseconds. A value of 0 indicates no * timeout. '/ As ULong timeout /'* The status of the transfer. Read-only, and only for use within * transfer callback function. * * If this is an isochronous transfer, this field may read COMPLETED even * if there were errors in the frames. Use the * \ref libusb_iso_packet_descriptor::status "status" field in each packet * to determine if errors occurred. '/ 'enum libusb_transfer_status status; As libusb_transfer_status status /'* Length of the data buffer '/ As Long length /'* Actual length of data that was transferred. Read-only, and only for * use within transfer callback function. Not valid for isochronous * endpoint transfers. '/ As Long actual_length /'* Callback function. This will be invoked when the transfer completes, * fails, or is cancelled. '/ 'libusb_transfer_cb_fn callback; As libusb_transfer_cb_fn callback /'* User context data to pass to the callback function. '/ As Any Ptr user_data /'* Data buffer '/ As UByte Ptr buffer /'* Number of isochronous packets. Only used for I/O with isochronous * endpoints. '/ As Long num_iso_packets /'* Isochronous packet descriptors, for isochronous transfers only. '/ #If Defined(__STDC_VERSION_DEF__) As libusb_iso_packet_descriptor iso_packet_desc(Any) /' valid C99 code '/ #Else As libusb_iso_packet_descriptor iso_packet_desc(0) /' non-standard, but usually working code '/ #EndIf End Type /'* \ingroup libusb_misc * Capabilities supported by an instance of libusb on the current running * platform. Test if the loaded library supports a given capability by calling * \ref libusb_has_capability(). '/ Enum libusb_capability /'* The libusb_has_capability() API is available. '/ LIBUSB_CAP_HAS_CAPABILITY = &h0000 /'* Hotplug support is available on this platform. '/ LIBUSB_CAP_HAS_HOTPLUG = &h0001 /'* The library can access HID devices without requiring user intervention. * Note that before being able to actually access an HID device, you may * still have to call additional libusb functions such as * \ref libusb_detach_kernel_driver(). '/ LIBUSB_CAP_HAS_HID_ACCESS = &h0100 /'* The library supports detaching of the default USB driver, using * \ref libusb_detach_kernel_driver(), if one is set by the OS kernel '/ LIBUSB_CAP_SUPPORTS_DETACH_KERNEL_DRIVER = &h0101 End Enum /'* \ingroup libusb_lib * Log message levels. * - LIBUSB_LOG_LEVEL_NONE (0) : no messages ever printed by the library (default) * - LIBUSB_LOG_LEVEL_ERROR (1) : error messages are printed to stderr * - LIBUSB_LOG_LEVEL_WARNING (2) : warning and error messages are printed to stderr * - LIBUSB_LOG_LEVEL_INFO (3) : informational messages are printed to stdout, warning * and error messages are printed to stderr * - LIBUSB_LOG_LEVEL_DEBUG (4) : debug and informational messages are printed to stdout, * warnings and errors to stderr '/ Enum libusb_log_level LIBUSB_LOG_LEVEL_NONE = 0 LIBUSB_LOG_LEVEL_ERROR LIBUSB_LOG_LEVEL_WARNING LIBUSB_LOG_LEVEL_INFO LIBUSB_LOG_LEVEL_DEBUG End Enum Declare Function libusb_init(ctx As libusb_context Ptr Ptr) As Long Declare Sub libusb_exit(ctx As libusb_context Ptr) Declare Sub libusb_set_debug(ctx As libusb_context Ptr, level As Long) Declare Function libusb_get_version() As Const libusb_version Ptr Declare Function libusb_has_capability(capability As uint32_t) As Long Declare Function libusb_error_name(errcode As Long) As Const ZString Ptr Declare Function libusb_setlocale(locale As UByte Ptr) As Long Declare Function libusb_strerror(errcode As Long) As Const ZString Ptr Declare Function libusb_get_device_list(ctx As libusb_context Ptr, list As libusb_device Ptr Ptr Ptr) As ssize_t Declare Sub libusb_free_device_list(list As libusb_device Ptr Ptr, unref_devices As Long) Declare Function libusb_ref_device(dev As libusb_device Ptr) As libusb_device Ptr Declare Sub libusb_unref_device(dev As libusb_device Ptr) Declare Function libusb_get_configuration( _ dev As libusb_device_handle Ptr, _ config As Long Ptr) As Long Declare Function libusb_get_device_descriptor( _ dev As libusb_device Ptr, _ desc As libusb_device_descriptor Ptr) As Long Declare Function libusb_get_active_config_descriptor( _ dev As libusb_device Ptr, _ config As libusb_config_descriptor Ptr Ptr) As Long Declare Function libusb_get_config_descriptor( _ dev As libusb_device Ptr, _ config_index As uint8_t, _ config As libusb_config_descriptor Ptr Ptr) As Long Declare Function libusb_get_config_descriptor_by_value( _ dev As libusb_device Ptr, _ bConfigurationValue As uint8_t, _ config As libusb_config_descriptor Ptr Ptr) As Long Declare Sub libusb_free_config_descriptor(config As libusb_config_descriptor Ptr) Declare Function libusb_get_ss_endpoint_companion_descriptor( _ ctx As libusb_context Ptr, _ endpoint As Const libusb_endpoint_descriptor Ptr, _ ep_comp As libusb_ss_endpoint_companion_descriptor Ptr Ptr) As Long Declare Sub libusb_free_ss_endpoint_companion_descriptor( _ ep_comp As libusb_ss_endpoint_companion_descriptor Ptr) Declare Function libusb_get_bos_descriptor( _ dev_handle As libusb_device_handle Ptr, _ bos As libusb_bos_descriptor Ptr Ptr) As Long Declare Sub libusb_free_bos_descriptor(bos As libusb_bos_descriptor Ptr) Declare Function libusb_get_usb_2_0_extension_descriptor( _ ctx As libusb_context Ptr, _ dev_cap As libusb_bos_dev_capability_descriptor Ptr, _ usb_2_0_extension As libusb_usb_2_0_extension_descriptor Ptr Ptr) As Long Declare Sub libusb_free_usb_2_0_extension_descriptor(usb_2_0_extension As libusb_usb_2_0_extension_descriptor Ptr) Declare Function libusb_get_ss_usb_device_capability_descriptor( _ ctx As libusb_context Ptr, _ dev_cap As libusb_bos_dev_capability_descriptor Ptr, _ ss_usb_device_cap As libusb_ss_usb_device_capability_descriptor Ptr Ptr) As Long Declare Sub libusb_free_ss_usb_device_capability_descriptor(ss_usb_device_cap As libusb_ss_usb_device_capability_descriptor Ptr) Declare Function libusb_get_container_id_descriptor( _ ctx As libusb_context Ptr, _ dev_cap As libusb_bos_dev_capability_descriptor Ptr, _ container_id As libusb_container_id_descriptor Ptr Ptr) As Long Declare Sub libusb_free_container_id_descriptor( _ container_id As libusb_container_id_descriptor Ptr) Declare Function libusb_get_bus_number(dev As libusb_device Ptr) As uint8_t Declare Function libusb_get_port_number(dev As libusb_device Ptr) As uint8_t Declare Function libusb_get_port_numbers( _ dev As libusb_device Ptr, _ port_numbers As uint8_t Ptr, _ port_numbers_len As Long) As Long 'LIBUSB_DEPRECATED_FOR(libusb_get_port_numbers) Declare Function libusb_get_port_path( _ ctx As libusb_context Ptr, _ dev As libusb_device Ptr, _ path As ZString Ptr, _ path_length As uint8_t) As Long Declare Function libusb_get_parent(dev As libusb_device Ptr) As libusb_device Ptr Declare Function libusb_get_device_address(dev As libusb_device Ptr) As uint8_t Declare Function libusb_get_device_speed(dev As libusb_device Ptr) As Long Declare Function libusb_get_max_packet_size( _ dev As libusb_device Ptr, _ endpoint As UByte) As Long Declare Function libusb_get_max_iso_packet_size(dev As libusb_device Ptr, endpoint As UByte) As Long Declare Function libusb_open(dev As libusb_device Ptr, dev_handle As libusb_device_handle Ptr Ptr) As Long Declare Sub libusb_close(dev_handle As libusb_device_handle Ptr) Declare Function libusb_get_device(dev_handle As libusb_device_handle Ptr) As libusb_device Ptr Declare Function libusb_set_configuration( _ dev_handle As libusb_device_handle Ptr, _ configuration As Long) As Long Declare Function libusb_claim_interface( _ dev_handle As libusb_device_handle Ptr, _ interface_number As Long) As Long Declare Function libusb_release_interface( _ dev_handle As libusb_device_handle Ptr, _ interface_number As Long) As Long Declare Function libusb_open_device_with_vid_pid( _ ctx As libusb_context Ptr, _ vendor_id As uint16_t, _ product_id As uint16_t) As libusb_device_handle Ptr Declare Function libusb_set_interface_alt_setting( _ dev_handle As libusb_device_handle Ptr, _ interface_number As Long, _ alternate_setting As Long) As Long Declare Function libusb_clear_halt( _ dev_handle As libusb_device_handle Ptr, _ endpoint As UByte) As Long Declare Function libusb_reset_device(dev_handle As libusb_device_handle Ptr)As Long Declare Function libusb_alloc_streams( _ dev_handle As libusb_device_handle Ptr, _ num_streams As uint32_t, _ endpoints As UByte Ptr, _ num_endpoints As Long) As Long Declare Function libusb_free_streams( _ dev_handle As libusb_device_handle Ptr, _ endpoints As UByte Ptr, _ num_endpoints As Long) As Long Declare Function libusb_dev_mem_alloc( _ dev_handle As libusb_device_handle Ptr, _ length As size_t) As UByte Ptr Declare Function libusb_dev_mem_free( _ dev_handle As libusb_device_handle Ptr, _ buffer As UByte Ptr, _ length As size_t) As Long Declare Function libusb_kernel_driver_active( _ dev_handle As libusb_device_handle Ptr, _ interface_number As Long) As Long Declare Function libusb_detach_kernel_driver( _ dev_handle As libusb_device_handle Ptr, _ interface_number As Long) As Long Declare Function libusb_attach_kernel_driver( _ dev_handle As libusb_device_handle Ptr, _ interface_number As Long) As Long Declare Function libusb_set_auto_detach_kernel_driver( _ dev_handle As libusb_device_handle Ptr, _ enable As Long) As Long /' async I/O '/ /'* \ingroup libusb_asyncio * Get the data section of a control transfer. This convenience function is here * to remind you that the data does not start until 8 bytes into the actual * buffer, as the setup packet comes first. * * Calling this function only makes sense from a transfer callback function, * or situations where you have already allocated a suitably sized buffer at * transfer->buffer. * * \param transfer a transfer * \returns pointer to the first byte of the data section '/ Function libusb_control_transfer_get_data(transfer As libusb_transfer Ptr) As ZString Ptr Return transfer->buffer + LIBUSB_CONTROL_SETUP_SIZE End Function /'* \ingroup libusb_asyncio * Get the control setup packet of a control transfer. This convenience * function is here to remind you that the control setup occupies the first * 8 bytes of the transfer data buffer. * * Calling this function only makes sense from a transfer callback function, * or situations where you have already allocated a suitably sized buffer at * transfer->buffer. * * \param transfer a transfer * \returns a casted pointer to the start of the transfer data buffer '/ Function libusb_control_transfer_get_setup(transfer As libusb_transfer Ptr) As libusb_control_setup Ptr Return Cast(libusb_control_setup Ptr, transfer->buffer) End Function /'* \ingroup libusb_asyncio * Helper function to populate the setup packet (first 8 bytes of the data * buffer) for a control transfer. The wIndex, wValue and wLength values should * be given in host-endian byte order. * * \param buffer buffer to output the setup packet into * This pointer must be aligned to at least 2 bytes boundary. * \param bmRequestType see the * \ref libusb_control_setup::bmRequestType "bmRequestType" field of * \ref libusb_control_setup * \param bRequest see the * \ref libusb_control_setup::bRequest "bRequest" field of * \ref libusb_control_setup * \param wValue see the * \ref libusb_control_setup::wValue "wValue" field of * \ref libusb_control_setup * \param wIndex see the * \ref libusb_control_setup::wIndex "wIndex" field of * \ref libusb_control_setup * \param wLength see the * \ref libusb_control_setup::wLength "wLength" field of * \ref libusb_control_setup '/ Sub libusb_fill_control_setup( _ buffer As UByte Ptr, _ bmRequestType As uint8_t, _ bRequest As uint8_t, _ wValue As uint16_t, _ wIndex As uint16_t, _ wLength As uint16_t) Dim As libusb_control_setup Ptr setup setup = Cast(libusb_control_setup Ptr, buffer) setup->bmRequestType = bmRequestType setup->bRequest = bRequest setup->wValue = libusb_cpu_to_le16(wValue) setup->wIndex = libusb_cpu_to_le16(wIndex) setup->wLength = libusb_cpu_to_le16(wLength) End Sub Declare Function libusb_alloc_transfer(iso_packets As Long) As libusb_transfer Ptr Declare Function libusb_submit_transfer(transfer As libusb_transfer Ptr) As Long Declare Function libusb_cancel_transfer(transfer As libusb_transfer Ptr) As Long Declare Sub libusb_free_transfer(transfer As libusb_transfer Ptr) Declare Sub libusb_transfer_set_stream_id( _ transfer As libusb_transfer Ptr, _ stream_id As uint32_t) Declare Function libusb_transfer_get_stream_id(transfer As libusb_transfer Ptr) As uint32_t /'* \ingroup libusb_asyncio * Helper function to populate the required \ref libusb_transfer fields * for a control transfer. * * If you pass a transfer buffer to this function, the first 8 bytes will * be interpreted as a control setup packet, and the wLength field will be * used to automatically populate the \ref libusb_transfer::length "length" * field of the transfer. Therefore the recommended approach is: * -# Allocate a suitably sized data buffer (including space for control setup) * -# Call libusb_fill_control_setup() * -# If this is a host-to-device transfer with a data stage, put the data * in place after the setup packet * -# Call this function * -# Call libusb_submit_transfer() * * It is also legal to pass a NULL buffer to this function, in which case this * function will not attempt to populate the length field. Remember that you * must then populate the buffer and length fields later. * * \param transfer the transfer to populate * \param dev_handle handle of the device that will handle the transfer * \param buffer data buffer. If provided, this function will interpret the * first 8 bytes as a setup packet and infer the transfer length from that. * This pointer must be aligned to at least 2 bytes boundary. * \param callback callback function to be invoked on transfer completion * \param user_data user data to pass to callback function * \param timeout timeout for the transfer in milliseconds '/ Sub libusb_fill_control_transfer( _ transfer As libusb_transfer Ptr, _ dev_handle As libusb_device_handle Ptr, _ buffer As UByte Ptr, _ callback As libusb_transfer_cb_fn, _ user_data As Any Ptr, _ timeout As ULong) Dim As libusb_control_setup Ptr setup setup = Cast(libusb_control_setup Ptr, buffer) transfer->dev_handle = dev_handle transfer->endpoint = 0 transfer->Type = LIBUSB_TRANSFER_TYPE_CONTROL transfer->timeout = timeout transfer->buffer = buffer If setup Then transfer->length = Cast(Long, LIBUSB_CONTROL_SETUP_SIZE + libusb_le16_to_cpu(setup->wLength)) EndIf transfer->user_data = user_data transfer->callback = callback End Sub /'* \ingroup libusb_asyncio * Helper function to populate the required \ref libusb_transfer fields * for a bulk transfer. * * \param transfer the transfer to populate * \param dev_handle handle of the device that will handle the transfer * \param endpoint address of the endpoint where this transfer will be sent * \param buffer data buffer * \param length length of data buffer * \param callback callback function to be invoked on transfer completion * \param user_data user data to pass to callback function * \param timeout timeout for the transfer in milliseconds '/ Sub libusb_fill_bulk_transfer( _ transfer As libusb_transfer Ptr, _ dev_handle As libusb_device_handle Ptr, _ endpoint As UByte, _ buffer As UByte Ptr, _ length As Long, _ callback As libusb_transfer_cb_fn, _ user_data As Any Ptr, _ timeout As ULong) transfer->dev_handle = dev_handle transfer->endpoint = endpoint transfer->Type = LIBUSB_TRANSFER_TYPE_BULK transfer->timeout = timeout transfer->buffer = buffer transfer->length = length transfer->user_data = user_data transfer->callback = callback End Sub /'* \ingroup libusb_asyncio * Helper function to populate the required \ref libusb_transfer fields * for a bulk transfer using bulk streams. * * Since version 1.0.19, \ref LIBUSB_API_VERSION >= &h01000103 * * \param transfer the transfer to populate * \param dev_handle handle of the device that will handle the transfer * \param endpoint address of the endpoint where this transfer will be sent * \param stream_id bulk stream id for this transfer * \param buffer data buffer * \param length length of data buffer * \param callback callback function to be invoked on transfer completion * \param user_data user data to pass to callback function * \param timeout timeout for the transfer in milliseconds '/ Sub libusb_fill_bulk_stream_transfer( _ transfer As libusb_transfer Ptr, _ dev_handle As libusb_device_handle Ptr, _ endpoint As UByte, _ stream_id As uint32_t, _ buffer As UByte Ptr, _ length As Long, _ callback As libusb_transfer_cb_fn, _ user_data As Any Ptr, _ timeout As ULong) libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, _ length, callback, user_data, timeout) transfer->Type = LIBUSB_TRANSFER_TYPE_BULK_STREAM libusb_transfer_set_stream_id(transfer, stream_id) End Sub /'* \ingroup libusb_asyncio * Helper function to populate the required \ref libusb_transfer fields * for an interrupt transfer. * * \param transfer the transfer to populate * \param dev_handle handle of the device that will handle the transfer * \param endpoint address of the endpoint where this transfer will be sent * \param buffer data buffer * \param length length of data buffer * \param callback callback function to be invoked on transfer completion * \param user_data user data to pass to callback function * \param timeout timeout for the transfer in milliseconds '/ Sub libusb_fill_interrupt_transfer( _ transfer As libusb_transfer Ptr, _ dev_handle As libusb_device_handle Ptr, _ endpoint As UByte, _ buffer As UByte Ptr, _ length As Long, _ callback As libusb_transfer_cb_fn, _ user_data As Any Ptr, _ timeout As ULong) transfer->dev_handle = dev_handle transfer->endpoint = endpoint transfer->Type = LIBUSB_TRANSFER_TYPE_INTERRUPT transfer->timeout = timeout transfer->buffer = buffer transfer->length = length transfer->user_data = user_data transfer->callback = callback End Sub /'* \ingroup libusb_asyncio * Helper function to populate the required \ref libusb_transfer fields * for an isochronous transfer. * * \param transfer the transfer to populate * \param dev_handle handle of the device that will handle the transfer * \param endpoint address of the endpoint where this transfer will be sent * \param buffer data buffer * \param length length of data buffer * \param num_iso_packets the number of isochronous packets * \param callback callback function to be invoked on transfer completion * \param user_data user data to pass to callback function * \param timeout timeout for the transfer in milliseconds '/ Sub libusb_fill_iso_transfer( _ transfer As libusb_transfer Ptr, _ dev_handle As libusb_device_handle Ptr, _ endpoint As UByte, _ buffer As UByte Ptr, _ length As Long, _ num_iso_packets As Long, _ callback As libusb_transfer_cb_fn, _ user_data As Any Ptr, _ timeout As ULong) transfer->dev_handle = dev_handle transfer->endpoint = endpoint transfer->Type = LIBUSB_TRANSFER_TYPE_ISOCHRONOUS transfer->timeout = timeout transfer->buffer = buffer transfer->length = length transfer->num_iso_packets = num_iso_packets transfer->user_data = user_data transfer->callback = callback End Sub /'* \ingroup libusb_asyncio * Convenience function to set the length of all packets in an isochronous * transfer, based on the num_iso_packets field in the transfer structure. * * \param transfer a transfer * \param length the length to set in each isochronous packet descriptor * \see libusb_get_max_packet_size() '/ Sub libusb_set_iso_packet_lengths( _ transfer As libusb_transfer Ptr, _ length As ULong) Dim As Long i For i = 0 To transfer->num_iso_packets transfer->iso_packet_desc(i).length = length Next End Sub /'* \ingroup libusb_asyncio * Convenience function to locate the position of an isochronous packet * within the buffer of an isochronous transfer. * * This is a thorough function which loops through all preceding packets, * accumulating their lengths to find the position of the specified packet. * Typically you will assign equal lengths to each packet in the transfer, * and hence the above method is sub-optimal. You may wish to use * libusb_get_iso_packet_buffer_simple() instead. * * \param transfer a transfer * \param packet the packet to return the address of * \returns the base address of the packet buffer inside the transfer buffer, * or NULL if the packet does not exist. * \see libusb_get_iso_packet_buffer_simple() '/ Function libusb_get_iso_packet_buffer( _ transfer As libusb_transfer Ptr, _ packet As ULong) As UByte Ptr Dim As Long i Dim As size_t offset = 0 Dim As Long _packet /' oops..slight bug in the API. packet is an unsigned int, but we use * signed integers almost everywhere else. range-check and convert to * signed to avoid compiler warnings. FIXME for libusb-2. '/ If (packet > INT_MAX) Then Return NULL EndIf _packet = Cast(Long, packet) If _packet >= transfer->num_iso_packets Then Return NULL EndIf For i = 0 To _packet offset += transfer->iso_packet_desc(i).length Next Return transfer->buffer + offset End Function /'* \ingroup libusb_asyncio * Convenience function to locate the position of an isochronous packet * within the buffer of an isochronous transfer, for transfers where each * packet is of identical size. * * This function relies on the assumption that every packet within the transfer * is of identical size to the first packet. Calculating the location of * the packet buffer is then just a simple calculation: * buffer + (packet_size * packet) * * Do not use this function on transfers other than those that have identical * packet lengths for each packet. * * \param transfer a transfer * \param packet the packet to return the address of * \returns the base address of the packet buffer inside the transfer buffer, * or NULL if the packet does not exist. * \see libusb_get_iso_packet_buffer() '/ Function libusb_get_iso_packet_buffer_simple( _ transfer As libusb_transfer Ptr, _ packet As Long) As UByte Ptr Dim As Long _packet /' oops..slight bug in the API. packet is an unsigned int, but we use * signed integers almost everywhere else. range-check and convert to * signed to avoid compiler warnings. FIXME for libusb-2. '/ If (packet > INT_MAX) Then Return NULL EndIf _packet = Cast(Long, packet) If _packet >= transfer->num_iso_packets Then Return NULL EndIf Return transfer->buffer + (Cast(Long, transfer->iso_packet_desc(0).length) * _packet) End Function /' sync I/O '/ Declare Function libusb_control_transfer( _ dev_handle As libusb_device_handle Ptr, _ request_type As uint8_t, _ bRequest As uint8_t, _ wValue As uint16_t, _ wIndex As uint16_t, _ _Data As UByte Ptr, _ wLength As uint16_t, _ timeout As ULong) As Long Declare Function libusb_bulk_transfer( _ dev_handle As libusb_device_handle Ptr, _ endpoint As UByte, _ _Data As UByte Ptr, _ length As Long, _ actual_length As Long Ptr, _ timeout As ULong) As Long Declare Function libusb_interrupt_transfer( _ dev_handle As libusb_device_handle Ptr, _ endpoint As UByte, _ _Data As UByte Ptr, _ length As Long, _ actual_length As Long Ptr, _ timeout As ULong) As Long /'* \ingroup libusb_desc * Retrieve a descriptor from the default control pipe. * This is a convenience function which formulates the appropriate control * message to retrieve the descriptor. * * \param dev_handle a device handle * \param desc_type the descriptor type, see \ref libusb_descriptor_type * \param desc_index the index of the descriptor to retrieve * \param data output buffer for descriptor * \param length size of data buffer * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure '/ Function libusb_get_descriptor( _ dev_handle As libusb_device_handle Ptr, _ desc_type As uint8_t, _ desc_index As uint8_t, _ _Data As UByte Ptr, _ length As Long) As Long Return libusb_control_transfer(dev_handle, _ LIBUSB_ENDPOINT_IN, _ LIBUSB_REQUEST_GET_DESCRIPTOR, _ Cast(uint16_t, ((desc_type Shl 8) Or desc_index)), _ 0, _ _Data, _ Cast(uint16_t, length), _ 1000) End Function /'* \ingroup libusb_desc * Retrieve a descriptor from a device. * This is a convenience function which formulates the appropriate control * message to retrieve the descriptor. The string returned is Unicode, as * detailed in the USB specifications. * * \param dev_handle a device handle * \param desc_index the index of the descriptor to retrieve * \param langid the language ID for the string descriptor * \param data output buffer for descriptor * \param length size of data buffer * \returns number of bytes returned in data, or LIBUSB_ERROR code on failure * \see libusb_get_string_descriptor_ascii() '/ Function libusb_get_string_descriptor( _ dev_handle As libusb_device_handle Ptr, _ desc_index As uint8_t, _ langid As uint16_t, _ _Data As UByte Ptr, _ length As Long) As Long Return libusb_control_transfer(dev_handle, _ LIBUSB_ENDPOINT_IN, _ LIBUSB_REQUEST_GET_DESCRIPTOR, _ Cast(uint16_t,((LIBUSB_DT_STRING Shl 8) Or desc_index)), _ langid, _ _Data, _ Cast(uint16_t, length), _ 1000) End Function Declare Function libusb_get_string_descriptor_ascii( _ dev_handle As libusb_device_handle Ptr, _ desc_index As uint8_t, _ _Data As UByte Ptr, _ length As Long) As Long /' polling and timeouts '/ Declare Function libusb_try_lock_events(ctx As libusb_context Ptr) As Long Declare Sub libusb_lock_events(ctx As libusb_context Ptr) Declare Sub libusb_unlock_events(ctx As libusb_context Ptr) Declare Function libusb_event_handling_ok(ctx As libusb_context Ptr) As Long Declare Function libusb_event_handler_active(ctx As libusb_context Ptr) As Long Declare Sub libusb_interrupt_event_handler(ctx As libusb_context Ptr) Declare Sub libusb_lock_event_waiters(ctx As libusb_context Ptr) Declare Sub libusb_unlock_event_waiters(ctx As libusb_context Ptr) Declare Function libusb_wait_for_event(ctx As libusb_context Ptr, tv As timeval Ptr) As Long Declare Function libusb_handle_events_timeout(ctx As libusb_context Ptr, tv As timeval Ptr) As Long Declare Function libusb_handle_events_timeout_completed( _ ctx As libusb_context Ptr, _ tv As timeval Ptr, _ completed As Long Ptr) As Long Declare Function libusb_handle_events(ctx As libusb_context Ptr) As Long Declare Function libusb_handle_events_completed(ctx As libusb_context Ptr, completed As Long Ptr) As Long Declare Function libusb_handle_events_locked(ctx As libusb_context Ptr, tv As timeval Ptr) As Long Declare Function libusb_pollfds_handle_timeouts(ctx As libusb_context Ptr) As Long Declare Function libusb_get_next_timeout(ctx As libusb_context Ptr, tv As timeval Ptr) As Long /'* \ingroup libusb_poll * File descriptor for polling '/ Type libusb_pollfd /'* Numeric file descriptor '/ As Long fd /'* Event flags to poll for from . POLLIN indicates that you * should monitor this file descriptor for becoming ready to read from, * and POLLOUT indicates that you should monitor this file descriptor for * nonblocking write readiness. '/ As Short events End Type /'* \ingroup libusb_poll * Callback function, invoked when a new file descriptor should be added * to the set of file descriptors monitored for events. * \param fd the new file descriptor * \param events events to monitor for, see \ref libusb_pollfd for a * description * \param user_data User data pointer specified in * libusb_set_pollfd_notifiers() call * \see libusb_set_pollfd_notifiers() '/ Type libusb_pollfd_added_cb As Sub(fd As Long, events As Short, user_data As Any Ptr) /'* \ingroup libusb_poll * Callback function, invoked when a file descriptor should be removed from * the set of file descriptors being monitored for events. After returning * from this callback, do not use that file descriptor again. * \param fd the file descriptor to stop monitoring * \param user_data User data pointer specified in * libusb_set_pollfd_notifiers() call * \see libusb_set_pollfd_notifiers() '/ Type libusb_pollfd_removed_cb As Sub(fd As Long, user_data As Any Ptr) Declare Function libusb_get_pollfds(ctx As libusb_context Ptr) As Const libusb_pollfd Ptr Ptr Declare Sub libusb_free_pollfds(pollfds As Const libusb_pollfd Ptr Ptr) Declare Sub libusb_set_pollfd_notifiers( _ ctx As libusb_context Ptr, _ added_cb As libusb_pollfd_added_cb, _ removed_cb As libusb_pollfd_removed_cb, _ user_data As Any Ptr) /'* \ingroup libusb_hotplug * Callback handle. * * Callbacks handles are generated by libusb_hotplug_register_callback() * and can be used to deregister callbacks. Callback handles are unique * per libusb_context and it is safe to call libusb_hotplug_deregister_callback() * on an already deregisted callback. * * Since version 1.0.16, \ref LIBUSB_API_VERSION >= &h01000102 * * For more information, see \ref libusb_hotplug. '/ Type libusb_hotplug_callback_handle As Long /'* \ingroup libusb_hotplug * * Since version 1.0.16, \ref LIBUSB_API_VERSION >= &h01000102 * * Flags for hotplug events '/ Enum lusb_hpf /'* Default value when not using any flags. '/ LIBUSB_HOTPLUG_NO_FLAGS = 0 /'* Arm the callback and fire it for all matching currently attached devices. '/ LIBUSB_HOTPLUG_ENUMERATE = 1 Shl 0 End Enum Type libusb_hotplug_flag As lusb_hpf /'* \ingroup libusb_hotplug * * Since version 1.0.16, \ref LIBUSB_API_VERSION >= &h01000102 * * Hotplug events '/ Enum lusb_hpe /'* A device has been plugged in and is ready to use '/ LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED = &h01 /'* A device has left and is no longer available. * It is the user's responsibility to call libusb_close on any handle associated with a disconnected device. * It is safe to call libusb_get_device_descriptor on a device that has left '/ LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT = &h02 End Enum Type libusb_hotplug_event As lusb_hpe /'* \ingroup libusb_hotplug * Wildcard matching for hotplug events '/ #define LIBUSB_HOTPLUG_MATCH_ANY -1 /'* \ingroup libusb_hotplug * Hotplug callback function type. When requesting hotplug event notifications, * you pass a pointer to a callback function of this type. * * This callback may be called by an internal event thread and as such it is * recommended the callback do minimal processing before returning. * * libusb will call this function later, when a matching event had happened on * a matching device. See \ref libusb_hotplug for more information. * * It is safe to call either libusb_hotplug_register_callback() or * libusb_hotplug_deregister_callback() from within a callback function. * * Since version 1.0.16, \ref LIBUSB_API_VERSION >= &h01000102 * * \param ctx context of this notification * \param device libusb_device this event occurred on * \param event event that occurred * \param user_data user data provided when this callback was registered * \returns bool whether this callback is finished processing events. * returning 1 will cause this callback to be deregistered '/ Type libusb_hotplug_callback_fn As Function( _ ctx As libusb_context Ptr, _ device As libusb_device Ptr, _ event As libusb_hotplug_event, _ user_data As Any Ptr) As Long /'* \ingroup libusb_hotplug * Register a hotplug callback function * * Register a callback with the libusb_context. The callback will fire * when a matching event occurs on a matching device. The callback is * armed until either it is deregistered with libusb_hotplug_deregister_callback() * or the supplied callback returns 1 to indicate it is finished processing events. * * If the \ref LIBUSB_HOTPLUG_ENUMERATE is passed the callback will be * called with a \ref LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED for all devices * already plugged into the machine. Note that libusb modifies its internal * device list from a separate thread, while calling hotplug callbacks from * libusb_handle_events(), so it is possible for a device to already be present * on, or removed from, its internal device list, while the hotplug callbacks * still need to be dispatched. This means that when using \ref * LIBUSB_HOTPLUG_ENUMERATE, your callback may be called twice for the arrival * of the same device, once from libusb_hotplug_register_callback() and once * from libusb_handle_events(); and/or your callback may be called for the * removal of a device for which an arrived call was never made. * * Since version 1.0.16, \ref LIBUSB_API_VERSION >= &h01000102 * * \param[in] ctx context to register this callback with * \param[in] events bitwise or of events that will trigger this callback. See \ref * libusb_hotplug_event * \param[in] flags hotplug callback flags. See \ref libusb_hotplug_flag * \param[in] vendor_id the vendor id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY * \param[in] product_id the product id to match or \ref LIBUSB_HOTPLUG_MATCH_ANY * \param[in] dev_class the device class to match or \ref LIBUSB_HOTPLUG_MATCH_ANY * \param[in] cb_fn the function to be invoked on a matching event/device * \param[in] user_data user data to pass to the callback function * \param[out] callback_handle pointer to store the handle of the allocated callback (can be NULL) * \returns LIBUSB_SUCCESS on success LIBUSB_ERROR code on failure '/ Declare Function libusb_hotplug_register_callback( _ ctx As libusb_context Ptr, _ events As libusb_hotplug_event, _ flags As libusb_hotplug_flag, _ vendor_id As Long, _ product_id As Long, _ dev_class As Long, _ cb_fn As libusb_hotplug_callback_fn, _ user_data As Any Ptr, _ callback_handle As libusb_hotplug_callback_handle Ptr) As Long /'* \ingroup libusb_hotplug * Deregisters a hotplug callback. * * Deregister a callback from a libusb_context. This function is safe to call from within * a hotplug callback. * * Since version 1.0.16, \ref LIBUSB_API_VERSION >= &h01000102 * * \param[in] ctx context this callback is registered with * \param[in] callback_handle the handle of the callback to deregister '/ Declare Sub libusb_hotplug_deregister_callback( _ ctx As libusb_context Ptr, _ callback_handle As libusb_hotplug_callback_handle) End Extern #EndIf