13#include <boost/capy/ex/this_coro.hpp>
14#include <boost/capy/io_result.hpp>
15#include <boost/capy/io_task.hpp>
33 -> boost::capy::io_task<event_type, device_ref>
35 auto exec =
co_await boost::capy::this_coro::executor;
36 auto stop =
co_await boost::capy::this_coro::stop_token;
40 auto ev_ref = srv.handler();
41 libusb_context *ctx = srv.usb_context();
42 libusb_hotplug_callback_handle handle{0};
43 std::stop_callback stop_cb{stop, [&] ()
47 libusb_hotplug_deregister_callback(ctx, handle);
48 op_res.ec = std::make_error_code(std::errc::operation_canceled);
49 res.io_env->executor.post(res.cont);
52 flags.bits, triplet.vid, triplet.pid,
Wrapper for nullable libusb_device that increments ref count on ctor and decrements on dtor.
An aggregate struct to pass to functions requiring device information.
Strongly typed wrappers libusb hotplug flag types (flags & events).
auto oneshot_hotplug(event_type events, flag_type flags, device_triplet triplet) -> boost::capy::io_task< event_type, device_ref >
Oneshot coroutine to get a one-time hotplug accept.
Definition oneshot_hotplug.hpp:32
Capy execution_context service wrapping a libusb event handler.
Low-level awaitable primitive for strapping hotplug callbacks to a coroutine ecosystem.
auto get_handler_service(boost::capy::executor_ref exec) -> handler_service &
Retrieve the handler_service from a given executor.
Definition handler_service.hpp:248
Definition hotplug_awaitable.hpp:18
An aggregate struct to pass to functions requiring device information.
Definition device_triplet.hpp:21
Definition hotplug_awaitable.hpp:37
Definition hotplug_awaitable.hpp:44
Low-level awaitable primitive for strapping hotplug callbacks to a coroutine ecosystem.
Definition hotplug_awaitable.hpp:35