cros

package
v0.0.0-...-21d8f26 Latest Latest
Warning

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

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

Documentation

Overview

CBI corruption detection and repair logic. go/cbi-auto-recovery-dd

Index

Constants

View Source
const (

	// Servo's DUT side HUB vendor id
	SERVO_DUT_HUB_VID = "04b4"
	// Servo's DUT side HUB product id
	SERVO_DUT_HUB_PID = "6502"
	// Servo's DUT side NIC vendor id
	SERVO_DUT_NIC_VID = "0bda"
	// Servo's DUT side NIC product id
	SERVO_DUT_NIC_PID = "8153"
)
View Source
const (

	// CrasAudioHeadphone is the string value for finding the nodeType of audio headphone
	// in the output of the crasAudioNodesQueryCmd.
	CrasAudioHeadphone = "HEADPHONE"
	// CrasAudioMic is the string value for finding the nodeType of audio mic
	// in the output of the crasAudioNodesQueryCmd.
	CrasAudioMic = "MIC"
)
View Source
const (
	// Time to wait a rebooting ChromeOS, in seconds.
	NormalBootingTime = 150 * time.Second
)

Variables

View Source
var RwVPDMap = map[string]string{
	"should_send_rlz_ping": "0",
	"gbind_attribute":      "=CikKIKxeOtv7AqiCHCDBHkyLN-HF0S7JRcZgsoIRvkPlfMqaEAAaA2V2ZRCX0O3NBg==",
	"ubind_attribute":      "=CikKILiLqJanLAzsXFuVPmfc_aOZxnyNirT9iesdM6kt59x6EAEaA2V2ZRCIkb3GCQ==",
}

RwVPDMap are the default requared values for RW_VPD

Functions

func CrasAudioNodeTypeIsPlugged

func CrasAudioNodeTypeIsPlugged(ctx context.Context, r execs.Runner, nodeType string) (bool, error)

CrasAudioNodeTypeIsPlugged finds if the specified audio type node is present in the list of all plugged Cras Audio Nodes.

Example of the type "INTERNAL_MIC" Cras Audio Nodes present on the DUT:

dict entry(

string "Type"
variant             string "INTERNAL_MIC"

)

@param nodeType : A string representing Cras Audio Node Type @returns:

if the err == nil, the boolean value returned represents whether the given audio node type is found in the output.
if the err != nil, the execution of this function is not successful, the boolean value returned is set as default.

func FindSingleUsbDeviceFSDir

func FindSingleUsbDeviceFSDir(ctx context.Context, r execs.Runner, basePath string, vid string, pid string) (string, error)

FindSingleUsbDeviceFSDir find the common parent directory where the unique device with VID and PID is enumerated by file system.

  1. Get path to the unique idVendor file with VID
  2. Get path to the unique idProduct file with PID
  3. Get directions of both files and compare them

@param basePath: Path to the directory where to look for the device. @param vid: Vendor ID of the looking device. @param pid: Product ID of the looking device.

@returns: path to the folder of the device.

func GetCr50FwKeyID

func GetCr50FwKeyID(ctx context.Context, r execs.Runner, region CR50Region) (string, error)

GetCr50FwKeyID gets the cr 50 firmware RO/RW key id based on the region parameter. @param region: "RW" or "RO"

func GetCr50FwVersion

func GetCr50FwVersion(ctx context.Context, r execs.Runner, region CR50Region) (string, error)

GetCr50FwVersion gets the cr 50 firmware RO/RW version based on the region parameter. @param region: "RW" or "RO"

func ReadCryptoHomeStatusInfo

func ReadCryptoHomeStatusInfo(ctx context.Context, rawOutput string) (*cryptoHomeStatus, error)

ReadCryptoHomeStatusInfo read and parse TPM status information and return cryptoHomeStatus struct to access this information. The cryptohome command emits status information in JSON format. It looks something like this:

{
   "installattrs": {
      ...
   },
   "mounts": [ {
      ...
   } ],
   "tpm": {
      "being_owned": false,
      "can_connect": true,
      "can_decrypt": false,
      "can_encrypt": false,
      "can_load_srk": true,
      "can_load_srk_pubkey": true,
      "enabled": true,
      "has_context": true,
      "has_cryptohome_key": false,
      "has_key_handle": false,
      "last_error": 0,
      "owned": true
   }
}

func ReadFirmwareManifest

func ReadFirmwareManifest(ctx context.Context, r execs.Runner, dutModel string) (*modelFirmware, error)

ReadFirmwareManifest reads the firmware update manifest info and return a modelFirmware struct.

func ServoNICMacAddress

func ServoNICMacAddress(ctx context.Context, r execs.Runner, nicPath string) (string, error)

ServoNICMacAddress read servo NIC mac address visible from DUT side.

@param nic_path: Path to network device on the host

func UpdateStorageInfoToInvExec

func UpdateStorageInfoToInvExec(ctx context.Context, info *execs.ExecInfo) error

UpdateStorageInfoToInvExec read storage from the resource and update DUT info.

Types

type CR50Region

type CR50Region string

CR50Region describes either the RO or RW of the firmware.

const (
	CR50RegionRO CR50Region = "RO"
	CR50RegionRW CR50Region = "RW"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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