-
Notifications
You must be signed in to change notification settings - Fork 0
/
hid.go
39 lines (31 loc) · 1.1 KB
/
hid.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Package hid provides access to Human Interface Devices.
package hid
// DeviceInfo provides general information about a device.
type DeviceInfo struct {
// Path contains a platform-specific device path which is used to identify the device.
Path string
VendorID uint16
ProductID uint16
VersionNumber uint16
Manufacturer string
Product string
UsagePage uint16
Usage uint16
InputReportLength uint16
OutputReportLength uint16
}
// A Device provides access to a HID device.
type Device interface {
// Close closes the device and associated resources.
Close()
// Write writes an output report to device. The first byte must be the
// report number to write, zero if the device does not use numbered reports.
Write([]byte) error
// ReadCh returns a channel that will be sent input reports from the device.
// If the device uses numbered reports, the first byte will be the report
// number.
ReadCh() <-chan []byte
// ReadError returns the read error, if any after the channel returned from
// ReadCh has been closed.
ReadError() error
}