Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an device error code for 'busy' #110

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion gusb/gusb-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,11 @@ g_usb_device_libusb_error_to_gerror(GUsbDevice *self, gint rc, GError **error)
error_code = G_USB_DEVICE_ERROR_PERMISSION_DENIED;
break;
case LIBUSB_ERROR_NO_DEVICE:
case LIBUSB_ERROR_BUSY:
error_code = G_USB_DEVICE_ERROR_NO_DEVICE;
break;
case LIBUSB_ERROR_BUSY:
error_code = G_USB_DEVICE_ERROR_BUSY;
break;
default:
break;
}
Expand Down
13 changes: 13 additions & 0 deletions gusb/gusb-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ typedef enum {

/**
* GUsbDeviceError:
* @G_USB_DEVICE_ERROR_INTERNAL: Internal error
* @G_USB_DEVICE_ERROR_IO: IO error
* @G_USB_DEVICE_ERROR_TIMED_OUT: Operation timed out
* @G_USB_DEVICE_ERROR_NOT_SUPPORTED: Operation not supported
* @G_USB_DEVICE_ERROR_NO_DEVICE: No device found
* @G_USB_DEVICE_ERROR_NOT_OPEN: Device is not open
* @G_USB_DEVICE_ERROR_ALREADY_OPEN: Device is already open
* @G_USB_DEVICE_ERROR_CANCELLED: Operation was cancelled
* @G_USB_DEVICE_ERROR_FAILED: Operation failed
* @G_USB_DEVICE_ERROR_PERMISSION_DENIED: Permission denied
* @G_USB_DEVICE_ERROR_BUSY: Device was busy
*
* The error code.
**/
Expand All @@ -71,6 +82,8 @@ typedef enum {
G_USB_DEVICE_ERROR_CANCELLED,
G_USB_DEVICE_ERROR_FAILED,
G_USB_DEVICE_ERROR_PERMISSION_DENIED,
G_USB_DEVICE_ERROR_BUSY,
/*< private >*/
G_USB_DEVICE_ERROR_LAST
} GUsbDeviceError;

Expand Down
Loading