mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 13:37:10 +00:00
DM USB: add libusb error conversion function
Add a function to covert libusb error to the common USB core error type. Change-Id: Icb03fae2acdc914b3d32a5942faf7d79793a4bee Signed-off-by: Wu, Xiaoguang <xiaoguang.wu@intel.com> Reviewed-by: Shuo Liu <shuo.a.liu@intel.com> Reviewed-by: Yu Wang <yu1.wang@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
2d1fb7e480
commit
b12527f35d
@ -44,6 +44,21 @@
|
||||
|
||||
static struct usb_dev_sys_ctx_info g_ctx;
|
||||
|
||||
static inline int
|
||||
usb_dev_err_convert(int err)
|
||||
{
|
||||
switch (err) {
|
||||
case LIBUSB_ERROR_TIMEOUT: return USB_ERR_TIMEOUT;
|
||||
case LIBUSB_ERROR_PIPE: return USB_ERR_STALLED;
|
||||
case LIBUSB_ERROR_NO_DEVICE: return USB_ERR_INVAL;
|
||||
case LIBUSB_ERROR_BUSY: return USB_ERR_IN_USE;
|
||||
case LIBUSB_ERROR_OVERFLOW: return USB_ERR_TOO_DEEP;
|
||||
default:
|
||||
break; /* add more when required */
|
||||
}
|
||||
return USB_ERR_IOERROR;
|
||||
}
|
||||
|
||||
static int
|
||||
usb_dev_native_toggle_if_drivers(struct usb_dev *udev, int attach)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user