Commit graph

11 commits

Author SHA1 Message Date
Wayne Warren
773e8066c5 examples: update _pick_device.rs example 2022-01-17 20:03:59 -07:00
Nicolas Koch
ab0f260115 Update PR to bring it more in line with VirtualDevice::emit 2021-12-06 09:59:50 +01:00
Nicolas Koch
16810308e4 Add Device::send_event and RawDevice::send_event.
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.
2021-12-05 19:25:15 +01:00
Jeff Hiner
6c1add8b73
Add support for virtual uinput devices (#37)
* 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>
2021-03-19 09:19:51 -06:00
Noah
3581aa25e0
Syncing impl (#36)
* WIP syncing impl

* Finish up syncing impl

* Reorganize synchronization code + add more docs

* Wrap libc::input_id

* Remove thread::sleep used for testing

* Make EventStream::Item io::Result<InputEvent>

* Add RawDevice::empty_state()

* Update Device rustdoc

* Make raw/sync_stream naming consistent

* Update crate docs

* Fix missing first event of block

* Owned AttributeSet, borrowed AttributeSetRef

* Add some basic syncing tests

* Add some more syncing tests
2021-03-16 20:38:42 -06:00
Jeff Hiner
cb2f5ef87a
Separate out sane blocking and async (nonblocking) implementations (#33)
* 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>
2021-03-01 10:09:11 -07:00
Jeff Hiner
7da53b57fe Fixup Display output to unwrap name 2021-02-24 09:54:55 -07:00
Noah
2e2d6f1468
Use typed ioctl calls + other misc changes (#29)
* 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
2021-02-23 13:31:36 -07:00
Corey Richardson
c410f1edfb Update README and evtest 2015-07-21 05:33:40 -04:00
Corey Richardson
d72c3bc57e Fix up sync, open, add getters, raw event reading. 2015-07-07 18:31:28 -04:00
Corey Richardson
075d4392f7 [feat] Initial enumeration and querying 2015-05-31 07:41:42 -04:00