servo

package
v0.0.0-...-9994f1b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2025 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
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

func BatteryChargePercent(ctx context.Context, servod components.Servod) (int32, error)

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

func GetBool(ctx context.Context, servod components.Servod, command string) (bool, error)

GetBool retrieves from servod the value of servod command passed as an argument, and returns it as boolean.

func GetDouble

func GetDouble(ctx context.Context, servod components.Servod, command string) (float64, error)

GetDouble retrieves from servod the value of servod command passed as an argument, and returns it as 64-bit floating point value.

func GetInt

func GetInt(ctx context.Context, servod components.Servod, command string) (int32, error)

GetInt retrieves from servod the value of servod command passed as an argument, and returns it as a 32-bit integer.

func GetString

func GetString(ctx context.Context, servod components.Servod, command string) (string, error)

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

func SaveUartStreamToFiles(ctx context.Context, servod components.Servod, dirPath string) error

SaveUartStreamToFiles saves all available UART streams to files.

func ServoSupportsBuiltInPDControl

func ServoSupportsBuiltInPDControl(ctx context.Context, servod components.Servod) (bool, error)

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

func SetPDRole(ctx context.Context, servod components.Servod, role PDRole) error

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 PDRole

type PDRole struct {
	// contains filtered or unexported fields
}

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

func GetServoType(ctx context.Context, servod components.Servod) (*ServoType, error)

GetServoType finds and returns the servo type of the DUT's servo.

func NewServoType

func NewServoType(servoType string) *ServoType

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

func (s *ServoType) ExtractComponents(onlyChild bool) []string

ExtractComponents extracts components from the name.

func (*ServoType) IsC2D2

func (s *ServoType) IsC2D2() bool

IsC2D2 checks whether the servo has a c2d2 component.

func (*ServoType) IsCCD

func (s *ServoType) IsCCD() bool

IsCCD checks whether the servo has a CCD component.

func (*ServoType) IsCr50

func (s *ServoType) IsCr50() bool

IsCr50 checks whether the servo has a CCD by CR50 component.

func (*ServoType) IsDualSetup

func (s *ServoType) IsDualSetup() bool

IsDualSetup checks whether the servo has a dual setup.

func (*ServoType) IsGSC

func (s *ServoType) IsGSC() bool

IsGSC checks whether the servo has a CCD by GSC component.

func (*ServoType) IsMainDeviceCCD

func (s *ServoType) IsMainDeviceCCD() bool

IsMainDeviceCCD checks whether the main device of servo is a CCD component.

func (*ServoType) IsMainDeviceGSC

func (s *ServoType) IsMainDeviceGSC() bool

IsMainDeviceGSC checks whether the main device of servo is a GSC.

func (*ServoType) IsMicro

func (s *ServoType) IsMicro() bool

IsMicro checks whether the servo has a servo_micro component.

func (*ServoType) IsMultipleServos

func (s *ServoType) IsMultipleServos() bool

IsMultipleServos checks whether the servo has more than one component.

func (*ServoType) IsV2

func (s *ServoType) IsV2() bool

IsV2 checks whether the servo has a servo_v2 component.

func (*ServoType) IsV3

func (s *ServoType) IsV3() bool

IsV3 checks whether the servo has a servo_v3 component.

func (*ServoType) IsV4

func (s *ServoType) IsV4() bool

IsV4 checks whether the servo has servo_v4 or servo_v4p1 component.

func (*ServoType) IsV4p1

func (s *ServoType) IsV4p1() bool

IsV4p1 returns true if and only if the servo has a servo_v4p1 component.

func (*ServoType) MainDevice

func (s *ServoType) MainDevice() string

MainDevice extracts the main servo device.

func (*ServoType) String

func (s *ServoType) String() string

String provide ability to use ToString functionality.

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
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL