USB Entity

group USBEntity

The USB class provides methods to interact with a USB hub and USB switches. Different USB hub products have varying support; check the datasheet to understand the capabilities of each product.

void usb_setPortEnable(unsigned int *id, struct Result *result, int channel)

Enable both power and data lines for a port.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setPortDisable(unsigned int *id, struct Result *result, int channel)

Disable both power and data lines for a port.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setPowerEnable(unsigned int *id, struct Result *result, int channel)

Enable only the power line for a port without changing the state of the data lines.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the enable status or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setPowerDisable(unsigned int *id, struct Result *result, int channel)

Disable only the power line for a port without changing the state of the data lines.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setDataEnable(unsigned int *id, struct Result *result, int channel)

Enable the only the data lines for a port without changing the state of the power line.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the enable status or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setDataDisable(unsigned int *id, struct Result *result, int channel)

Disable only the data lines for a port without changing the state of the power line.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setHiSpeedDataEnable(unsigned int *id, struct Result *result, int channel)

Enable the only the data lines for a port without changing the state of the power line, Hi-Speed (2.0) only.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setHiSpeedDataDisable(unsigned int *id, struct Result *result, int channel)

Disable only the data lines for a port without changing the state of the power line, Hi-Speed (2.0) only.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setSuperSpeedDataEnable(unsigned int *id, struct Result *result, int channel)

Enable the only the data lines for a port without changing the state of the power line, SuperSpeed (3.0) only.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setSuperSpeedDataDisable(unsigned int *id, struct Result *result, int channel)

Disable only the data lines for a port without changing the state of the power line, SuperSpeed (3.0) only.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_getPortCurrent(unsigned int *id, struct Result *result, int channel)

Get the current through the power line for a port.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the port current in microamps (1 == 1e-6A) or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_getPortVoltage(unsigned int *id, struct Result *result, int channel)

Get the voltage on the power line for a port.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the port current in microvolts (1 == 1e-6VDC) or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_getHubMode(unsigned int *id, struct Result *result)

Get a bit mapped representation of the hubs mode; see the product datasheet for mode mapping and meaning.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the current mode or a non zero Error code.

void usb_setHubMode(unsigned int *id, struct Result *result, int mode)

Set a bit mapped hub state; see the product datasheet for state mapping and meaning.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • mode: The USB mode to be set.

void usb_clearPortErrorStatus(unsigned int *id, struct Result *result, int channel)

Clear the error status for the given port.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_getUpstreamMode(unsigned int *id, struct Result *result)

Get the upstream switch mode for the USB upstream ports.Returns usbUpstreamModeAuto (2, default) , usbUpstreamModePort0 (0) and usbUpstreamModePort1 (1)

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the upstream mode or a non zero Error code.

void usb_setUpstreamMode(unsigned int *id, struct Result *result, int mode)

Set the upstream switch mode for the USB upstream ports. Returns usbUpstreamModeAuto (2, default) , usbUpstreamModePort0 (0) and usbUpstreamModePort1 (1)

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • mode: The mode to be set.

void usb_getUpstreamState(unsigned int *id, struct Result *result)

Get the upstream switch state for the USB upstream ports. Returns usbUpstreamStateNone (2), usbUpstreamStatePort0 (0), usbUpstreamStatePort1 (1).

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the upstream state or a non zero Error code.

void usb_getEnumerationDelay(unsigned int *id, struct Result *result)

Get the inter-port enumeration delay in milliseconds This setting should be saved with a stem.system.save() call.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the enumeration delay in milliseconds or a non zero Error code.

void usb_setEnumerationDelay(unsigned int *id, struct Result *result, int delay)

Set the inter-port enumeration delay in milliseconds. This setting should be saved with a stem.system.save() call.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • delay: Millisecond delay in 100mS increments (100, 200, 300 etc.)

void usb_getPortCurrentLimit(unsigned int *id, struct Result *result, int channel)

Get the current limit for the port.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the port current limit in microams (1 == 1e-6A) or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setPortCurrentLimit(unsigned int *id, struct Result *result, int channel, int microamps)

Set the inter-port enumeration delay in milliseconds. This setting should be saved with a stem.system.save() call.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

  • microamps: The current limit in microamps to be set. (1 == 1e-6)

void usb_getPortMode(unsigned int *id, struct Result *result, int channel)

Get the current mode for the port. A bit mapped variable representing the ports mode. See your device datasheet for details as to the meaning and mapping of the values.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the current port mode or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setPortMode(unsigned int *id, struct Result *result, int channel, int mode)

Set the mode for the Port. A bit mapped variable representing the ports mode. See your device datasheet for details as to the meaning and mapping of the values.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

  • mode: Mode to be set.

