move all libusb wrappers to libusb.go.

This commit is contained in:
Sebastian Zagrodzki
2017-02-23 10:25:02 +01:00
parent 6afb417224
commit cc135fe616
9 changed files with 88 additions and 320 deletions

View File

@@ -28,6 +28,14 @@ func (e usbError) Error() string {
return fmt.Sprintf("libusb: %s [code %d]", usbErrorString[e], int(e))
}
func fromUSBError(errno C.int) error {
err := usbError(errno)
if err == SUCCESS {
return nil
}
return err
}
const (
SUCCESS usbError = C.LIBUSB_SUCCESS
ERROR_IO usbError = C.LIBUSB_ERROR_IO