Go naming for error codes. Export USBError type.

This commit is contained in:
Sebastian Zagrodzki
2017-04-09 19:27:33 +02:00
parent 54aed557d8
commit 87c7a873e9
5 changed files with 63 additions and 57 deletions

View File

@@ -166,7 +166,7 @@ func (libusbImpl) handleEvents(c *libusbContext, done <-chan struct{}) {
default:
}
if errno := C.libusb_handle_events_timeout_completed((*C.libusb_context)(c), &tv, nil); errno < 0 {
log.Printf("handle_events: error: %s", usbError(errno))
log.Printf("handle_events: error: %s", USBError(errno))
}
}
}
@@ -350,7 +350,7 @@ func (libusbImpl) getStringDesc(d *libusbDevHandle, index int) (string, error) {
func (libusbImpl) setAutoDetach(d *libusbDevHandle, val int) error {
err := fromUSBError(C.libusb_set_auto_detach_kernel_driver((*C.libusb_device_handle)(d), C.int(val)))
if err != nil && err != ERROR_NOT_SUPPORTED {
if err != nil && err != ErrorNotSupported {
return err
}
return nil