hid

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 2

README

go-hid

Working prototype to prove that you don't need cgo to work with HID devices. Currently, only Windows is supported.

Developed as part of go-ctaphid.

Status

  • Windows
    • Enumerate
    • Open
      • Read
      • Write
  • macOS
    • Enumerate
    • Open
      • Read
      • Write
  • Linux
    • Enumerate
    • Open
      • Read
      • Write

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enumerate added in v0.2.0

func Enumerate() iter.Seq2[*DeviceInfo, error]

Types

type Device added in v0.2.0

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

func OpenPath added in v0.2.0

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

func (*Device) Close added in v0.2.0

func (d *Device) Close() error

func (*Device) Read added in v0.2.0

func (d *Device) Read(b []byte) (int, error)

func (*Device) Write added in v0.2.0

func (d *Device) Write(b []byte) (int, error)

type DeviceEvent added in v0.3.0

type DeviceEvent struct {
	Type       DeviceEventType
	DeviceInfo *DeviceInfo
	Err        error
}

type DeviceEventType added in v0.3.0

type DeviceEventType string
const (
	DeviceEventConnected    DeviceEventType = "connected"
	DeviceEventDisconnected DeviceEventType = "disconnected"
)

type DeviceInfo

type DeviceInfo struct {
	Path           string // Platform-Specific Device Path
	VendorID       uint16 // Device Vendor ID
	ProductID      uint16 // Device Product ID
	SerialNbr      string // Serial Number
	ReleaseNbr     uint16 // Device Version Number
	MfrStr         string // Manufacturer String
	ProductStr     string // Product String
	UsagePage      uint16 // Usage Page for Device/Interface
	Usage          uint16 // Usage for Device/Interface
	InterfaceNbr   int    // USB Interface Number
	InstanceID     string
	ParentDeviceID string
}

type EventReceiver added in v0.3.0

type EventReceiver interface {
	Listen() <-chan DeviceEvent
	Close() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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