From 16dcc9999731c3dafa3227b78cb18cedb465d13e Mon Sep 17 00:00:00 2001 From: vincentserpoul Date: Fri, 17 Feb 2017 01:19:33 +0800 Subject: [PATCH] add bool handling --- usb/device.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usb/device.go b/usb/device.go index 7d8bbb2..b707e4e 100644 --- a/usb/device.go +++ b/usb/device.go @@ -222,7 +222,12 @@ func (d *Device) GetStringDescriptor(desc_index int) (string, error) { // When this is enabled libusb will automatically detach the kernel driver // on an interface when claiming the interface, and attach it when releasing the interface. // Automatic kernel driver detachment is disabled on newly opened device handles by default. -func (d *Device) SetAutoDetach(autodetach int) error { +func (d *Device) SetAutoDetach(autodetach bool) error { + autodetachInt := 0 + if autodetach { + autodetachInt = 1 + } + errno := C.libusb_set_auto_detach_kernel_driver( d.handle, C.int(autodetach),