Port Entity

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 Enable/Disable (Get/Set)

port [index] . getEnabled <= (unsigned char) enabled
port [index] . setEnabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over an entire port for a provided index (Power, Data, CC and Vconn). Values either passed in or returned are treated as boolean values.

Power Enable/Disable (Get/Set)

port [index] . getPowerEnabled <= (unsigned char) enabled
port [index] . setPowerEnabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the power for a provided index (Vbus). Values either passed in or returned are treated as boolean values.

Data Enable/Disable (Get/Set)

port [index] . getDataEnabled <= (unsigned char) enabled
port [index] . setDataEnabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the data lines for a provided index (High Speed (HS) and Super Speed (SS)). Values either passed in or returned are treated as boolean values.

High Speed (HS) Data Enable/Disable (Get/Set)

port [index] . getDataHSEnabled <= (unsigned char) enabled
port [index] . setDataHSEnabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the High Speed (HS) data lines for a provided index (HS1 and HS2). Values either passed in or returned are treated as boolean values.

High Speed 1 (HS1) Data Enable/Disable (Get/Set)

port [index] . getDataHS1Enabled <= (unsigned char) enabled
port [index] . setDataHS1Enabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the High Speed 1 (HS1) data lines for a provided index. Values either passed in or returned are treated as boolean values.

High Speed 2 (HS2) Data Enable/Disable (Get/Set)

port [index] . getDataHS2Enabled <= (unsigned char) enabled
port [index] . setDataHS2Enabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the High Speed 2 (HS2) data lines for a provided index. Values either passed in or returned are treated as boolean values.

Super Speed (SS) Data Enable/Disable (Get/Set)

port [index] . getDataSSEnabled <= (unsigned char) enabled
port [index] . setDataSSEnabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the Super Speed (SS) data lines for a provided index (SS1 and SS2). Values either passed in or returned are treated as boolean values.

Super Speed 1 (SS1) Data Enable/Disable (Get/Set)

port [index] . getDataSS1Enabled <= (unsigned char) enabled
port [index] . setDataSS1Enabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the Super Speed 1 (SS1) data lines for a provided index. Values either passed in or returned are treated as boolean values.

Super Speed 2 (SS2) Data Enable/Disable (Get/Set)

port [index] . getDataSS2Enabled <= (unsigned char) enabled
port [index] . setDataSS2Enabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the Super Speed 2 (SS2) data lines for a provided index. Values either passed in or returned are treated as boolean values.

Vconn Enable/Disable (Get/Set)

port [index] . getVconnEnabled <= (unsigned char) enabled
port [index] . setVconnEnabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the Vconn lines for a provided index (Vconn1 and Vconn2 (only one ever exists)). Values either passed in or returned are treated as boolean values.

Vconn 1 Enable/Disable (Get/Set)

port [index] . getVconn1Enabled <= (unsigned char) enabled
port [index] . setVconn1Enabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the Vconn 1 lines for a provided index. Values either passed in or returned are treated as boolean values.

Vconn 2 Enable/Disable (Get/Set)

port [index] . getVconn2Enabled <= (unsigned char) enabled
port [index] . setVconn2Enabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the Vconn 2 lines for a provided index. Values either passed in or returned are treated as boolean values.

CC Enable/Disable (Get/Set)

port [index] . getCCEnabled <= (unsigned char) enabled
port [index] . setCCEnabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the CC lines for a provided index (CC1 and CC2). Values either passed in or returned are treated as boolean values.

CC 1 Enable/Disable (Get/Set)

port [index] . getCC1Enabled <= (unsigned char) enabled
port [index] . setCC1Enabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the CC 1 lines for a provided index. Values either passed in or returned are treated as boolean values.

CC 2 Enable/Disable (Get/Set)

port [index] . getCC2Enabled <= (unsigned char) enabled
port [index] . setCC2Enabled => (unsigned char) enabled

