sdpcmd

package
v0.0.0-...-3515dcf Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmd

func Cmd(logWriter io.Writer, logLevel slog.Level, progName string, cmdName string, cmdArgs []string) (usage string, err error)

Cmd executes the sdp subcommand with the given arguments

Types

type ExttsEvent

type ExttsEvent struct {
	Timestamp ptime.Time `json:"timestamp"`       // PTP time
	TRead     time.Time  `json:"tRead"`           // System time when we read the event
	Chan      uint32     `json:"chan"`            // channel index
	Stale     bool       `json:"stale,omitempty"` // true if timestamp was buffered before reading started
}

ExttsEvent represents a timestamp event (for -i mode)

func (*ExttsEvent) Print

func (e *ExttsEvent) Print(f *os.File)

Print outputs the timestamp in human-readable format

type FlagConfig

type FlagConfig struct {
	Mode      Mode
	JSONL     bool
	Interface string

	// Extts mode flags
	Timeout   time.Duration
	ShowStale bool

	// Common pin selection
	Pin  string // Can be name or index, empty string means not specified
	Chan int

	// Perout mode parameters
	Perout PeroutParams
}

FlagConfig holds the parsed command-line flags and determined mode

type InterfaceInfo

type InterfaceInfo struct {
	Name              string   `json:"name"`
	Status            string   `json:"status"`             // Interface status (up/down, carrier/no-carrier)
	Driver            string   `json:"driver"`             // Network driver name
	PCISlot           string   `json:"pci_slot,omitempty"` // PCI slot (e.g., "04:00.0")
	Vendor            string   `json:"vendor,omitempty"`   // PCI vendor name
	Device            string   `json:"device,omitempty"`   // PCI device name
	Revision          uint32   `json:"revision,omitempty"` // PCI revision
	ClockIndex        int      `json:"clock_index"`        // PHC index from ethtool
	Pins              []string `json:"pins"`               // From /sys/class/ptp/ptpX/pins/ directory listing
	NumExttsChannels  int      `json:"n_extts_channels"`   // From /sys/class/ptp/ptpX/n_external_timestamps
	NumPeroutChannels int      `json:"n_perout_channels"`  // From /sys/class/ptp/ptpX/n_periodic_outputs
}

InterfaceInfo represents a network interface with PHC (for list mode)

func (*InterfaceInfo) Print

func (info *InterfaceInfo) Print(f *os.File)

Print outputs the interface info in human-readable format

type Mode

type Mode int

Mode represents the operation mode for the sdp command

const (
	ModeShowIfaces Mode = iota // List all interfaces with PHC/pins
	ModeShowPins               // Show pins for specific interface
	ModeExtts                  // External timestamp input (-i)
	ModePerout                 // Periodic output (-o)
	ModeDisable                // Disable pin (--disable)
)

type NoDataError

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

NoDataError represents a condition where no data was found (exit code 2)

func (NoDataError) Error

func (e NoDataError) Error() string

func (NoDataError) ExitCode

func (e NoDataError) ExitCode() int

type PeroutParams

type PeroutParams struct {
	Width  time.Duration // 0 means no duty cycle control
	Period time.Duration // defaults to 1 second
}

PeroutParams holds parameters for periodic output mode

type PinDesc

type PinDesc struct {
	Name     string `json:"name"`
	Index    uint32 `json:"index"`
	Function string `json:"function"` // "none", "extts", "perout", "physync"
	Channel  uint32 `json:"channel"`
}

PinDesc represents a single pin's configuration (for show with interface)

func (*PinDesc) Print

func (p *PinDesc) Print(f *os.File)

Print outputs the pin description in human-readable format

type Printer

type Printer interface {
	Print(f *os.File)
}

Jump to

Keyboard shortcuts

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