void usb_getUpstreamBoostMode(unsigned int *id, struct Result *result)

Get the upstream boost mode.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the current upstream boost mode or a non zero Error code.

void usb_setUpstreamBoostMode(unsigned int *id, struct Result *result, int setting)

Set the upstream boost mode. Boost mode increases the drive strength of the USB data signals (power signals are not changed). Boosting the data signal strength may help to overcome connectivity issues when using long cables.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • setting: Boost mode setting to be applied.

void usb_getDownstreamBoostMode(unsigned int *id, struct Result *result)

Get the downstream boost mode.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the current downstream boost mode or a non zero Error code.

void usb_setDownstreamBoostMode(unsigned int *id, struct Result *result, int setting)

Set the downstream boost mode. Boost mode increases the drive strength of the USB data signals (power signals are not changed). Boosting the data signal strength may help to overcome connectivity issues when using long cables

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • setting: Boost mode setting to be applied.

void usb_getDownstreamDataSpeed(unsigned int *id, struct Result *result, int channel)

Get the current data transfer speed for the downstream port. The data speed can be Hi-Speed (2.0) or SuperSpeed (3.0) depending on what the downstream device attached is using. usbDownstreamDataSpeed_na (0), usbDownstreamDataSpeed_hs (1), usbDownstreamDataSpeed_hs (2)

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the current usb data speed. or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setConnectMode(unsigned int *id, struct Result *result, int channel, int mode)

Sets the connect mode of the switch.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

  • mode: Connect mode to be applied.

void usb_getConnectMode(unsigned int *id, struct Result *result, int channel)

Gets the connect mode of the switch.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the connection mode or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setCC1Enable(unsigned int *id, struct Result *result, int channel, int enable)

Set Enable/Disable on the CC1 line.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

  • enable: 0 = Disable; 1 = Enable

void usb_getCC1Enable(unsigned int *id, struct Result *result, int channel)

Get Enable/Disable on the CC1 line.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the state of the CC1 line or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setCC2Enable(unsigned int *id, struct Result *result, int channel, int enable)

Set Enable/Disable on the CC2 line.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

  • enable: 0 = Disable; 1 = Enable

void usb_getCC2Enable(unsigned int *id, struct Result *result, int channel)

Get Enable/Disable on the CC2 line.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the state of the CC2 line or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_getCC1Current(unsigned int *id, struct Result *result, int channel)

Get the current through the CC1 for a port.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the CC2 current in microamps (1 == 1e-6A) or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_getCC2Current(unsigned int *id, struct Result *result, int channel)

Get the current through the CC2 for a port.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the CC2 current in microamps (1 == 1e-6A) or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_getCC1Voltage(unsigned int *id, struct Result *result, int channel)

Get the voltage of CC1 for a port.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the CC2 voltage in microvolts (1 == 1e-6VDC) or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_getCC2Voltage(unsigned int *id, struct Result *result, int channel)

Get the voltage of CC2 for a port.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the CC2 voltage in microvolts (1 == 1e-6VDC) or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setSBUEnable(unsigned int *id, struct Result *result, int channel, int enable)

Enable/Disable only the SBU1/2 based on the configuration of the usbPortMode settings.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

  • enable: 0 = Disable; 1 = Enable

void usb_getSBUEnable(unsigned int *id, struct Result *result, int channel)

Get the Enable/Disable status of the SBU

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and SBU Enable/Disable status or a non zero Error code.

  • channel: The USB Entities channel/port number

void usb_setCableFlip(unsigned int *id, struct Result *result, int channel, int flip)

Set Cable flip. This will flip SBU, CC and SS data lines.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

  • flip: 0 = Disable (not-flipped); 1 = Enable (flipped)

void usb_getCableFlip(unsigned int *id, struct Result *result, int channel)

Get Cable flip setting. Get the Enable/Disable status of the SBU

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the flip status or a non zero Error code.

  • channel: The USB Entities channel/port number

void usb_getPortState(unsigned int *id, struct Result *result, int channel)

Get the state of the port. See datasheet for bit mapping and meaning.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and port state or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_getPortError(unsigned int *id, struct Result *result, int channel)

Get the current error for the Port. See datasheet for bit mapping and meaning.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the port error status or a non zero Error code.

  • channel: The USB Entities channel/port number.

void usb_setAltModeConfig(unsigned int *id, struct Result *result, int channel, int configuration)

Set USB Alt Mode Configuration.

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • channel: The USB Entities channel/port number.

  • configuration: The configuration to be set

void usb_getAltModeConfig(unsigned int *id, struct Result *result, int channel)

Get USB Alt Mode Configuration. Get the Enable/Disable status of the SBU

Parameters
  • id: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR and the mode configuration

  • channel: The USB Entities channel/port number. or a non zero Error code.