Provides control (Set) and monitoring (Get) over the CC 2 lines for a provided index. Values either passed in or returned are treated as boolean values.

Vbus Voltage/Current (Get)

port [index] . getVbusVoltage <= (unsigned int) microvolts
port [index] . getVbusCurrent <= (unsigned int) microamps

Provides access to the last read values of Voltage (in microvolts) and Current (in microamps) for the Vbus lines.

Vconn Voltage/Current (Get)

port [index] . getVconnVoltage <= (unsigned int) microvolts
port [index] . getVconnCurrent <= (unsigned int) microamps

Provides access to the last read values of Voltage (in microvolts) and Current (in microamps) for the Vconn lines.

Vbus Accumulated Power (Get/Reset)

port [index] . getVbusAccumulatedPower <= (unsigned int) milliwatthours
port [index] . resetVbusAccumulatedPower => (void)

Returns the accumulated power (energy) sank or sourced by the Vbus line for the given port in units of milliWatt-hours.

Vconn Accumulated Power (Get/Reset)

port [index] . getVconnAccumulatedPower <= (unsigned int) milliwatthours
port [index] . resetVconnAccumulatedPower => (void)

Returns the accumulated power (energy) sank or sourced by the Vconn line for the given port in units of milliWatt-hours.

Port Name (Get/Set)

port [index] . getName <= (unsigned char[]) name
port [index] . setName => (unsigned char[]) name

Allows for setting a friendly name to the port with a 32 character limit.

Downstream Data Speed (Get)

port [index] . getDataSpeed <= (unsigned int)

Gets the speed of the enumerated device.

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

Allocated Power (Get)

port[index] . getAllocatedPower <= (unsigned int) milliwatts

Returns the currently allocated power for the port in milliwatts. This represents the power that has been allocated to this port from the available power budget.

Available Power (Get)

port[index] . getAvailablePower <= (unsigned int) milliwatts

Returns the available power for the port in milliwatts. This represents the power that is available for allocation to this port.

CC1/CC2 Accumulated Power (Get/Set)

port[index] . getCC[1|2]AccumulatedPower <= (unsigned int) milliwatt_hours
port[index] . setCC[1|2]AccumulatedPower => (unsigned int) milliwatt_hours

Returns or sets the accumulated power consumption for the CC1/CC2 line in milliwatt-hours. This tracks the total energy consumed over time.

CC1/CC2 Current (Get)

port[index] . getCC[1|2]Current <= (unsigned int) microamps

Returns the current flowing through the CC1/CC2 line in microamps. This is used for USB-C power delivery monitoring.

CC1/CC2 State (Get)

port[index] . getCC[1|2]State <= (unsigned int) state

Returns the current state of the CC1/CC2 line. The state is a 2-byte value where the upper byte represents the remote device state (device on the other end of the cable) and the lower byte represents the local hub state.

CC State Values

Value

Name

Description

0

None

No connection or state

1

Invalid

Invalid or error state

2

RpDefault

Default pull-up resistor (500/900/1500mA)

3

Rp1p5

1.5 Amp pull-up resistor

4

Rp3p0

3.0 Amp pull-up resistor

5

Rd

Pull-down resistor (sink device)

6

Ra

Audio accessory resistor

7

Managed

Managed by firmware

8

Unknown

Unknown state

CC1/CC2 Voltage (Get)

port[index] . getCC[1|2]Voltage <= (unsigned int) microvolts

Returns the voltage on the CC1/CC2 line in microvolts. This is used for USB-C power delivery monitoring.

CC Current Limit (Get/Set)

port[index] . getCCCurrentLimit <= (unsigned char) limit
port[index] . setCCCurrentLimit => (unsigned char) limit

Returns or sets the current limit enumeration for the CC lines. This sets the maximum current value that will be advertised for power delivery negotiation.

CC Current Limit Options

Value

Name

Description

0

None

No current limit

1

Default

Default current limit (500/900mA)

2

1p5

1.5 Amp current limit

3

3p0

