Platforms to show: All Mac Windows Linux Cross-Platform
Back to LibUSBDeviceMBS class.
LibUSBDeviceMBS.GetActiveConfigDescriptor as LibUSBConfigDescriptorMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
This is a non-blocking function which does not involve any requests being sent to the device.
Lasterror is set to:
0 on success
kErrorNotFound if the device is in unconfigured state
another error code on error.
LibUSBDeviceMBS.GetConfigDescriptor(Index as Integer) as LibUSBConfigDescriptorMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
This is a non-blocking function which does not involve any requests being sent to the device.
Parameters:
Index: the index of the configuration you wish to retrieve
Lasterror is set to:
0 on success
kErrorNotFound if the configuration does not exist
another error code on error
Some examples using this method:
LibUSBDeviceMBS.GetConfigDescriptorByValue(Value as Integer) as LibUSBConfigDescriptorMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
This is a non-blocking function which does not involve any requests being sent to the device.
Value: the bConfigurationValue of the configuration you wish to retrieve.
Lasterror is set to:
0 on success
kErrorNotFound if the configuration does not exist
another error code on error
LibUSBDeviceMBS.GetConfiguration as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
You could formulate your own control request to obtain this information, but this function has the advantage that it may be able to retrieve the information from operating system caches (no I/O involved).
If the OS does not cache this information, then this function will block while a control transfer is submitted to retrieve the information.
This function will return a value of 0 in the config output parameter if the device is in unconfigured state.
Returns Configuration value of the active configuration (only valid for return code 0)
The lasterror is set to:
0 on success
kErrorNoDevice if the device has been disconnected
another error code on other failure
LibUSBDeviceMBS.GetDescriptor(descType as Integer, descIndex as Integer, data as Ptr, Length as Integer) as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
This is a convenience function which formulates the appropriate control message to retrieve the descriptor.
Parameters:
| descType | the descriptor type, see libusb_descriptor_type |
| descIndex | the index of the descriptor to retrieve |
| data | output buffer for descriptor |
| length | size of data buffer |
Returns number of bytes returned in data or zero.
Sets lasterror to error code on failure
LibUSBDeviceMBS.GetDeviceDescriptor as LibUSBDeviceDescriptorMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
This is a non-blocking function; the device descriptor is cached in memory.
Returns 0 on success or a error code on failure.
Some examples using this method:
LibUSBDeviceMBS.GetMaxISOPacketSize(EndPoint as Integer) as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
Only the active configution is examined. The calculation is based on the wMaxPacketSize field in the endpoint descriptor as described in section 9.6.6 in the USB 2.0 specifications.
If acting on an isochronous or interrupt endpoint, this function will multiply the value found in bits 0:10 by the number of transactions per microframe (determined by bits 11:12). Otherwise, this function just returns the numeric value found in bits 0:10.
This function is useful for setting up isochronous transfers, for example you might pass the return value from this function to libusb_set_iso_packet_lengths() in order to set the length field of every isochronous packet in a transfer.
Since v1.0.3.
Parameters:
endpoint: address of the endpoint in question
Returns the maximum packet size which can be sent/received on this endpoint.
The lasterror is set to:
0 for success.
kErrorNotFound if the endpoint does not exist
kErrorOther on other failure
LibUSBDeviceMBS.GetMaxPacketSize(EndPoint as Integer) as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
This function was originally intended to be of assistance when setting up isochronous transfers, but a design mistake resulted in this function instead. It simply returns the wMaxPacketSize value without considering its contents. If you're dealing with isochronous transfers, you probably want libusb_get_max_iso_packet_size() instead.
Parameters:
endpoint: address of the endpoint in question
Returns the Max Packet Size value.
The lasterror is set:
0 for success.
kErrorNotFound if the endpoint does not exist
kErrorOther on other failure
LibUSBDeviceMBS.GetStringDescriptor(descIndex as Integer, LangID as Integer = 0) as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
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.
Parameters:
| descIndex | the index of the descriptor to retrieve |
| LangID | the language ID for the string descriptor |
Returns string.
Lasterror is set to zero or error code on failure.
See also:
Some examples using this method:
LibUSBDeviceMBS.GetStringDescriptor(descIndex as Integer, LangID as Integer = 0, data as Ptr, Length as Integer) as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
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.
Parameters:
| descIndex | the index of the descriptor to retrieve |
| LangID | the language ID for the string descriptor |
| data | output buffer for descriptor |
| length | size of data buffer |
Returns number of bytes returned in data.
Lasterror is set to zero or error code on failure.
See also:
LibUSBDeviceMBS.GetStringDescriptorAscii(descIndex as Integer) as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
Wrapper around GetStringDescriptor(). Uses the first language supported by the device.
descIndex: the index of the descriptor to retrieve
Returns string.
Lasterror is set to error code on failure and zero on success.
See also:
Some examples using this method:
LibUSBDeviceMBS.GetStringDescriptorAscii(descIndex as Integer, data as Ptr, Length as Integer) as Integer
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | USB | MBS USB Plugin | 18.1 | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | Desktop, Console & Web |
Wrapper around GetStringDescriptor(). Uses the first language supported by the device.
Parameters:
| descIndex | the index of the descriptor to retrieve |
| data | output buffer for ASCII string descriptor |
| length | size of data buffer |
Returns number of bytes returned in data.
Lasterror is set to error code on failure and zero on success.
See also:
The items on this page are in the following plugins: MBS USB Plugin.