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
Get the USB configuration descriptor for the currently active configuration.

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
Get a USB configuration descriptor based on its index.

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
Get a USB configuration descriptor with a specific ConfigurationValue.

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
Determine the bConfigurationValue of the currently active configuration.

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
Retrieve a descriptor from the default control pipe.

This is a convenience function which formulates the appropriate control message to retrieve the descriptor.

Parameters:
descTypethe descriptor type, see libusb_descriptor_type
descIndexthe index of the descriptor to retrieve
dataoutput buffer for descriptor
lengthsize 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
Get the USB device descriptor for a given device.

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
Calculate the maximum packet size which a specific endpoint is capable is sending or receiving in the duration of 1 microframe.

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
Convenience function to retrieve the wMaxPacketSize value for a particular endpoint in the active device configuration.

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
Retrieve a descriptor from a device.

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:
descIndexthe index of the descriptor to retrieve
LangIDthe 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
Retrieve a descriptor from a device.

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:
descIndexthe index of the descriptor to retrieve
LangIDthe language ID for the string descriptor
dataoutput buffer for descriptor
lengthsize 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
Retrieve a string descriptor in ASCII.

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
Retrieve a string descriptor in ASCII.

Wrapper around GetStringDescriptor(). Uses the first language supported by the device.

Parameters:
descIndexthe index of the descriptor to retrieve
dataoutput buffer for ASCII string descriptor
lengthsize 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.


The biggest plugin in space...