linuxserial

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package linuxserial provides utilitis for working with serial devices in Linux. This was written to list and canonicalize RS-485 USB devices used to connect to a heat pump using modbus RTU.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

Device is a pointer to a serial device.

func FromPath

func FromPath(path string) (Device, error)

FromPath returns a serial device based on a file path like "/dev/ttyUSB0" or /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_XYZ-if00-port0.

func List

func List() ([]Device, error)

List lists available serial devices.

func (Device) Canonicalize

func (d Device) Canonicalize() (Device, error)

Canonicalize returns a device that points to the same underlying device but has a persistent pathname. The returned value typically begins with /dev/serial/by-id.

func (Device) Path

func (d Device) Path() string

Path returns the path to the device "file." Example value: /dev/ttyUSB0 or /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_XYZ-if00-port0.

Jump to

Keyboard shortcuts

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