wilco

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WilcoVMCID is the context ID for the VM
	WilcoVMCID   = 512
	DDVDbusTopic = "com.dell.ddv"
)

Const values from /etc/init/wilco_dtc.conf on device

Variables

This section is empty.

Functions

func ClearECEventQueue

func ClearECEventQueue(ctx context.Context) error

ClearECEventQueue will read all of the currently available events in the wilco EC device node queue. These events are discarded.

func DPSLSendMessage

func DPSLSendMessage(ctx context.Context, msgName string, in, out descriptor.Message) error

DPSLSendMessage is a helper function that creates and runs a diagnostics_dpsl_test_requester command over vsh. It accepts the name of command, the proto message to send, and a proto message to hold the output. See https://crrev.com/c/1767044 for a description of the diagnostics_dpsl_test_requester.

func ReadECEvent

func ReadECEvent(ctx context.Context) ([]byte, error)

ReadECEvent reads an EC event from the EC event device node. The event payload will be returned.

func StartSupportd

func StartSupportd(ctx context.Context) error

StartSupportd starts the upstart process wilco_dtc_supportd.

func StartVM

func StartVM(ctx context.Context, config *VMConfig) error

StartVM starts the upstart process wilco_dtc and wait until the VM is fully ready.

func StopSupportd

func StopSupportd(ctx context.Context) error

StopSupportd stops the upstart process wilco_dtc_supportd.

func StopVM

func StopVM(ctx context.Context) error

StopVM stops the upstart process wilco_dtc.

func SupportdPID

func SupportdPID(ctx context.Context) (pid int, err error)

SupportdPID gets the process id of wilco_dtc_supportd.

func TriggerECEvent

func TriggerECEvent() error

TriggerECEvent writes data to the EC event trigger path and triggers a fake EC event.

func VMPID

func VMPID(ctx context.Context) (pid int, err error)

VMPID gets the process id of wilco_dtc.

func WaitForDDVDBus

func WaitForDDVDBus(ctx context.Context) error

WaitForDDVDBus blocks until the ddv dbus service to be available.

func WithHandleMessageFromUiResponse

func WithHandleMessageFromUiResponse(response *dtcpb.HandleMessageFromUiResponse) option

WithHandleMessageFromUiResponse sets the --ui_response_body flag, making the listener reply with that value to HandleMessageFromUi requests.

Types

type DPSLMessageReceiver

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

DPSLMessageReceiver contains the necessary components to run the DPSL listening utility and parse its output.

func NewDPSLMessageReceiver

func NewDPSLMessageReceiver(ctx context.Context, opts ...option) (*DPSLMessageReceiver, error)

NewDPSLMessageReceiver will start a utility inside of the Wilco VM listening for DPSL messages. It will return a DPSLMessageReceiver struct that decodes and buffers the JSON. It will immediately start consuming messages from the stdout of the dpsl test listener.

func (*DPSLMessageReceiver) Stop

func (rec *DPSLMessageReceiver) Stop(ctx context.Context)

Stop will stop the DPSLMessageReceiver gracefully by interrupting the DPSL listening program and exiting the goroutine.

func (*DPSLMessageReceiver) WaitForMessage

func (rec *DPSLMessageReceiver) WaitForMessage(ctx context.Context, out descriptor.Message) error

WaitForMessage listens for events sent to the VM and attempt to parse them into the descriptor.Message. The function will block until the correct message type is found or the context timeout is reached. Messages that do not match the provided descriptor.Message will be ignored and discarded.

type RTC

type RTC struct {
	rtc.RTC
}

RTC (wilco) is a thin wrapper around the rtc.RTC and implements the RTC features specific to the wilco devices.

func (RTC) MockECRTC

func (wrtc RTC) MockECRTC(ctx context.Context, t time.Time) (func(context.Context) error, error)

MockECRTC mocks RTC time to the specified time by stopping necessary wilco specific job and returns a callback to revert the state back to original.

type VMConfig

type VMConfig struct {
	// StartProcesses will determine if the init processes of the Wilco DTC VM are run (DDV and SA).
	StartProcesses bool
	// TestDBusConfig will start the dbus-daemon with a test configuration.
	TestDBusConfig bool
}

VMConfig contains different configuration options for starting the WilcoVM.

func DefaultVMConfig

func DefaultVMConfig() *VMConfig

DefaultVMConfig creates and returns a VMConfig with the default values. These default values are the ones used for the production VM.

Jump to

Keyboard shortcuts

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