Port

class brainstem.entity.Port(module, index)[source]

Port Class: The Port Entity provides software control over the most basic items related to a USB Port. This includes everything from the complete enable and disable of the entire port to the individual control of specific pins. Voltage and Current measurements are also included for devices which support the Port Entity.

getAllocatedPower()[source]

Gets the currently allocated power This value is determined by the power manager which is responsible for budgeting the systems available power envelope. Variable to be filled with the allocated power in milli-watts (mW).

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getAvailablePower()[source]

Gets the current available power. This value is determined by the power manager which is responsible for budgeting the systems available power envelope. Variable to be filled with the available power in milli-watts (mW).

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getCC1Enabled()[source]

Gets the current enable value of the CC1 lines. Sub-component of getCCEnabled. 1 = CC1 enabled; 0 = CC1 disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getCC1State()[source]

Gets the current CC1 Strapping on local and remote The state is a bit packed value where the upper byte is used to represent the remote or partner device attached to the ports resistance and the lower byte is used to represent the local or hubs resistance. Variable to be filled with an packed enumerated representation of the CC state. Enumeration values for each byte are as follows: - None = 0 = portCC1State_None - Invalid = 1 = portCC1State_Invalid - Rp (default) = 2 = portCC1State_RpDefault - Rp (1.5A) = 3 = portCC1State_Rp1p5 - Rp (3A) = 4 = portCC1State_Rp3p0 - Rd = 5 = portCC1State_Rd - Ra = 6 = portCC1State_Ra - Managed by controller = 7 = portCC1State_Managed - Unknown = 8 = portCC1State_Unknown

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getCC2Enabled()[source]

Gets the current enable value of the CC2 lines. Sub-component of getCCEnabled. 1 = CC2 enabled; 0 = CC2 disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getCC2State()[source]

Gets the current CC2 Strapping on local and remote The state is a bit packed value where the upper byte is used to represent the remote or partner device attached to the ports resistance and the lower byte is used to represent the local or hubs resistance. Variable to be filled with an packed enumerated representation of the CC state. Enumeration values for each byte are as follows: - None = 0 = portCC2State_None - Invalid = 1 = portCC2State_Invalid - Rp (default) = 2 = portCC2State_RpDefault - Rp (1.5A) = 3 = portCC2State_Rp1p5 - Rp (3A) = 4 = portCC2State_Rp3p0 - Rd = 5 = portCC2State_Rd - Ra = 6 = portCC2State_Ra - Managed by controller = 7 = portCC2State_Managed - Unknown = 8 = portCC2State_Unknown

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getCCCurrentLimit()[source]

Gets the CC Current Limit Resistance The CC Current limit is the value that’s set for the pull up resistance on the CC lines for basic USB-C negotations. Variable to be filled with an enumerated representation of the CC Current limit. 0 = None, 1 = Default (500/900mA), 2 = 1.5A, and 3 = 3.0A

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getCCEnabled()[source]

Gets the current enable value of the CC lines.: Sub-component (CC) of getEnabled. 1 = CC enabled; 0 = CC disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getCurrentLimit()[source]

Gets the current limit of the port. Variable to be filled with the limit in microAmps (uA).

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getCurrentLimitMode()[source]

Gets the current limit mode. The mode determines how the port will react to an over current condition. Variable to be filled with an enumerated representation of the current limit mode. Available modes are product specific. See the reference documentation.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getDataEnabled()[source]

Gets the current enable value of the data lines.: Sub-component (Data) of getEnabled. 1 = Data enabled; 0 = Data disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getDataHS1Enabled()[source]

Gets the current enable value of the High Speed A side (HSA) data lines.: Sub-component of getDataHSEnabled. 1 = Data enabled; 0 = Data disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getDataHS2Enabled()[source]

Gets the current enable value of the High Speed B side (HSB) data lines.: Sub-component of getDataHSEnabled. 1 = Data enabled; 0 = Data disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getDataHSEnabled()[source]

Gets the current enable value of the High Speed (HS) data lines. Sub-component of getDataEnabled. 1 = Data enabled; 0 = Data disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getDataHSRoutingBehavior()[source]

Gets the HighSpeed Data Routing Behavior. The mode determines how the port will route the data lines. Variable to be filled with an enumerated representation of the routing behavior. Available modes are product specific. See the reference documentation.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getDataRole()[source]

Gets the Port Data Role. The data role to be set. See datasheet for details.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getDataSS1Enabled()[source]

Gets the current enable value of the Super Speed A side (SSA) data lines.: Sub-component of getDataSSEnabled. 1 = Data enabled; 0 = Data disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getDataSS2Enabled()[source]

