Commit graph

65 commits

Author SHA1 Message Date
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
6b13fd3d45 Add more rustdoc; reorder pub fns for clarity 2021-03-01 14:40:17 -07:00
Jeff Hiner
fa4838e5f8 Fix incorrect sync handling checks 2021-03-01 13:23:26 -07:00
Jeff Hiner
3c7f3321d5 Distinguish different SYN types 2021-03-01 11:48:36 -07: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
Noah
3f32c41fc0
Rework the types in constants (#34)
* 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
2021-02-24 18:09:44 -07:00
Jeff Hiner
7da53b57fe Fixup Display output to unwrap name 2021-02-24 09:54:55 -07:00
Noah
a55f319854
Switch to bitvec (#30) 2021-02-23 18:02:10 -07:00
Jeff Hiner
98183712f9 Switch external-facing APIs from CString to &str 2021-02-23 17:27:05 -07:00
Noah
8184164d14
Add Key:: associated constants (#31) 2021-02-23 16:52:18 -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
Jeff Hiner
73fd0ae421
Round 2 of some refactoring/cleanup (#27)
* 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
2021-02-23 11:28:20 -07:00
Jeff Hiner
36bb8faef0 Renamed key_bits to supported_keys, fixed &mut &mut [32] regression 2021-02-22 13:43:58 -07:00
Jeff Hiner
2373a4e262 Formatting 2021-02-22 13:43:41 -07:00
Jeff Hiner
de2c4e026d
Fix a bunch of unsoundness, and clean up some stuff (#26)
* Fix warnings and remove unsafe code
* Eliminate duplicate structs already in libc; fix incorrect eviocgbit lengths, remove transmute
* Avoid hiding unsafe behind macros; use File rather than libc::open
* Change signatures of eviocgbit and eviocgabs to take slices; use align_to_mut to more safely cast slices
* Replace do_ioctl_buf! with wrapper fn
* Add a sanity check for align_to_mut
* Fix incorrect slice casts, add debug asserts for sanity
* Bump revision
2021-02-22 10:57:25 -07:00
Jeff Hiner
4e700d4671
Edition 2018 (#25)
* Edition 2018
* cargo fmt
* Bump rev to 0.11.0-alpha-2
* Change FF_MAX and KEY_MAX to associated constants
2021-02-20 19:26:34 -07:00
Jeff Hiner
fe3d0e9ab0
Update dependencies and fix cross-compatibility issues (#24)
* Update dependencies and fix some cross-compatibility issues
* version 0.11.0-alpha.1
2021-02-20 19:09:39 -07:00
ember arlynx
e55142087e
Merge pull request #23 from AnyTimeTraveler/master
Fix mismatched types when compiling for arm
2021-02-08 13:03:16 -08:00
Simon Struck
f8c06ece87
Fix mismatched types when compiling for arm 2021-02-08 20:39:43 +01:00
ember arlynx
d4cb5004a9
Merge pull request #21 from LinusCDE/master
Force to request absinfo also onmultitouch axes
2020-12-25 12:46:44 -08:00
Linus
43fb0b3399 Force to request absinfo also onmultitouch axes
The dev before me left a comment on handling that
later. Not sure if there is any special case that
needed to be implemented which I now completly
ignored.
2020-11-04 22:23:08 +01:00
ember arlynx
62bb393491
Merge pull request #8 from myfreeweb/master
Adds some bugs!
2020-05-03 22:34:15 -07:00
Corey Richardson
f85abbf1df
Merge pull request #15 from nowakf/relativeaxis
Missing constants for relative axes
2019-07-01 00:24:57 -07:00
Francis Nicholson
4fbd562393 Missing constants for relative axes
I added some of the missing event codes from input-event-codes.h.  Their
omission causes the library to panic with some input devices.
2019-06-30 13:05:59 +02:00
Greg V
13c09cf350 Fix warnings 2017-12-01 23:06:03 +03:00
Greg V
e5e7332952 Update nix to 0.9, support FreeBSD
nix 0.9's ioctl macro works with buffers now.
2017-12-01 22:44:06 +03:00
Corey Richardson
04761b788f
Bump version to 0.10.1 2017-06-17 09:12:13 -04:00
Corey Richardson
b8184e919b Merge pull request #6 from Ralith/fix-abs-sync
Fix sync of absolute axis states
2017-05-30 22:51:08 -04:00
Benjamin Saunders
ca1b1f2342 Fix sync of absolute axis states 2017-05-30 18:33:15 -07:00
Corey Richardson
591d1428c2
Bail out of compensate_dropped if no events were dropped 2017-05-28 17:52:38 -04:00
Corey Richardson
fc27acc715
Remove vestigal debug printlns 2017-05-28 17:52:20 -04:00
Corey Richardson
c6076443aa
Fix tv_usec calculation 2017-05-28 17:49:36 -04:00
Corey Richardson
d9c9225fa0
Don't die if there is no phys name either 2017-05-28 17:28:28 -04:00
Corey Richardson
53b4a6d65e
Don't die if there is no unique name 2017-05-28 17:25:54 -04:00
Corey Richardson
3e15ed1f1d
Remove bogus Fd struct that wasn't ever useful 2017-05-28 17:20:12 -04:00
Corey Richardson
9ff9cf4718
Initial port to nix 2017-05-28 16:05:28 -04:00
Corey Richardson
0c166f7726
Use O_CLOEXEC instead of the non-atomic ioctl fioclex 2017-04-27 20:13:32 -04:00
Corey Richardson
60a7523d4b
Fix all the current issues:
Changes in Rust, changes in the evdev ABI, and a bug
2017-04-27 19:42:45 -04:00
Corey Richardson
ee5bab2689 Bump version 2015-07-21 12:06:18 -04:00
Corey Richardson
341be8cbfb Add number method to every bitflag 2015-07-21 12:04:26 -04:00
Corey Richardson
f3918d09a8 Comment about EV_REL 2015-07-21 08:22:12 -04:00
Corey Richardson
74479a89b5 Didn't mean to commit that yet but fix it anyway 2015-07-21 08:14:48 -04:00
Corey Richardson
43e8f958e7 Add GH_TOKEN 2015-07-21 08:07:36 -04:00
Corey Richardson
519a61b937 Fix badge links 2015-07-21 07:39:03 -04:00
Corey Richardson
92ac2d0c6a Note Rust support in README 2015-07-21 05:53:09 -04:00
Corey Richardson
704bc42ca3 Yank stable support :( 2015-07-21 05:47:33 -04:00
Corey Richardson
6ba2f72dbf Fix some casting issues on stable 2015-07-21 05:45:12 -04:00
Corey Richardson
66887f5771 Add scancodes.rs (missing from git-add) 2015-07-21 05:40:27 -04:00
Corey Richardson
9c72b1ca0b Version 0.9.0 2015-07-21 05:39:18 -04:00
Corey Richardson
18a063fb17 Use ioctl from crates.io 2015-07-21 05:38:58 -04:00