co_usb
Loading...
Searching...
No Matches
co_usb::driver_guard Struct Reference

RAII wrapper for detaching and reattaching kernel driver. More...

#include <driver_guard.hpp>

Public Member Functions

 ~driver_guard () noexcept(false)
 
 driver_guard (driver_guard const &)=delete
 
driver_guardoperator= (driver_guard const &)=delete
 
 driver_guard (driver_guard &&other) noexcept
 
driver_guardoperator= (driver_guard &&other)
 
auto attach (std::error_code &ec) noexcept -> void
 Reattaches the detached kernel driver.
 
auto devh () const noexcept -> libusb_device_handle *
 
auto interface_num () const noexcept -> int
 
 driver_guard (detail::DeviceHandleSource auto const &devh_src, int driver_guard_num)
 

Detailed Description

RAII wrapper for detaching and reattaching kernel driver.

This type assumes the driver is already detached at the point of construction. The destructor will attempt to release the interface and may throw if the attach operation fails.

Note
Satisfies detail::DeviceHandleSource.
See also
co_usb::detach_driver

Constructor & Destructor Documentation

◆ ~driver_guard()

co_usb::driver_guard::~driver_guard ( )
inline

◆ driver_guard() [1/3]

co_usb::driver_guard::driver_guard ( driver_guard const &  )
delete

◆ driver_guard() [2/3]

co_usb::driver_guard::driver_guard ( driver_guard &&  other)
inlinenoexcept

◆ driver_guard() [3/3]

co_usb::driver_guard::driver_guard ( detail::DeviceHandleSource auto const &  devh_src,
int  driver_guard_num 
)
inlineexplicit

Member Function Documentation

◆ attach()

auto co_usb::driver_guard::attach ( std::error_code &  ec) -> void
inlinenoexcept

Reattaches the detached kernel driver.

Sets the error code if the release operation fails.

◆ devh()

auto co_usb::driver_guard::devh ( ) const -> libusb_device_handle *
inlinenoexcept

◆ interface_num()

auto co_usb::driver_guard::interface_num ( ) const -> int
inlinenoexcept

◆ operator=() [1/2]

driver_guard & co_usb::driver_guard::operator= ( driver_guard &&  other)
inline

◆ operator=() [2/2]

driver_guard & co_usb::driver_guard::operator= ( driver_guard const &  )
delete

The documentation for this struct was generated from the following file: