[close] Attachments you submit will be routed for moderation. If you have an account, please log in first.

Ticket #42: libusb-compat-usb_detach_kernel_driver_np-error.patch

File libusb-compat-usb_detach_kernel_driver_np-error.patch, 639 bytes (added by sbrabec, 3 years ago)

libusb-compat-usb_detach_kernel_driver_np-error.patch

  • libusb/core.c

    API_EXPORTED int usb_get_driver_np(usb_d 
    912912 
    913913API_EXPORTED int usb_detach_kernel_driver_np(usb_dev_handle *dev, int interface) 
    914914{ 
    915         return compat_err(libusb_detach_kernel_driver(dev->handle, interface)); 
     915        int r = compat_err(libusb_detach_kernel_driver(dev->handle, interface)); 
     916        if (r == 0) { 
     917                return 0; 
     918        } else { 
     919                switch (r) { 
     920                case LIBUSB_ERROR_NOT_FOUND: 
     921                        return ENODATA; 
     922                case LIBUSB_ERROR_INVALID_PARAM: 
     923                        return EINVAL; 
     924                case LIBUSB_ERROR_NO_DEVICE: 
     925                        return ENODEV; 
     926                case LIBUSB_ERROR_OTHER: 
     927                        return errno; 
     928                default: 
     929                        return ERANGE; 
     930                } 
     931        } 
    916932} 
    917933