Commit graph

75 commits

Author SHA1 Message Date
Sean Young
d694443d53 Convert string to key code
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>
2021-06-29 09:26:51 -06:00
ember arlynx
f93ca1f13f
Merge pull request #39 from emberian/release
Release 0.11.0
2021-05-21 12:09:57 -04:00
Jeff Hiner
1898f49b3c Release 0.11.0 2021-04-01 11:08:19 -06:00
Noah
99a025e464 Fix tokio raw_stream 2021-03-31 14:45:48 -06:00
Noah
fda0701a7c Upgrade nix to 0.20 2021-03-24 13:01:46 -06:00
Noah
9f63c9a0eb Add raw_stream::enumerate() -> Iterator<RawDevice> 2021-03-22 11:27:43 -06:00
Noah
be24cc15be Hotfix sync EventStream 2021-03-19 17:21:39 -06:00
Noah
0d964c60c6
EventStream improvements (#40)
* Add a non-syncing async stream

* Optimize sync_stream::EventStream
2021-03-19 16:56:39 -06: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
Jeff Hiner
79b6c2b403
Ergonomics (#38)
* Hide sync_* implementations, expose get_* for state

* Add get_abs_state and rustdoc

* Refactor

* Update rustdoc

Co-authored-by: Jeff Hiner <jeff-hiner@users.noreply.github.com>
2021-03-18 14:34:13 -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
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