libevdevxx 0.4.0
A C++ wrapper for libevdev.
|
Represents a device (real of not). More...
#include <Device.hpp>
Public Member Functions | |
Device () | |
Default constructor. | |
Device (int filedes) | |
Construct form a device file descriptor. The file descriptor is not owned. | |
Device (const std::filesystem::path &filename, int flags=O_RDONLY|O_NONBLOCK) | |
Construct from a device file path. | |
virtual | ~Device () noexcept |
::libevdev * | data () noexcept |
Access the internal ::libevdev object. | |
const ::libevdev * | data () const noexcept |
Access the internal ::libevdev object, const version. | |
void | grab () |
Grab the device through a EVIOCGRAB syscall. | |
void | ungrab () |
Ungrab the device. | |
void | fd (int fd) |
Set a file descriptor and read the device metadata. | |
void | change_fd (int fd) |
Change the file descriptor used internally, without re-reading the actual device. | |
int | fd () const |
Return the internal file descriptor used to access the device file. | |
void | open (const std::filesystem::path &filename, int flags=O_RDONLY|O_NONBLOCK) |
bool | is_open () const noexcept |
void | close () noexcept |
void | nonblock (bool enable) |
virtual void | log (LogPriority p, const char *file, int line, const char *func, const char *format, std::va_list args) const |
std::string | name () const |
std::optional< std::string > | phys () const |
std::optional< std::string > | uniq () const |
std::uint16_t | product () const noexcept |
std::uint16_t | vendor () const noexcept |
std::uint16_t | bustype () const noexcept |
std::uint16_t | version () const noexcept |
int | driver_version () const noexcept |
bool | has (Property prop) const noexcept |
bool | has (Type type) const noexcept |
bool | has (Type type, Code code) const noexcept |
bool | has (const TypeCode &tc) const noexcept |
int | abs_min (Code code) const noexcept |
int | abs_max (Code code) const noexcept |
int | abs_fuzz (Code code) const noexcept |
int | abs_flat (Code code) const noexcept |
int | abs_res (Code code) const noexcept |
AbsInfo | abs_info (Code code) const |
int | get (Type type, Code code) const noexcept |
int | get (const TypeCode &tc) const noexcept |
std::optional< int > | fetch (Type type, Code code) const noexcept |
std::optional< int > | fetch (const TypeCode &tc) const noexcept |
bool | get_repeat (int &delay, int &period) const noexcept |
int | get_slot (unsigned slot, Code code) const noexcept |
std::optional< int > | fetch_slot (unsigned slot, Code code) const noexcept |
std::optional< int > | num_slots () const noexcept |
int | current_slot () const noexcept |
void | name (const std::string &n) |
void | phys (const std::string &phys) |
void | uniq (const std::string &uniq) |
void | product (std::uint16_t pid) |
void | vendor (std::uint16_t vid) |
void | bustype (std::uint16_t bus) |
void | version (std::uint16_t ver) |
void | enable (Property prop) |
void | disable (Property prop) |
void | set (Type type, Code code, int value) |
void | set (const TypeCode &tc, int value) |
void | set_slot (unsigned slot, Code code, int value) |
void | abs_min (Code code, int val) |
void | abs_max (Code code, int val) |
void | abs_fuzz (Code code, int val) |
void | abs_flat (Code code, int val) |
void | abs_res (Code code, int val) |
void | abs_info (Code code, const AbsInfo &abs) |
void | enable (Type type) |
void | disable (Type type) |
void | enable (Type type, Code code) |
void | enable (const TypeCode &tc) |
void | enable_abs (Code code, const AbsInfo &info) |
void | enable_rep (Code code, int arg) |
void | disable (Type type, Code code) |
void | disable (const TypeCode &tc) |
void | kernel_abs_info (Code code, const AbsInfo &abs) |
void | kernel_led_value (Code code, ::libevdev_led_value value) |
void | set_clock_id (int clockid) |
Event | read (ReadFlag flags=ReadFlag::normal) |
ReadStatus | read (Event &event, ReadFlag flags=ReadFlag::normal) noexcept |
bool | pending () |
std::vector< Property > | properties () const |
std::vector< Type > | types () const |
std::vector< Code > | codes (Type type) const |
std::vector< Code > | codes (Type type, Code max) const |
void | enable_key (Code code) |
void | enable_rel (Code code) |
void | enable_abs (Code code) |
Protected Member Functions | |
Device (LogPriority priority) | |
Constructor to enable logging. | |
Device (LogPriority priority, int filedes) | |
Constructor to enable logging, and a non-owning device file descriptor. | |
Device (LogPriority priority, const std::filesystem::path &filename, int flags=O_RDONLY|O_NONBLOCK) | |
Constructor to enable logging and a device filename. | |
Represents a device (real of not).
In order to use the logging function, the log()
method must be overridden in a derived class, and a protected constructors (that take a LogPriority
argument) must be called explicitly.
|
protected |
|
protected |
Constructor to enable logging, and a non-owning device file descriptor.
priority | The priority level; the log() method will only be called when the message has this priority or above. |
filedes | File descriptor fot the device file (from /dev/input/event* ) that will be used for I/O. Ownership is not taken over this, so the file will not be closed on destruction. |
|
protected |
Constructor to enable logging and a device filename.
priority | The priority level; the log() method will only be called when the message has this priority or above. |
filename | Path to to an evdev device (from /dev/input/event* ) that will be open by this device. |
flags | Flags used in the open system call. |
Device | ( | ) |
Device | ( | int | filedes | ) |
Construct form a device file descriptor. The file descriptor is not owned.
Device | ( | const std::filesystem::path & | filename, |
int | flags = O_RDONLY|O_NONBLOCK |
||
) |
Construct from a device file path.
|
virtualnoexcept |
|
noexcept |
void abs_flat | ( | Code | code, |
int | val | ||
) |
|
noexcept |
void abs_fuzz | ( | Code | code, |
int | val | ||
) |
|
noexcept |
void abs_max | ( | Code | code, |
int | val | ||
) |
|
noexcept |
void abs_min | ( | Code | code, |
int | val | ||
) |
|
noexcept |
void abs_res | ( | Code | code, |
int | val | ||
) |
|
noexcept |
void bustype | ( | std::uint16_t | bus | ) |
void change_fd | ( | int | fd | ) |
Change the file descriptor used internally, without re-reading the actual device.
This is only useful if you need to close and reopen the file descriptor.
|
noexcept |
|
noexcept |
|
noexcept |
Access the internal ::libevdev
object, const version.
|
noexcept |
Access the internal ::libevdev
object.
void disable | ( | const TypeCode & | tc | ) |
void disable | ( | Property | prop | ) |
void disable | ( | Type | type | ) |
|
noexcept |
void enable | ( | const TypeCode & | tc | ) |
void enable | ( | Property | prop | ) |
void enable | ( | Type | type | ) |
void enable_abs | ( | Code | code | ) |
void enable_key | ( | Code | code | ) |
void enable_rel | ( | Code | code | ) |
void enable_rep | ( | Code | code, |
int | arg | ||
) |
int fd | ( | ) | const |
Return the internal file descriptor used to access the device file.
void fd | ( | int | fd | ) |
Set a file descriptor and read the device metadata.
You can only call this function once.
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
void grab | ( | ) |
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
void kernel_led_value | ( | Code | code, |
::libevdev_led_value | value | ||
) |
|
virtual |
std::string name | ( | ) | const |
void name | ( | const std::string & | n | ) |
void nonblock | ( | bool | enable | ) |
|
noexcept |
void open | ( | const std::filesystem::path & | filename, |
int | flags = O_RDONLY|O_NONBLOCK |
||
) |
bool pending | ( | ) |
std::optional< std::string > phys | ( | ) | const |
void phys | ( | const std::string & | phys | ) |
|
noexcept |
void product | ( | std::uint16_t | pid | ) |
std::vector< Property > properties | ( | ) | const |
|
noexcept |
Event read | ( | ReadFlag | flags = ReadFlag::normal | ) |
void set | ( | const TypeCode & | tc, |
int | value | ||
) |
void set_clock_id | ( | int | clockid | ) |
void set_slot | ( | unsigned | slot, |
Code | code, | ||
int | value | ||
) |
std::vector< Type > types | ( | ) | const |
void ungrab | ( | ) |
std::optional< std::string > uniq | ( | ) | const |
void uniq | ( | const std::string & | uniq | ) |
|
noexcept |
void vendor | ( | std::uint16_t | vid | ) |
|
noexcept |
void version | ( | std::uint16_t | ver | ) |