|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||USB||MBS USB Plugin||18.1||Yes||Yes||Yes||Yes||No|
This is both for a device as general and an open connection.
LibUSB abstracts on Mac, Windows and Linux for using USB devices. SO far it's the best generic USB interface we have.
You need libUSB dylib (mac), dll (Windows) and so (Linux) files from LibUSB. For Linux the LibUSB library is usually preinstalled with a LibUSB package, so the plugin finds it automatically.
- 7 properties
- 26 methods
- method AttachKernelDriver(interfaceNumber as Integer)
- method BulkTransfer(endpoint as Integer, data as Ptr, Length as Integer, byref ActualLength as Integer, Timeout as Integer)
- method ClaimInterface(interfaceNumber as Integer)
- method ClearHalt(endpoint as Integer)
- method Close
- method ControlTransfer(requestType as Integer, Request as Integer, Value as Integer, Index as Integer, data as Ptr, Length as Integer, Timeout as Integer) as Integer
- method DetachKernelDriver(interfaceNumber as Integer)
- method GetActiveConfigDescriptor as LibUSBConfigDescriptorMBS
- method GetConfigDescriptor(Index as Integer) as LibUSBConfigDescriptorMBS
- method GetConfigDescriptorByValue(Value as Integer) as LibUSBConfigDescriptorMBS
- method GetConfiguration as Integer
- method GetDescriptor(descType as Integer, descIndex as Integer, data as Ptr, Length as Integer) as Integer
- method GetDeviceDescriptor as LibUSBDeviceDescriptorMBS
- method GetMaxISOPacketSize(EndPoint as Integer) as Integer
- method GetMaxPacketSize(EndPoint as Integer) as Integer
- method GetStringDescriptor(descIndex as Integer, LangID as Integer = 0) as String
- method GetStringDescriptor(descIndex as Integer, LangID as Integer = 0, data as Ptr, Length as Integer) as Integer
- method GetStringDescriptorAscii(descIndex as Integer) as String
- method GetStringDescriptorAscii(descIndex as Integer, data as Ptr, Length as Integer) as Integer
- method InterruptTransfer(endpoint as Integer, data as Ptr, Length as Integer, byref ActualLength as Integer, Timeout as Integer)
- method KernelDriverActive(interfaceNumber as Integer) as Boolean
- method Open as Boolean
- method ReleaseInterface(interfaceNumber as Integer)
- method Reset
- method SetConfiguration(configuration as Integer)
- method SetInterfaceAltSetting(interfaceNumber as Integer, alternateSetting as Integer)
- 12 shared methods
- shared method Devices as LibUSBDeviceMBS()
- shared method ErrorName(ErrorCode as Integer) as String
- shared method HasCapability(Capability as UInt32) as Boolean
- shared method Initialize as Integer
- shared method LibraryLoaded as Boolean
- shared method LibraryLoadErrorMessage as String
- shared method LibVersion as LibUSBVersionMBS
- shared method LoadLibrary(file as folderitem) as boolean
- shared method LoadLibrary(path as string) as boolean
- shared method OpenDevice(VID as Integer, PID as Integer) as LibUSBDeviceMBS
- shared method SetDebug(level as integer)
- shared method Shutdown
- 40 constants
The HasCapability() API is available.
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
Hotplug support is available on this platform.
The library supports detaching of the default USB driver, using DetachKernelDriver, if one is set by the OS kernel.
Device Capability descriptor
HID report descriptor.
SuperSpeed Endpoint Companion descriptor
SuperSpeed Hub descriptor
Out of Memory
Function not supported
debug and informational messages are printed to stdout, warnings and errors to stderr
error messages are printed to stderr
informational messages are printed to stdout, warning and error messages are printed to stderr
no messages ever printed by the library (default)
warning and error messages are printed to stderr
The device is operating at full speed (12MBit/s).
The device is operating at high speed (480MBit/s).
The device is operating at low speed (1.5MBit/s).
The device is operating at super speed (5000MBit/s).
The OS doesn't report or know the device speed.
This class has no sub classes.
Some examples which use this class:
The items on this page are in the following plugins: MBS USB Plugin.
MBS Xojo blog