Documentation ¶
Index ¶
- func Exit() error
- type Device
- func (dev *Device) Close()
- func (dev *Device) GetFeatureReport(reportId byte, reportDataSize int) ([]byte, error)
- func (dev *Device) GetIndexedString(index int) (string, error)
- func (dev *Device) ManufacturerString() (string, error)
- func (dev *Device) ProductString() (string, error)
- func (dev *Device) Read(b []byte) (n int, err error)
- func (dev *Device) ReadTimeout(b []byte, timeout int) (n int, err error)
- func (dev *Device) SendFeatureReport(data []byte) (int, error)
- func (dev *Device) SerialNumberString() (string, error)
- func (dev *Device) SetReadWriteNonBlocking(nonblocking bool) error
- func (dev *Device) Write(b []byte) (n int, err error)
- type DeviceInfo
- type DeviceInfoList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
struct hid_device_; typedef struct hid_device_ hid_device; /**< opaque hidapi structure */
func Open ¶
Open HID by vendorId, productId and serialNumber. SerialNumber is optional and can be empty string (""). Returns a *Devica and an error.
func (*Device) GetFeatureReport ¶
Get a FeatureReport from the HID device
func (*Device) GetIndexedString ¶
Get a string by index. String length will be max 256 wchars.
func (*Device) ManufacturerString ¶
Get manufacturer string from device
func (*Device) ProductString ¶
Get product string from device
func (*Device) ReadTimeout ¶
Read from hid device with given timeout
func (*Device) SendFeatureReport ¶
Send a feature report
func (*Device) SerialNumberString ¶
Get Serial number string from device
func (*Device) SetReadWriteNonBlocking ¶
In non-blocking mode calls to hid_read() will return immediately with a value of 0 if there is no data to be read. In blocking mode, hid_read() will wait (block) until there is data to read before returning.
type DeviceInfo ¶
type DeviceInfo struct { Path string VendorId uint16 ProductId uint16 SerialNumber string ReleaseNumber uint16 Manufacturer string Product string UsagePage uint16 // Only being used with windows/mac, which are not supported by go.hid yet. Usage uint16 // Only being used with windows/mac, which are not supported by go.hid yet. InterfaceNumber int }
DeviceInfo provides all information about an HID device.
func (*DeviceInfo) Device ¶
func (di *DeviceInfo) Device() (*Device, error)
Get actual hid *Device from DeviceInfo object