Platforms to show: All Mac Windows Linux Cross-Platform

LibUSBDeviceMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
The class for a device.

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.

For MacOS you can take a look on the MacUSBDeviceMBS class and the IORegistryMBS class.
See also WindowsDeviceMBS, WinUSBDeviceMBS and WinUSBMBS classes for WIndows.

Capabilities

Constant Value Description
kCapabilitiesHasCapabilities 0 The HasCapability() API is available.
kCapabilitiesHasHIDAccess 256 The library can access HID devices without requiring user intervention. more
kCapabilitiesHasHotplug 1 Hotplug support is available on this platform.
kCapabilitiesSupportsDetachKernelDriver 257 The library supports detaching of the default USB driver, using DetachKernelDriver, if one is set by the OS kernel.

Descriptor Types

Constant Value Description
kDescriptorTypeBOS 6 BOS descriptor
kDescriptorTypeConfig 2 Configuration descriptor.
kDescriptorTypeDevice 1 Device descriptor.
kDescriptorTypeDeviceCapabilities 16 Device Capability descriptor
kDescriptorTypeEndpoint 5 Endpoint descriptor.
kDescriptorTypeHID &h21 HID descriptor.
kDescriptorTypeHub &h29 Hub descriptor.
kDescriptorTypeInterface 4 Interface descriptor.
kDescriptorTypePhysical &h23 Physical descriptor.
kDescriptorTypeReport &h22 HID report descriptor.
kDescriptorTypeString 3 String descriptor.
kDescriptorTypeSuperSpeedEndpointCompanion &h30 SuperSpeed Endpoint Companion descriptor
kDescriptorTypeSuperSpeedHub &h2A SuperSpeed Hub descriptor

Errors

Constant Value Description
kErrorAccess -3 Access
kErrorBusy -6 Busy
kErrorInterrupted -10 Interrupted
kErrorInvalidParam -2 Invalid parameter
kErrorIO -1 I/O Error
kErrorNoDevice -4 No device.
kErrorNoMemory -11 Out of Memory
kErrorNotFound -5 Not found
kErrorNotSupported -12 Function not supported
kErrorOther -99 Other errors
kErrorOverflow -8 Overflow
kErrorPipe -9 Pipe
kErrorTimeout -7 Timeout

Log Levels

Constant Value Description
kLogLevelDebug 4 debug and informational messages are printed to stdout, warnings and errors to stderr
kLogLevelError 1 error messages are printed to stderr
kLogLevelInfo 3 informational messages are printed to stdout, warning and error messages are printed to stderr
kLogLevelNone 0 no messages ever printed by the library (default)
kLogLevelWarning 2 warning and error messages are printed to stderr

Speed Levels

Constant Value Description
kSpeedFull 2 The device is operating at full speed (12MBit/s).
kSpeedHigh 3 The device is operating at high speed (480MBit/s).
kSpeedLow 1 The device is operating at low speed (1.5MBit/s).
kSpeedSuper 4 The device is operating at super speed (5000MBit/s).
kSpeedUnknown 0 The OS doesn't report or know the device speed.

This class has no sub classes.

Some methods using this class:

Some properties using for this class:

Some examples using this class:

Blog Entries

Videos

Release notes

  • Version 18.1
    • Added LibUSBDeviceMBS and related classes to use LibUSB for cross platform USB functions.

The items on this page are in the following plugins: MBS USB Plugin.


LibUSBDeviceDescriptorMBS   -   LibUSBEndpointDescriptorMBS


The biggest plugin in space...