cynhid

package module
v0.0.0-...-f4a8268 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 3 Imported by: 0

README

CynHID - HIDAPI bindings for Go

Currently these are very minimal bindings, just as much as was required for kb-alerter.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exit

func Exit()

Exit cleans up the library

func Init

func Init() error

Init initializes the HIDAPI library

Types

type Device

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

Device represents an HID device

func OpenPath

func OpenPath(path string) (*Device, error)

OpenPath opens a hid device by using a path

func (*Device) Close

func (dev *Device) Close()

Close cleans up a device handle

func (*Device) Read

func (dev *Device) Read(length int) ([]byte, error)

func (*Device) SetNonblocking

func (dev *Device) SetNonblocking(nonblock bool)

SetNonblocking sets a specific device to non-blocking mode

func (*Device) Write

func (dev *Device) Write(data []byte, length int) (int, error)

type DeviceInfo

type DeviceInfo struct {
	Path               string
	VendorID           int
	ProductID          int
	SerialNumber       string
	ReleaseNumber      int
	ManufacturerString string
	ProductString      string
	UsagePage          int
	Usage              int
	InterfaceNumber    int
}

DeviceInfo represents *C.struct_hid_device_info in a more Go-friendly way

func Enumerate

func Enumerate(vendorID int, productID int) ([]DeviceInfo, error)

Enumerate generates a slice of devices with a VID, PID combo

type Error

type Error C.int

Error represents a generic error

func (Error) Error

func (err Error) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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