usb

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package usb implements an USB device registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(id ID, opener Opener) error

Register registers a driver for an USB device.

When this device is found, the factory will be called with a device handle.

func RegisterBus

func RegisterBus(c chan<- Driver)

RegisterBus is called by a bus that will send a notification everytime there's a new driver being registered.

Types

type Conn

type Conn interface {
	conn.Conn
	ID() *ID
}

Conn represents a connection to an USB device.

type ConnCloser

type ConnCloser interface {
	io.Closer
	Conn
}

ConnCloser is an USB device handle that can be closed.

This interface is meant to be handled by the USB device driver, not the application.

type Driver

type Driver struct {
	ID // TODO(maruel): Using only the ID as the selector is a bit naive. There's known conflicts.
	Opener
}

Driver is a registered driver.

type ID

type ID struct {
	VenID uint16
	DevID uint16
}

ID represents an USB device by its ID.

func (ID) String

func (i ID) String() string

type Opener

type Opener func(dev ConnCloser) error

Opener takes control of an already opened USB device.

Jump to

Keyboard shortcuts

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