co_usb
Loading...
Searching...
No Matches
co_usb Namespace Reference

Namespaces

namespace  detail
 
namespace  ev
 
namespace  hotplug
 
namespace  transfer
 

Classes

struct  device_handle
 RAII wrapper around libusb_device_handle*. More...
 
struct  device_ref
 Wrapper for nullable libusb_device that increments ref count on ctor and decrements on dtor. More...
 
struct  device_triplet
 An aggregate struct to pass to functions requiring device information. More...
 
struct  driver_guard
 RAII wrapper for detaching and reattaching kernel driver. More...
 
struct  error_category_t
 
struct  interface
 RAII wrapper for an interface. More...
 
struct  wildcard_triplet_comparator
 

Enumerations

enum class  usb_error : int {
  success = LIBUSB_SUCCESS , io_error = LIBUSB_ERROR_IO , invalid_param = LIBUSB_ERROR_INVALID_PARAM , access_error = LIBUSB_ERROR_ACCESS ,
  no_device = LIBUSB_ERROR_NO_DEVICE , not_found = LIBUSB_ERROR_NOT_FOUND , resource_busy = LIBUSB_ERROR_BUSY , timed_out = LIBUSB_ERROR_TIMEOUT ,
  overflow = LIBUSB_ERROR_OVERFLOW , broken_pipe = LIBUSB_ERROR_PIPE , interrupted = LIBUSB_ERROR_INTERRUPTED , out_of_memory = LIBUSB_ERROR_NO_MEM ,
  not_supported = LIBUSB_ERROR_NOT_SUPPORTED , unknown = LIBUSB_ERROR_OTHER
}
 USB error enumeration. More...
 

Functions

const std::error_category & usb_error_category ()
 
std::error_code make_usb_error_code (usb_error e) noexcept
 
std::error_code make_usb_error_code (libusb_error e) noexcept
 
template<detail::ErrorProtocol< device_handle > ErrTy>
auto open_device (boost::capy::executor_ref exec, device_triplet triplet, ErrTy &&errp) -> typename ErrTy::template return_type< device_handle >
 Opens a device by triplet and returns a device_handle or reports an error per error protocol implementation.
 
auto open_device (boost::capy::executor_ref exec, device_triplet triplet)
 Opens a device from a device_ref and returns a device_handle or throws an error.
 
template<detail::ErrorProtocol< device_handle > ErrTy>
auto open_device (device_ref dev_ref, ErrTy &&errp) -> typename ErrTy::template return_type< device_handle >
 Opens a device from a device_ref and returns a device_handle or reports an error per error protocol implementation.
 
auto open_device (device_ref dev_ref)
 Opens a device from a device_ref and returns a device_handle or throws an error.
 
auto triplet_from_descriptor (libusb_device_descriptor const &desc)
 
template<detail::ErrorProtocol< driver_guard > ErrTy>
auto detach_driver (detail::DeviceHandleSource auto const &devh_src, int interface_num, ErrTy &&errp=as_exception()) -> typename ErrTy::template return_type< driver_guard >
 Detaches the kernel driver and returns a driver_guard or reports an error per error protocol implementation.
 
auto detach_driver (detail::DeviceHandleSource auto const &devh_src, int interface_num) -> driver_guard
 Detaches the kernel driver and returns a driver_guard or throws an error.
 
constexpr auto as_exception () noexcept -> detail::as_exception_t
 
constexpr auto as_optional (std::error_code &ec) noexcept -> detail::as_optional_t
 
constexpr auto as_io_result () noexcept -> detail::as_io_result_t
 
constexpr auto as_io_task () noexcept -> detail::as_io_task_t
 
template<detail::ErrorProtocol< interface > ErrTy>
auto claim_interface (detail::DeviceHandleSource auto const &devh_src, int interface_num, ErrTy &&errp=as_exception()) -> typename ErrTy::template return_type< interface >
 Claims the interface and returns a interface or reports an error per error protocol implementation.
 
auto claim_interface (detail::DeviceHandleSource auto const &devh_src, int interface_num) -> interface
 Claims the interface and returns a interface or throws an error.
 

Enumeration Type Documentation

◆ usb_error

enum class co_usb::usb_error : int
strong

USB error enumeration.

Copies libusb_error one to one.

Enumerator
success 
io_error 

Input/output error

invalid_param 

Invalid parameter

access_error 

Access denied (insufficient permissions)

no_device 

No such device (it may have been disconnected)

not_found 

Entity not found

resource_busy 

Resource busy

timed_out 

Operation timed out

overflow 

Overflow

broken_pipe 

Pipe error

interrupted 

System call interrupted (perhaps due to signal)

out_of_memory 

Insufficient memory

not_supported 

Operation not supported or unimplemented on this platform

unknown 

Other error

Function Documentation

◆ as_exception()

constexpr auto co_usb::as_exception ( ) -> detail::as_exception_t
constexprnoexcept

◆ as_io_result()

constexpr auto co_usb::as_io_result ( ) -> detail::as_io_result_t
constexprnoexcept

◆ as_io_task()

constexpr auto co_usb::as_io_task ( ) -> detail::as_io_task_t
constexprnoexcept

◆ as_optional()

constexpr auto co_usb::as_optional ( std::error_code &  ec) -> detail::as_optional_t
constexprnoexcept

◆ make_usb_error_code() [1/2]

std::error_code co_usb::make_usb_error_code ( libusb_error  e)
inlinenoexcept

◆ make_usb_error_code() [2/2]

std::error_code co_usb::make_usb_error_code ( usb_error  e)
inlinenoexcept

◆ triplet_from_descriptor()

auto co_usb::triplet_from_descriptor ( libusb_device_descriptor const &  desc)
inline

◆ usb_error_category()

const std::error_category & co_usb::usb_error_category ( )
inline