Documentation
¶
Index ¶
- Constants
- Variables
- func BatteryChargePercent(ctx context.Context, servod components.Servod) (int32, error)
- func ChromeOSImageNameFromUSBDrive(ctx context.Context, usbPath string, run components.Runner, ...) (string, error)
- func GetBool(ctx context.Context, servod components.Servod, command string) (bool, error)
- func GetDouble(ctx context.Context, servod components.Servod, command string) (float64, error)
- func GetInt(ctx context.Context, servod components.Servod, command string) (int32, error)
- func GetString(ctx context.Context, servod components.Servod, command string) (string, error)
- func ResetServoV4p1EthernetController(ctx context.Context, servod components.Servod, log logger.Logger, ...) error
- func SaveUartStreamToFiles(ctx context.Context, servod components.Servod, dirPath string) error
- func ServoSupportsBuiltInPDControl(ctx context.Context, servod components.Servod) (bool, error)
- func ServodPdRoleCmd() string
- func ServodPdRoleValueSnk() string
- func ServodPdRoleValueSrc() string
- func SetEcUartCmd(ctx context.Context, servod components.Servod, value string, ...) error
- func SetPDRole(ctx context.Context, servod components.Servod, role PDRole) error
- func SetPowerState(ctx context.Context, servod components.Servod, val PowerStateValue) error
- func StartUartCapture(ctx context.Context, servod components.Servod) error
- func StopUartCapture(ctx context.Context, servod components.Servod) error
- func USBDrivePath(ctx context.Context, fileCheck bool, run components.Runner, ...) (string, tlw.HardwareState, error)
- func USBDriveReadable(ctx context.Context, usbPath string, run components.Runner, log logger.Logger) error
- func UpdateUSBVisibility(ctx context.Context, v USBVisible, servod components.Servod) error
- type PDRole
- type PowerStateValue
- type ServoType
- func (s *ServoType) ExtractComponents(onlyChild bool) []string
- func (s *ServoType) IsC2D2() bool
- func (s *ServoType) IsCCD() bool
- func (s *ServoType) IsCr50() bool
- func (s *ServoType) IsDualSetup() bool
- func (s *ServoType) IsGSC() bool
- func (s *ServoType) IsMainDeviceCCD() bool
- func (s *ServoType) IsMainDeviceGSC() bool
- func (s *ServoType) IsMicro() bool
- func (s *ServoType) IsMultipleServos() bool
- func (s *ServoType) IsV2() bool
- func (s *ServoType) IsV3() bool
- func (s *ServoType) IsV4() bool
- func (s *ServoType) IsV4p1() bool
- func (s *ServoType) MainDevice() string
- func (s *ServoType) String() string
- type USBVisible
Constants ¶
const ( // Servo components/types used by system. SERVO_V2 = "servo_v2" SERVO_V3 = "servo_v3" SERVO_V4 = "servo_v4" SERVO_V4P1 = "servo_v4p1" CCD_CR50 = "ccd_cr50" CCD_GSC = "ccd_gsc" C2D2 = "c2d2" SERVO_MICRO = "servo_micro" SWEETBERRY = "sweetberry" // Prefix for CCD components. CCD_PREFIX = "ccd_" )
Variables ¶
var ( PD_ON = PDRole{ServodPdRoleValueSrc()} PD_OFF = PDRole{ServodPdRoleValueSnk()} )
var ( // MAP of servos that connect to a debug header on the board. FLEX_SERVOS = map[string]bool{ C2D2: true, SERVO_MICRO: true, SERVO_V3: true, } // Map of servos that rely on gsc commands for some part of dut control. GSC_SERVOS = map[string]bool{ C2D2: true, CCD_GSC: true, CCD_CR50: true, } )
Functions ¶
func BatteryChargePercent ¶
BatteryChargePercent obtains the current battery charge percentage using servod controls, and returns the charge value or any error encountered while obtaining the value of servod control.
func ChromeOSImageNameFromUSBDrive ¶
func ChromeOSImageNameFromUSBDrive(ctx context.Context, usbPath string, run components.Runner, servod components.Servod, log logger.Logger) (string, error)
ChromeOSImageNameFromUSBDrive reads image name from USB-drive plugged to servo.
The version will be read from partition 3 of the ChromeOS image.
func GetBool ¶
GetBool retrieves from servod the value of servod command passed as an argument, and returns it as boolean.
func GetDouble ¶
GetDouble retrieves from servod the value of servod command passed as an argument, and returns it as 64-bit floating point value.
func GetInt ¶
GetInt retrieves from servod the value of servod command passed as an argument, and returns it as a 32-bit integer.
func GetString ¶
GetString retrieves from servod the value of servod command passed as an argument, and returns it as a string.
func ResetServoV4p1EthernetController ¶
func ResetServoV4p1EthernetController(ctx context.Context, servod components.Servod, log logger.Logger, timeout time.Duration) error
ResetServoV4p1EthernetController resets the ethernet controller to servo_v4p1 device.
The failures is hidden as off/on flow cannot be disturber and left device in middle stage.
func SaveUartStreamToFiles ¶
SaveUartStreamToFiles saves all available UART streams to files.
func ServoSupportsBuiltInPDControl ¶
ServoSupportsBuiltInPDControl checks whether or not the attached servo device supports power-deliver related servod controls.
This is applicable only with Servo V4 Type-C.
func ServodPdRoleCmd ¶
func ServodPdRoleCmd() string
func ServodPdRoleValueSnk ¶
func ServodPdRoleValueSnk() string
func ServodPdRoleValueSrc ¶
func ServodPdRoleValueSrc() string
func SetEcUartCmd ¶
func SetEcUartCmd(ctx context.Context, servod components.Servod, value string, waitTimeout time.Duration) error
SetEcUartCmd will set "ec_uart_cmd" to the specific value based on the passed in parameter. Before and after the set of the "ec_uart_cmd", it will toggle the value of "ec_uart_flush".
func SetPDRole ¶
SetPDRole sets the power-delivery role for servo to the passed role-value if the power-delivery control is supported by servod.
func SetPowerState ¶
func SetPowerState(ctx context.Context, servod components.Servod, val PowerStateValue) error
SetPowerState change the state of power_state control on servod.
Control implemented as call of the function by this reason it does not have getter.
func StartUartCapture ¶
func StartUartCapture(ctx context.Context, servod components.Servod) error
StartUartCapture sets all available UART capture to state 'on'.
func StopUartCapture ¶
func StopUartCapture(ctx context.Context, servod components.Servod) error
StopUartCapture sets all available UART capture to state 'off'.
func USBDrivePath ¶
func USBDrivePath(ctx context.Context, fileCheck bool, run components.Runner, servod components.Servod, log logger.Logger) (string, tlw.HardwareState, error)
USBDrivePath read usb-path from servod and check readability of the USB per request.
The logic cannot set state NORMAL as method doesn't contains audit logic.
func USBDriveReadable ¶
func USBDriveReadable(ctx context.Context, usbPath string, run components.Runner, log logger.Logger) error
USBDriveReadable checks if USB-key under specified path is readable.
func UpdateUSBVisibility ¶
func UpdateUSBVisibility(ctx context.Context, v USBVisible, servod components.Servod) error
UpdateUSBVisibility sets direction for USB drive connected to the servo.
Types ¶
type PowerStateValue ¶
type PowerStateValue string
PowerStateValue specifies value to set for power_state.
const ( // Power on the device. PowerStateValueON PowerStateValue = "on" // Power off the device. PowerStateValueOFF PowerStateValue = "off" // Cold reset the device. PowerStateValueReset PowerStateValue = "reset" // Request boot device in recovery mode. PowerStateValueRecoveryMode PowerStateValue = "rec" )
type ServoType ¶
type ServoType struct {
// contains filtered or unexported fields
}
ServoType represent structure to allow distinguishe servo components described in servo-type string.
func GetServoType ¶
GetServoType finds and returns the servo type of the DUT's servo.
func NewServoType ¶
NewServoType creates new ServoType with provided string representation.
func WrappedServoType ¶
func WrappedServoType(ctx context.Context, servod components.Servod, servoHost *tlw.ServoHost) (*ServoType, error)
WrappedServoType returns the type of servo device.
This function first looks up the servo type using the servod control. If that does not work, it looks up the dut information for the servo host.
func (*ServoType) ExtractComponents ¶
ExtractComponents extracts components from the name.
func (*ServoType) IsDualSetup ¶
IsDualSetup checks whether the servo has a dual setup.
func (*ServoType) IsMainDeviceCCD ¶
IsMainDeviceCCD checks whether the main device of servo is a CCD component.
func (*ServoType) IsMainDeviceGSC ¶
IsMainDeviceGSC checks whether the main device of servo is a GSC.
func (*ServoType) IsMultipleServos ¶
IsMultipleServos checks whether the servo has more than one component.
func (*ServoType) MainDevice ¶
MainDevice extracts the main servo device.
type USBVisible ¶
type USBVisible int
USBVisible specifies who see the USB-drive connected to servo.
const ( // USB drive is off. USBVisibleOff USBVisible = 0 // USB drive visible for DUT. USBVisibleDUT USBVisible = 1 // USB drive visible for servo-host. USBVisibleHost USBVisible = 2 )