hid.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // hid - Gopher Interface Devices (USB HID)
  2. // Copyright (c) 2017 Péter Szilágyi. All rights reserved.
  3. //
  4. // This file is released under the 3-clause BSD license. Note however that Linux
  5. // support depends on libusb, released under GNU LGPL 2.1 or later.
  6. // Package hid provides an interface for USB HID devices.
  7. package hid
  8. import "errors"
  9. // ErrDeviceClosed is returned for operations where the device closed before or
  10. // during the execution.
  11. var ErrDeviceClosed = errors.New("hid: device closed")
  12. // ErrUnsupportedPlatform is returned for all operations where the underlying
  13. // operating system is not supported by the library.
  14. var ErrUnsupportedPlatform = errors.New("hid: unsupported platform")
  15. // DeviceInfo is a hidapi info structure.
  16. type DeviceInfo struct {
  17. Path string // Platform-specific device path
  18. VendorID uint16 // Device Vendor ID
  19. ProductID uint16 // Device Product ID
  20. Release uint16 // Device Release Number in binary-coded decimal, also known as Device Version Number
  21. Serial string // Serial Number
  22. Manufacturer string // Manufacturer String
  23. Product string // Product string
  24. UsagePage uint16 // Usage Page for this Device/Interface (Windows/Mac only)
  25. Usage uint16 // Usage for this Device/Interface (Windows/Mac only)
  26. // The USB interface which this logical device
  27. // represents. Valid on both Linux implementations
  28. // in all cases, and valid on the Windows implementation
  29. // only if the device contains more than one interface.
  30. Interface int
  31. }