Explorar el Código

add interface support

Matthew Di Ferrante hace 8 años
padre
commit
638497e269
Se han modificado 2 ficheros con 5 adiciones y 0 borrados
  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")