Platforms to show: All Mac Windows Linux Cross-Platform

Back to LibUSBDeviceMBS class.

LibUSBDeviceMBS.Devices as LibUSBDeviceMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Returns a list of USB devices currently attached to the system.

This is your entry point into finding a USB device to operate.

This return value of this function indicates the number of devices in the resultant list.

The number of devices in the outputted list.
Lasterror is set to zero on success or or any error codes according to errors encountered by the backend.

LibUSBDeviceMBS.ErrorName(ErrorCode as Integer) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Returns a constant string with the ASCII name of a libusb error code.

LibUSBDeviceMBS.HasCapability(Capability as UInt32) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Check at runtime if the loaded library has a given capability.

Returns true if the running library has the capability, false otherwise.

LibUSBDeviceMBS.Initialize as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Initialize libusb.

LibUSBDeviceMBS.LibraryLoaded as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Whether library is loaded.

LibUSBDeviceMBS.LibraryLoadErrorMessage as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
The last error message from loading library.

LibUSBDeviceMBS.LibVersion as LibUSBVersionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Queries version of library.

LibUSBDeviceMBS.LoadLibrary(file as folderitem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Loads the libusb library.

Returns true on success or false on failure.
The LibraryLoadErrorMessage function returns error message on failure.

See also:

LibUSBDeviceMBS.LoadLibrary(path as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Loads the libusb library.

Returns true on success or false on failure.
The LibraryLoadErrorMessage function returns error message on failure.

See also:

LibUSBDeviceMBS.OpenDevice(VID as Integer, PID as Integer) as LibUSBDeviceMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Convenience function for finding a device with a particular VID/PID combination.

This function is intended for those scenarios where you are using libusb to knock up a quick test application - it allows you to avoid calling libusb_get_device_list() and worrying about traversing/freeing the list.

This function has limitations and is hence not intended for use in real applications: if multiple devices have the same IDs it will only give you the first one, etc.

Parameters:
VIDthe idVendor value to search for
PIDthe idProduct value to search for

Returns:
a handle for the first found device, or NULL on error or if the device could not be found.

LibUSBDeviceMBS.SetDebug(level as integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Set message verbosity.

Level 0: no messages ever printed by the library (default)
Level 1: error messages are printed to stderr
Level 2: warning and error messages are printed to stderr
Level 3: informational messages are printed to stdout, warning and error messages are printed to stderr
The default level is 0, which means no messages are ever printed. If you choose to increase the message verbosity level, ensure that your application does not close the stdout/stderr file descriptors.

You are advised to set level 3. libusb is conservative with its message logging and most of the time, will only log messages that explain error conditions and other oddities. This will help you debug your software.

If the LIBUSB_DEBUG environment variable was set when libusb was initialized, this function does nothing: the message verbosity is fixed to the value in the environment variable.

If libusb was compiled without any message logging, this function does nothing: you'll never get any messages.
If libusb was compiled with verbose debug message logging, this function does nothing: you'll always get messages from all levels.

LibUSBDeviceMBS.Shutdown

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 18.1 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Deinitialize libusb.

Should be called after closing all open devices and before your application terminates.

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


The biggest plugin in space...