Gets the current enable value of the Super Speed B side (SSB) data lines.: Sub-component of getDataSSEnabled. 1 = Data enabled; 0 = Data disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getDataSSEnabled()[source]

Gets the current enable value of the Super Speed (SS) data lines. Sub-component of getDataEnabled. 1 = Data enabled; 0 = Data disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getDataSSRoutingBehavior()[source]

Gets the SuperSpeed Data Routing Behavior. The mode determines how the port will route the data lines. Variable to be filled with an enumerated representation of the routing behavior. Available modes are product specific. See the reference documentation.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getDataSpeed()[source]

Gets the speed of the enumerated device. Bit mapped value representing the devices speed. See “Devices” reference for details.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getEnabled()[source]

Gets the current enable value of the port. 1 = Fully enabled port; 0 = One or more disabled components.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getErrors()[source]

Returns any errors that are present on the port. Calling this function will clear the current errors. If the error persists it will be set again. Bit mapped field representing the current errors of the ports

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getHSBoost()[source]

Gets the ports USB 2.0 High Speed Boost Settings The setting determines how much additional drive the USB 2.0 signal will have in High Speed mode. An enumerated representation of the boost range. Available modes are product specific. See the reference documentation.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getMode()[source]

Gets current mode of the port Bit mapped value representing the ports mode. See “Devices” reference for details.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getName(buffer_length=65536)[source]

Gets a user defined name of the port. Helpful for identifying ports/devices in a static environment. Length that was actually received and filled.

Parameters:

buffer_length – Length of the buffer to be filed

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getPowerEnabled()[source]

Gets the current enable value of the power lines.: Sub-component (Power) of getEnabled. 1 = Power enabled; 0 = Power disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getPowerLimit()[source]

Gets the user defined power limit for the port. Variable to be filled with the power limit in milli-watts (mW).

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getPowerLimitMode()[source]

Gets the power limit mode. The mode determines how the port will react to an over power condition. Variable to be filled with an enumerated representation of the power limit mode. Available modes are product specific. See the reference documentation.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getPowerMode()[source]

Gets the Port Power Mode: Convenience Function of get/setPortMode The current power mode.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getState()[source]

A bit mapped representation of the current state of the port. Reflects what he port IS which may differ from what was requested. Variable to be filled with the current state.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getVbusAccumulatedPower()[source]

Gets the Vbus Accumulated Power The accumuled power on Vbus in milliwatt-hours.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getVbusCurrent()[source]

Gets the Vbus Current The current in microamps (1 == 1e-6A) currently present on Vbus.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getVbusVoltage()[source]

Gets the Vbus Voltage The voltage in microvolts (1 == 1e-6V) currently present on Vbus.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getVconn1Enabled()[source]

Gets the current enable value of the Vconn1 lines. Sub-component of getVconnEnabled. 1 = Vconn1 enabled; 0 = Vconn1 disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getVconn2Enabled()[source]

Gets the current enable value of the Vconn2 lines. Sub-component of getVconnEnabled. 1 = Vconn2 enabled; 0 = Vconn2 disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getVconnAccumulatedPower()[source]

Gets the Vconn Accumulated Power The accumuled power on Vconn in milliwatt-hours.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getVconnCurrent()[source]

Gets the Vconn Current The current in microamps (1 == 1e-6A) currently present on Vconn.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getVconnEnabled()[source]

Gets the current enable value of the Vconn lines.: Sub-component (Vconn) of getEnabled. 1 = Vconn enabled; 0 = Vconn disabled.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getVconnVoltage()[source]

Gets the Vconn Voltage The voltage in microvolts (1 == 1e-6V) currently present on Vconn.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

getVoltageSetpoint()[source]

Gets the current voltage setpoint value for the port. the voltage setpoint of the port in uV.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

resetEntityToFactoryDefaults()[source]

Resets the PortClass Entity to it factory default configuration.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

resetVbusAccumulatedPower()[source]

Resets the Vbus Accumulated Power to zero.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

resetVconnAccumulatedPower()[source]

Resets the Vconn Accumulated Power to zero.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setCC1Enabled(enable)[source]

Enables or disables the CC1 lines. Sub-component of setCCEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable CC1 lines; 0 = Disable CC1 lines.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setCC2Enabled(enable)[source]

Enables or disables the CC2 lines. Sub-component of setCCEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable CC2 lines; 0 = Disable CC2 lines.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setCCCurrentLimit(value)[source]

Sets the CC Current Limit Resistance The CC Current limit is the value that’s set for the pull up resistance on the CC lines for basic USB-C negotations.

Parameters:

