From 0d56fe23dde232d85fa4871089939819ddebade5 Mon Sep 17 00:00:00 2001 From: "zhuo.meng" Date: Mon, 6 Nov 2017 10:47:19 +0800 Subject: [PATCH] make ctrl exportable --- hid.go | 1 + usb_linux.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/hid.go b/hid.go index 33f922e..9ed693d 100644 --- a/hid.go +++ b/hid.go @@ -28,4 +28,5 @@ type Device interface { GetReport(int) ([]byte, error) Read(size int, ms time.Duration) ([]byte, error) Write(data []byte, ms time.Duration) (int, error) + Ctrl(rtype, req, val, index int, data []byte, t int) (int, error) } diff --git a/usb_linux.go b/usb_linux.go index 35efe79..a9bcc9b 100644 --- a/usb_linux.go +++ b/usb_linux.go @@ -95,6 +95,10 @@ func (hid *usbDevice) release() error { return nil } +func (hid *usbDevice) Ctrl(rtype, req, val, index int, data []byte, t int) (int, error) { + return hid.ctrl(rtype, req, val, index, data, t) +} + func (hid *usbDevice) ctrl(rtype, req, val, index int, data []byte, t int) (int, error) { s := usbfsCtrl{ ReqType: uint8(rtype),