Some devices (such as keyboards) support writing events through event nodes to
turn LEDs off and on, play sound effects or play ff effects.
This commits adds the appropriate methods in the public API of the crate.
I also added an example to showcase the new functionality.
* Support getting and setting auto repeat settings
Signed-off-by: Sean Young <sean@mess.org>
* Retrieving and updating keymap entries
Signed-off-by: Sean Young <sean@mess.org>
* Add missing keycodes and missing aliases
The aliases are #defines in input-event-codes.h.
Signed-off-by: Sean Young <sean@mess.org>
rc keymaps list keycodes as strings. These need to be converted to
numeric keycodes before the keymap can be loaded. So, add a function
to convert a string to keycode.
Signed-off-by: Sean Young <sean@mess.org>
* Prototype support for virtual uinput devices
* Tidy uinput a bit
* Have all the evtest examples use the same args/prompt code
* Switch to libc uinput* structs
* Use InputId in uinput, use libc _CNT constants
* Don't use align_to_mut
* Only check /dev/input/eventN files
* Spelling fixup
* Fix compilation error
* Ah, there we go. Much better.
Co-authored-by: Jeff Hiner <jeff-hiner@users.noreply.github.com>
Co-authored-by: Noah <33094578+coolreader18@users.noreply.github.com>
* Default impl should block. Renaming it to avoid API confusion from previous users.
* Can't get rid of libc::read because we have MaybeUninit, but we can clean up the match
* Remove extra include
* Switch everything over to io::Error
* Add initial tokio impl+example
* Move evtest_tokio to normal example
* Add documentation and clarify
* Use a VecDeque (ring buffer) instead of repeatedly popping things off the front of a Vec
* Looks like we are not using thiserror anymore; removing
* Store read buf between calls
* Add nonblocking example with epoll
Co-authored-by: Jeff Hiner <jeff-hiner@users.noreply.github.com>
Co-authored-by: Noah <33094578+coolreader18@users.noreply.github.com>
* Replace bitflags with newtypes
* Don't reexport from libc
* Add a wrapper for event_info
* Hide EvdevEnum
* Make the AttributeSet API more setlike
* Move AttributeSet to its own module
* Add some doc, tidy APIs
* Use typed ioctl calls
* Make enumerate() return an iterator instead of a vec
* Fix(?) events() behavior
* read() into a buf of mem::MaybeUninit
* Add Device.wait_ready()
* impl AsRawFd for Device
* Add remaining ioctls
* Make Key a simple u32 code for future-proofing
* Move MAX for bitflags into associated constants; fix Display, tweak compensation logic
* derive Debug for Device, move constants into constants.rs
* Add docstrings and seatbelts to eviocgbit and eviocgabs
* Increase formality per #243
* Make Device optional fields Option, address unclear naming