value (const unsigned char) – Variable to be filled with an enumerated representation of the CC Current limit. 0 = None, 1 = Default (500/900mA), 2 = 1.5A, and 3 = 3.0A

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setCCEnabled(enable)[source]

Enables or disables the CC lines. Sub-component (CC) of setEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable CC lines; 0 = Disable CC lines.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setCurrentLimit(limit)[source]

Sets the current limit of the port.

Parameters:

limit (const unsigned int) – Current limit to be applied in microAmps (uA).

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setCurrentLimitMode(mode)[source]

Sets the current limit mode. The mode determines how the port will react to an over current condition.

Parameters:

mode (const unsigned char) – An enumerated representation of the current limit mode. Available modes are product specific. See the reference documentation.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setDataEnabled(enable)[source]

Enables or disables the data lines. Sub-component (Data) of setEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable data; 0 = Disable data.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setDataHS1Enabled(enable)[source]

Enables or disables the Hight Speed A side (HSA) data lines. Sub-component of setDataHSEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable data; 0 = Disable data.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setDataHS2Enabled(enable)[source]

Enables or disables the Hight Speed B side (HSB) data lines. Sub-component of setDataHSEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable data; 0 = Disable data.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setDataHSEnabled(enable)[source]

Enables or disables the High Speed (HS) data lines. Sub-component of setDataEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable data; 0 = Disable data.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setDataHSRoutingBehavior(mode)[source]

Sets the HighSpeed Data Routing Behavior. The mode determines how the port will route the data lines.

Parameters:

mode (const unsigned char) – An enumerated representation of the routing behavior. Available modes are product specific. See the reference documentation.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setDataSS1Enabled(enable)[source]

Enables or disables the Super Speed (SS) data lines. Sub-component of setDataEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable data; 0 = Disable data.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setDataSS2Enabled(enable)[source]

Enables or disables the Super Speed B side (SSB) data lines. Sub-component of setDataSSEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable data; 0 = Disable data.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setDataSSEnabled(enable)[source]

Enables or disables the Super Speed (SS) data lines. Sub-component of setDataEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable data; 0 = Disable data.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setDataSSRoutingBehavior(mode)[source]

Sets the SuperSpeed Data Routing Behavior. The mode determines how the port will route the data lines.

Parameters:

mode (const unsigned char) – An enumerated representation of the routing behavior. Available modes are product specific. See the reference documentation.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setEnabled(enable)[source]

Enables or disables the entire port.

Parameters:

enable (const unsigned char) – 1 = Fully enable port; 0 = Fully disable port.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setHSBoost(boost)[source]

Sets the ports USB 2.0 High Speed Boost Settings The setting determines how much additional drive the USB 2.0 signal will have in High Speed mode.

Parameters:

boost (const unsigned char) – An enumerated representation of the boost range. Available value are product specific. See the reference documentation.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setMode(mode)[source]

Sets the mode of the port

Parameters:

mode (const unsigned int) – Port mode to be set. See “Devices” documentation for details.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setName(buffer)[source]

Sets a user defined name of the port. Helpful for identifying ports/devices in a static environment.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setPowerEnabled(enable)[source]

Enables or Disables the power lines. Sub-component (Power) of setEnable.

Parameters:

enable (const unsigned char) – 1 = Enable power; 0 = Disable disable.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setPowerLimit(limit)[source]

Sets a user defined power limit for the port.

Parameters:

limit (const unsigned int) – Power limit to be applied in milli-watts (mW).

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setPowerLimitMode(mode)[source]

Sets the power limit mode. The mode determines how the port will react to an over power condition.

Parameters:

mode (const unsigned char) – An enumerated representation of the power limit mode to be applied Available modes are product specific. See the reference documentation.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setPowerMode(powerMode)[source]

Sets the Port Power Mode: Convenience Function of get/setPortMode

Parameters:

powerMode (const unsigned char) – The power mode to be set.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setVconn1Enabled(enable)[source]

Enables or disables the Vconn1 lines. Sub-component of setVconnEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable Vconn1 lines; 0 = Disable Vconn1 lines.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setVconn2Enabled(enable)[source]

Enables or disables the Vconn2 lines. Sub-component of setVconnEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable Vconn2 lines; 0 = Disable Vconn2 lines.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setVconnEnabled(enable)[source]

Enables or disables the Vconn lines. Sub-component (Vconn) of setEnabled.

Parameters:

enable (const unsigned char) – 1 = Enable Vconn lines; 0 = Disable Vconn lines.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte

setVoltageSetpoint(value)[source]

Sets the current voltage setpoint value for the port.

Parameters:

value (const unsigned int) – the voltage setpoint of the port in uV.

Returns:

An error result from the list of defined error codes in brainstem.result

Return type:

unsigned byte