3.0 Amp current limit

Current Limit Mode (Get/Set)

port[index] . getCurrentLimitMode <= (unsigned char) mode
port[index] . setCurrentLimitMode => (unsigned char) mode

Returns or sets the current limit mode for the port. This controls how the current limit is applied and enforced.

Data HS Routing Behavior (Get/Set)

port[index] . getDataHSRoutingBehavior <= (unsigned char) behavior
port[index] . setDataHSRoutingBehavior => (unsigned char) behavior

Returns or sets the high-speed data routing behavior for the port. This controls how high-speed data signals are routed through the port.

Data HS Routing Behavior Options

Value

Name

Description

0

FollowCC

Auto follow CC line routing

1

Side1

Route to side 1 only

2

Side2

Route to side 2 only

3

Shorted

Route to both sides (shorted)

Data Role (Get)

port[index] . getDataRole <= (unsigned char) role

Returns the current data role of the port. This indicates whether the port is acting as a host or device for data communication.

Data SS Routing Behavior (Get/Set)

port[index] . getDataSSRoutingBehavior <= (unsigned char) behavior
port[index] . setDataSSRoutingBehavior => (unsigned char) behavior

Returns or sets the super-speed data routing behavior for the port. This controls how super-speed data signals are routed through the port.

Data SS Routing Behavior Options

Value

Name

Description

0

FollowCC

Auto follow CC line routing

1

Side1

Route to side 1 only

2

Side2

Route to side 2 only

Port Errors (Get)

port[index] . getErrors <= (unsigned int) errors

Returns the current error status for the port. The error value is a bitfield indicating various port-related error conditions.

HS Boost (Get/Set)

port[index] . getHSBoost <= (unsigned char) boost
port[index] . setHSBoost => (unsigned char) boost

Returns or sets the high-speed boost setting for the port. This controls signal amplification for high-speed data transmission.

Port Mode (Get/Set)

port[index] . getMode <= (unsigned int) mode
port[index] . setMode => (unsigned int) mode

Returns or sets the operating mode for the port. The mode is a bitfield that controls various port behaviors and capabilities.

Power Limit Mode (Get/Set)

port[index] . getPowerLimitMode <= (unsigned char) mode
port[index] . setPowerLimitMode => (unsigned char) mode

Returns or sets the power limit mode for the port. This controls how the power limit is applied and enforced.

Power Mode (Get/Set)

port[index] . getPowerMode <= (unsigned char) mode
port[index] . setPowerMode => (unsigned char) mode

Returns or sets the power mode for the port. This controls the power delivery behavior and capabilities.

SBU1 Voltage (Get)

port[index] . getSBU1Voltage <= (unsigned int) microvolts

Returns the voltage on the SBU1 line in microvolts. SBU (Sideband Use) lines are used for alternate modes in USB-C.

SBU2 Voltage (Get)

port[index] . getSBU2Voltage <= (unsigned int) microvolts

Returns the voltage on the SBU2 line in microvolts. SBU (Sideband Use) lines are used for alternate modes in USB-C.

Port State (Get)

port[index] . getState <= (unsigned int) state

Returns the current state of the port. The state is a bitfield indicating the status of various port components and features.

Voltage Setpoint (Get/Set)

port[index] . getVoltageSetpoint <= (unsigned int) millivolts
port[index] . setVoltageSetpoint => (unsigned int) millivolts

Returns or sets the voltage setpoint for the port in millivolts. This controls the target voltage for the port’s power output.

Vbus Accumulated Power (Set)

port[index] . setVbusAccumulatedPower => (unsigned int) milliwatt_hours

Sets the accumulated power consumption for the Vbus line in milliwatt-hours. This is used to reset or initialize the power tracking.

Vconn Accumulated Power (Set)

port[index] . setVconnAccumulatedPower => (unsigned int) milliwatt_hours

Sets the accumulated power consumption for the Vconn line in milliwatt-hours. This is used to reset or initialize the power tracking.