Commit graph

50 commits

Author SHA1 Message Date
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
Simon Struck
f8c06ece87
Fix mismatched types when compiling for arm 2021-02-08 20:39:43 +01: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
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
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
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
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
1ee9a10343 Hide compensate_dropped from public API 2015-07-21 05:26:47 -04:00
Corey Richardson
45a27eeb17 Implement SYN_DROPPED synchronization 2015-07-21 05:19:07 -04:00
Corey Richardson
bbbd03d0de Use a wrapper around ffs instead of ffs directly
Also exposes it to users.
2015-07-21 05:19:07 -04:00
Corey Richardson
660a0d55d1 Add some more crate-level docs 2015-07-21 05:19:07 -04:00
Corey Richardson
8ca586c485 Shuffle around device state into its own type 2015-07-21 05:19:07 -04:00
Corey Richardson
efd8d1d8f0 Reexport enum values 2015-07-21 05:19:07 -04:00
Corey Richardson
554f3446af Lots of documentation! Also nuke the unstable RawEvents 2015-07-21 05:19:07 -04:00
Corey Richardson
d556b9dcab [fix] Do error handling in fill_events and raw_events 2015-07-21 05:19:06 -04:00
Corey Richardson
9839b61bac [fix] Used == 1 instead of != 0 when checking if a bit was set via mask 2015-07-21 05:19:06 -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
Corey Richardson
4978b2a405 Initial commit 2015-05-29 14:57:46 -04:00