Platforms to show: All Mac Windows Linux Cross-Platform

Back to HIDAPIDeviceMBS class.

HIDAPIDeviceMBS.Enumerate(VendorID as Integer = 0, ProduceID as Integer = 0) as HIDAPIDeviceInfoMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Enumerate the HID Devices.

This function returns a linked list of all the HID devices attached to the system which match VendorID and ProduceID. If VendorID is set to 0 then any vendor matches. If ProduceID is set to 0 then any product matches. If VendorID and ProduceID are both set to 0, then all HID devices will be returned.

HIDAPIDeviceMBS.Init as Integer

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

This function initializes the HIDAPI library. Calling it is not strictly necessary, as it will be called automatically by Enumerate() and any of the Open*() functions if it is needed. This function should be called at the beginning of execution however, if there is a chance of HIDAPI handles being opened by different threads simultaneously.
This function returns 0 on success and -1 on error.

HIDAPIDeviceMBS.LoadError as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
The load error message.

HIDAPIDeviceMBS.LoadLibrary(File as FolderItem) as boolean

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

Returns true on success.
You can load a custom libhidapi.dylib (Mac), libhidapi.so (Linux) or libhidapi.dll (Windows).

But since MBS Plugin contains the code, you may not need to load a custom library.

See also:

HIDAPIDeviceMBS.LoadLibrary(Path as string) as boolean

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

Returns true on success.
You can load a custom libhidapi.dylib (Mac), libhidapi.so (Linux) or libhidapi.dll (Windows).

But since MBS Plugin contains the code, you may not need to load a custom library.

See also:

HIDAPIDeviceMBS.Open(VendorID as Integer, ProduceID as Integer, SerialNumber as String = "") as HIDAPIDeviceMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number.

If SerialNumber is "", the first device with the specified VID and PID is opened.
VendorID: The Vendor ID (VID) of the device to open.
ProduceID: The Product ID (PID) of the device to open.
SerialNumber: The Serial Number of the device to open (Optionally "").

This function returns a pointer to a HIDAPIDeviceMBS object on success or nil on failure.

HIDAPIDeviceMBS.OpenPath(path as string) as HIDAPIDeviceMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 16.0 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Open a HID device by its path name.

The path name be determined by calling Enumerate(), or a platform-specific path name can be used (eg: /dev/hidraw0 on Linux).
Path: The path name of the device to open
This function returns a pointer to a HIDAPIDeviceMBS object on success or nil on failure.

For macOS path must be one of:

  • in format 'DevSrvsID:<RegistryEntryID>' (as returned by Enumerate().
  • a valid path to an IOHIDDevice in the IOService plane (as returned by Path property in IORegistryMBS class, e.g.: "IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/EHC1@1D,7/AppleUSBEHCI/PLAYSTATION(R)3 Controller@fd120000/IOUSBInterface@0/IOUSBHIDDriver");

Second format is for compatibility with paths accepted by older versions of HIDAPI.

HIDAPIDeviceMBS.Shutdown as Integer

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

This function frees all of the static data associated with HIDAPI. It should be called at the end of execution to avoid memory leaks.
This function returns 0 on success and -1 on error.

HIDAPIDeviceMBS.VersionString as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method USB MBS USB Plugin 21.2 ✅ Yes ✅ Yes ✅ Yes ❌ No Desktop, Console & Web
Queries version number of the library.
Example
// shows 0.10.1
MsgBox HIDAPIDeviceMBS.VersionString

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


The biggest plugin in space...