From 165bf178d86e49ddae1608ede78e96ca9ef755f2 Mon Sep 17 00:00:00 2001 From: Alexander Pevzner Date: Sun, 8 Dec 2024 14:52:14 +0300 Subject: [PATCH] Quirks logistics down to the UsbInterface structure --- usbio_libusb.go | 6 ++++-- usbtransport.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/usbio_libusb.go b/usbio_libusb.go index 49cc77a..dfa2735 100644 --- a/usbio_libusb.go +++ b/usbio_libusb.go @@ -675,8 +675,8 @@ func (devhandle *UsbDevHandle) usbIppBasicCaps() (caps UsbIppBasicCaps) { } // OpenUsbInterface opens an interface -func (devhandle *UsbDevHandle) OpenUsbInterface(addr UsbIfAddr) ( - *UsbInterface, error) { +func (devhandle *UsbDevHandle) OpenUsbInterface(addr UsbIfAddr, + quirks Quirks) (*UsbInterface, error) { // Claim the interface rc := C.libusb_claim_interface( @@ -705,6 +705,7 @@ func (devhandle *UsbDevHandle) OpenUsbInterface(addr UsbIfAddr) ( return &UsbInterface{ devhandle: devhandle, addr: addr, + quirks: quirks, }, nil } @@ -712,6 +713,7 @@ func (devhandle *UsbDevHandle) OpenUsbInterface(addr UsbIfAddr) ( type UsbInterface struct { devhandle *UsbDevHandle // Device handle addr UsbIfAddr // Interface address + quirks Quirks // Device quirks } // Close the interface diff --git a/usbtransport.go b/usbtransport.go index 10b33c2..cec736a 100644 --- a/usbtransport.go +++ b/usbtransport.go @@ -697,7 +697,7 @@ func (transport *UsbTransport) openUsbConn( // Obtain interface var err error - conn.iface, err = dev.OpenUsbInterface(ifaddr) + conn.iface, err = dev.OpenUsbInterface(ifaddr, quirks) if err != nil { goto ERROR }