servo_lib

package
v0.0.0-...-9b7a7ab Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

README

servo lib

This module allows users to get correct servo-related variables for flashing, specifically, dut-controls to be run before and after flashing and the programmer argument.

These arguments mostly* depend on type of the servo in use. Thus, this module provides utilities to parse the type of the servo.

* - However, some boards require special arguments, configs for which may be found here. TODO: get labstations to install those configs via either cros tool (requires cros_sdk) or simply by installing an ebuild and use them.

Documentation

Overview

package servo_lib provides servo-related variables, such as dut-controls to be run before and after flashing, and a programmer argument.

Copyright 2022 The ChromiumOS Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServoConfig

type ServoConfig struct {
	// dut-controls to run before flashing.
	DutOn [][]string
	// dut-controls to run after flashing.
	DutOff [][]string
	// programmer (-p) argument for futility.
	Programmer string
	// extra arguments to provide to futility, such as --fast or --force.
	ExtraArgs []string
	// servo_type in use.
	ServoType ServoType
}

ServoConfig structure holds the servo-related variables that are necessary for provisioning firmware over Servo.

func GetServoConfig

func GetServoConfig(board, servoSerial string, servoType ServoType) (*ServoConfig, error)

GetServoConfig returns ServoConfig, that depends on the |board| and |servoType|, and contains variables, necessary to flash that setup over Servo. One of those variables is a programmer argument, which needs to include |servoSerial| - serial number of the given DUT. Returns an error if a given |board| cannot be flashed using given |servoType|.

type ServoType

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

ServoType is the used servo type, as reported by `dut-control servo_type`. ServoType determines arguments to use with futility when flashing.

func NewServoType

func NewServoType(servo_type string) ServoType

func (*ServoType) GetSerialNumberOption

func (s *ServoType) GetSerialNumberOption() string

func (*ServoType) IsC2D2

func (s *ServoType) IsC2D2() bool

func (*ServoType) IsCCD

func (s *ServoType) IsCCD() bool

func (*ServoType) IsMicro

func (s *ServoType) IsMicro() bool

func (*ServoType) IsMultipleServos

func (s *ServoType) IsMultipleServos() bool

func (*ServoType) IsV2

func (s *ServoType) IsV2() bool

func (*ServoType) IsV4

func (s *ServoType) IsV4() bool

func (*ServoType) PickServoSubtype

func (s *ServoType) PickServoSubtype(preferCCD bool) string

PickServoSubtype allows to pick a single servo from dual servo types, such as "servo_v4p1_with_servo_micro_and_ccd_cr50". PickServoSubtype assumes that the servo is dual, use IsMultipleServos() function to check for that. |preferCCD| tells the function to pick the CCD servo, otherwise other servo type (likely servo_micro) will be chosen. Example:

If preferCCD is true, string above will return "servo_v4p1_with_ccd_cr50".
If preferCCD is false, it will return "servo_v4p1_with_servo_micro".

type UnsupportedServoError

type UnsupportedServoError struct {
	ServoType ServoType
	Board     string
}

func (*UnsupportedServoError) Error

func (m *UnsupportedServoError) Error() string

Jump to

Keyboard shortcuts

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