usb_if/
err.rs

1use alloc::{boxed::Box, string::String};
2
3#[derive(thiserror::Error, Debug)]
4pub enum TransferError {
5    #[error("Stall")]
6    Stall,
7    #[error("Request queue full")]
8    RequestQueueFull,
9    #[error("Timeout")]
10    Timeout,
11    #[error("Cancelled")]
12    Cancelled,
13    #[error("Other error: {0}")]
14    Other(String),
15}
16
17impl From<Box<dyn core::error::Error>> for TransferError {
18    fn from(err: Box<dyn core::error::Error>) -> Self {
19        TransferError::Other(alloc::format!("{err}"))
20    }
21}
22/*
23
24LIBUSB_SUCCESS
25Success (no error)
26
27LIBUSB_ERROR_IO
28Input/output error.
29
30LIBUSB_ERROR_INVALID_PARAM
31Invalid parameter.
32
33LIBUSB_ERROR_ACCESS
34Access denied (insufficient permissions)
35
36LIBUSB_ERROR_NO_DEVICE
37No such device (it may have been disconnected)
38
39LIBUSB_ERROR_NOT_FOUND
40Entity not found.
41
42LIBUSB_ERROR_BUSY
43Resource busy.
44
45LIBUSB_ERROR_TIMEOUT
46Operation timed out.
47
48LIBUSB_ERROR_OVERFLOW
49Overflow.
50
51LIBUSB_ERROR_PIPE
52Pipe error.
53
54LIBUSB_ERROR_INTERRUPTED
55System call interrupted (perhaps due to signal)
56
57LIBUSB_ERROR_NO_MEM
58Insufficient memory.
59
60LIBUSB_ERROR_NOT_SUPPORTED
61Operation not supported or unimplemented on this platform.
62
63LIBUSB_ERROR_OTHER
64Other error.
65*/