report correct error during Enum failure

This commit is contained in:
Kyle Lemons
2016-04-02 13:20:31 -07:00
parent 497c20341d
commit 0042b0dd4f

View File

@@ -100,7 +100,7 @@ func (c *Context) ListDevices(each func(desc *Descriptor) bool) ([]*Device, erro
if each(desc) { if each(desc) {
var handle *C.libusb_device_handle var handle *C.libusb_device_handle
if errno := C.libusb_open(dev, &handle); errno != 0 { if errno := C.libusb_open(dev, &handle); errno != 0 {
reterr = err reterr = usbError(errno)
continue continue
} }
ret = append(ret, newDevice(handle, desc)) ret = append(ret, newDevice(handle, desc))