Pārlūkot izejas kodu

add interface support

Matthew Di Ferrante 8 gadi atpakaļ
vecāks
revīzija
638497e269
2 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 1 0
      hid.go
  2. 4 0
      usb_linux.go

+ 1 - 0
hid.go

@@ -24,6 +24,7 @@ type Device interface {
 	Close()
 	Info() Info
 	SetEndpoint(int)
+	SetInterface(int)
 	HIDReport() ([]byte, error)
 	SetReport(int, []byte) error
 	GetReport(int) ([]byte, error)

+ 4 - 0
usb_linux.go

@@ -32,6 +32,10 @@ func (hid *usbDevice) SetEndpoint(ep int) {
 	hid.epIn = ep + 0x80
 }
 
+func (hid *usbDevice) SetInterface(ifno int) {
+	hid.info.Interface = uint8(ifno)
+}
+
 func (hid *usbDevice) Open() (err error) {
 	if hid.f != nil {
 		return errors.New("device is already opened")