hid.go 531 B

123456789101112131415161718192021222324252627282930313233
  1. package hid
  2. import "time"
  3. //
  4. // General information about the HID device
  5. //
  6. type Info struct {
  7. Vendor uint16
  8. Product uint16
  9. Revision uint16
  10. SubClass uint8
  11. Protocol uint8
  12. Interface uint8
  13. }
  14. //
  15. // A common HID device interace
  16. //
  17. type Device interface {
  18. Open() error
  19. Close()
  20. Info() Info
  21. SetEndpoint(int)
  22. SetInterface(int)
  23. HIDReport() ([]byte, error)
  24. SetReport(int, []byte) error
  25. GetReport(int) ([]byte, error)
  26. Read(size int, ms time.Duration) ([]byte, error)
  27. Write(data []byte, ms time.Duration) (int, error)
  28. }