hid

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 7 Imported by: 0

README

HID

package to access Human Interface Devices. The platform specific parts of this package are heavily based on Signal 11 - HIDAPI

fork from: https://github.com/boombuler/hid

Documentation

Overview

HID package to access Human Interface Devices. The platform specific parts of this package are heavily based on Signal 11 - HIDAPI. (https://github.com/signal11/hidapi)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Devices

func Devices() <-chan *DeviceInfo

func FindDevices

func FindDevices(vendor uint16, product uint16) <-chan *DeviceInfo

FindDevices iterates through all devices with a given vendor and product id

func FindDevicesByProduct

func FindDevicesByProduct(product string) <-chan *DeviceInfo

FindDevicesByProduct iterates through all devices with a given vendor and product id

Types

type Device

type Device interface {
	// Close closes the device and release all keept resources.
	Close()
	// Write to the device
	// (technically a HID report with type 'output' is send to the device)
	Write([]byte) error
	// Write to the device
	// (technically a HID report with type 'feature' is send to the device)
	WriteFeature([]byte) error
	// Preform an interrupt transfer to the device
	WriteInterrupt(byte, []byte) (int, error)
}

Device interface for an opened HID USB device

type DeviceInfo

type DeviceInfo struct {
	// Path contains a Platform-specific device path which is used to identify the device
	Path string
	// VendorId contains the USB Vendor ID of the device
	VendorId uint16
	// ProductId contains the USB Product ID of the device
	ProductId uint16
	// VersionNumber contains the Version / Release Number of the device
	VersionNumber uint16
	// Manufacturer of the USB device
	Manufacturer string
	// Product contains the product name of the device
	Product string

	InputReportLength   uint16
	OutputReportLength  uint16
	FeatureReportLength uint16
}

DeviceInfo provides general information about a device

func ByPath

func ByPath(path string) (*DeviceInfo, error)

func (*DeviceInfo) Open

func (di *DeviceInfo) Open() (Device, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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