Port

API Documentation: [cpp] [python] [.NET] [LabVIEW]

The Port Entity provides control over the most basic items related to a USB Port. This includes actions ranging from a complete port enable and disable to the individual interface control. Voltage and current measurements are also included for devices which support the Port Entity.


Port Control

The USBHub3p has a Port Entity for every port on the device; however, not all ports have the same capabilities. These ports can be referenced by their instance (port[x]) index.

Port Label

Index (port[x])

0

0

1

1

2

2

3

3

4

4

5

5

6

6

7

7

Down-A

8

Up0

9

Up1

10

Control

11

One of the most powerful features of the USBHub3p is its ability to turn ports on and off which is available on Ports 0-7.

stem.hub.port[x].setEnabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getEnabled() [cpp] [python] [NET] [LabVIEW]

Manipulating just the USB Vbus line for a single port can be done by calling the following method on Ports 0-7.

stem.hub.port[x].setPowerEnabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getPowerEnabled() [cpp] [python] [NET] [LabVIEW]

Manipulating Hi-Speed data and SuperSpeed data lines while not affecting the Vbus lines simultaneously for a single port can be done by calling the following method for Ports 0-7.

stem.hub.port[x].setDataEnabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getDataEnabled()[cpp] [python] [NET] [LabVIEW]

Manipulating just the USB 2.0 Hi-Speed data lines for a single port can be done by calling the following for Ports 0-7.

stem.hub.port[x].setDataHSEnabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getDataHSEnabled() [cpp] [python] [NET] [LabVIEW]

Manipulating just the USB 3.1 SuperSpeed data lines for a single port can be done by calling the following method for Ports 0-7.

stem.hub.port[x].setDataSSEnabled() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getDataSSEnabled() [cpp] [python] [NET] [LabVIEW]

Voltage and Current Measurements

The USBHub3p provides Voltage and Current measurements for Vbus. These values can be acquired for all 8 ports through the following APIs

stem.hub.port[x].getVbusVoltage() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getVbusCurrent() [cpp] [python] [NET] [LabVIEW]

Power Modes

The ports of the USBHub3p are capable of providing power in multiple formats. The default is Charging Downstream Port (CDP), but that can be changed to things like: Standard Downstream Port (SDP), Charging Downstream Port (CDP) / Dedicated Charging Port (DCP). These modes can be set through:

stem.hub.port[x].setPowerMode() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getPowerMode() [cpp] [python] [NET] [LabVIEW]

Power Mode

Value

Define

None

0

portPowerMode_none_Value

SDP

1

portPowerMode_sdp_Value

CDP/DCP

2

portPowerMode_cdp_dcp_Value

Note

The Power Modes can only be changed when the port power is disabled.

Port Mode

As outlined in the “Port Control” section the USBHub3p can individually manipulate almost every pin on the connector; however, depending on your application that might require multiple function calls in order to configure the port how you want it. Port Mode on the other hand is a one stop shop that allows you to pick and choose which lines you want enabled or disabled through a single call. Additionally, it has a few other features tucked away inside of it.

stem.hub.port[x].setMode() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getMode() [cpp] [python] [NET] [LabVIEW]

Port Mode Item

Bit

Value

Define

Power Enable

0

0/1

portPortMode_powerEnabled_Bit

HS 1 Enable

1

0/1

portPortMode_HS1Enabled_Bit

SS 1 Enable

3

0/1

portPortMode_SS1Enabled_Bit

Power Mode: Offset

16

portPortMode_portPowerMode_Offset

Power Mode: Mask

0x7

portPortMode_portPowerMode_Mask

Power Mode: None

16-18

0

portPortMode_portPowerMode_none_Value

Power Mode: SDP

16-18

1

portPortMode_portPowerMode_sdp_Value

Power Mode: CDP/DCP

16-18

2

portPortMode_cdp_dcp_Value

Data Role

The data role describes the current configuration of the port in regards to its data direction. In most cases this evaluates to an Upstream Facing Port (UFP) or a Downstream Facing Port (DFP). Upstream in this case means the host side of the port and Downstream refers to the device side. The Data Role can be aquired through:

stem.hub.port[x].getDataRole() [cpp] [python] [NET] [LabVIEW]

Data Role

Value

Define

Disabled

0

portDataRole_Disabled_Value

Upstream

1

portDataRole_Upstream_Value

Downstream

2

portDataRole_Downstream_Value

Control

3

portDataRole_Control_Value

Port Limits and Modes

At the Port level the user has the ability to define current limit.

stem.hub.port[x].setCurrentLimit() [cpp] [python] [NET] [LabVIEW]
stem.hub.port[x].getCurrentLimit() [cpp] [python] [NET] [LabVIEW]

Downstream Data Speed

The USBHub3p can detect if a device has been enumerated. Additionally, it can detect at what speed a device has enumerated at.

stem.hub.port[x].getDataSpeed() [cpp] [python] [NET] [LabVIEW]

Data Speed

Bit

Value

Define

1.5 Mbit/s

0

0/1

portDataSpeed_ls_1p5M_Bit

12 Mbit/s

1

0/1

portDataSpeed_fs_12M_Bit

480 Mbit/s

2

0/1

portDataSpeed_hs_480M_Bit

5 Gbit/s

3

0/1

portDataSpeed_ss_5G_Bit

10 Gbit/s

4

0/1

portDataSpeed_ss_10G_Bit

USB 2.0

6

0/1

portDataSpeed_Connected_2p0_Bit

USB 3.0

7

0/1

portDataSpeed_Connected_3p0_Bit