socketcan

package module
v0.1.0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

README

socketcan

Package socketcan implements a can.Driver for SocketCAN on linux/{amd64,arm,arm64}.

Currently, reading and writing of CAN and CAN FD messages is supported.

It is also possible to get a list of CAN interfaces present on a system. This is done using the kernel's Netlink interface, with help of github.com/mdlayher/netlink and github.com/jsimonetti/rtnetlink.

Interface configuration will be added later in a generic way; currently it still must be done using a tool like ip, for example:

ip link set can0 up type can bitrate 500000

Usage

import (
	"github.com/knieriem/can"
	"github.com/knieriem/can/drv/socketcan"
)

func main() {
	can.RegisterDriver(socketcan.Driver)

	dev, err := can.Open("")
	if err != nil {
		// ...
	}
	// use dev
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Driver can.Driver = driver{}
View Source
var ErrMTUExceeded = errors.New("frame length exceeds MTU")

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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