Commit graph

102 commits

Author SHA1 Message Date
Noa 93d8fb23e2
Merge pull request #62 from waynr/enable-showing-system-path
enable getting system path for Device
2022-01-25 12:00:02 -06:00
Wayne Warren 773e8066c5 examples: update _pick_device.rs example 2022-01-17 20:03:59 -07:00
Wayne Warren 07095dbbbc enumerate should return a tuple, (PathBuf, Device) 2022-01-16 18:35:37 -07:00
Wayne Warren 4d957a4dac Revert "RawDevice: introduce system_path() method"
This reverts commit 3a425349ec.
2022-01-16 18:35:37 -07:00
Wayne Warren 824302d0f6 Revert "Device: introduce system_path() method"
This reverts commit e3e7d339bd.
2022-01-16 18:35:37 -07:00
Wayne Warren e3e7d339bd Device: introduce system_path() method 2022-01-15 19:46:30 -07:00
Wayne Warren 3a425349ec RawDevice: introduce system_path() method 2022-01-15 17:58:52 -07:00
Noa 099b6e9a1d
Release 0.11.4 2022-01-11 23:22:05 -06:00
Noa 7186b413f8
Merge pull request #59 from emberian/bitvec-1
Upgrade to bitvec 1.0.0 (-rc1) in prep for 1.0 release in January
2022-01-11 22:57:43 -06:00
Noa a92586ab4c
bitvec 1.0 🎉 2022-01-11 22:56:55 -06:00
Noa 1d020f11b2
Release 0.11.3 2021-12-07 12:56:56 -06:00
Noa ab22becc48
Merge pull request #60 from nicokoch/master
Add `Device::send_event` and `RawDevice::send_event`.
2021-12-07 12:56:36 -06:00
Noa 7b67bfe4e2
Merge pull request #61 from nicokoch/fix_53
Update previous state during compensation.
2021-12-07 12:51:21 -06:00
Nicolas Koch cdc50aa79d Update previous state during compensation.
Fixes #53
2021-12-06 14:02:18 +01: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
Noa 898bb5c27a
Release 0.11.2 2021-12-03 21:52:09 -06:00
Noa 77d7b9f0e7
Upgrade to bitvec 1.0.0-rc1 in prep for 1.0 release in January 2021-12-03 21:50:39 -06:00
Noa 3966c797e2
Merge pull request #58 from emberian/bitvec-0.22
Upgrade to bitvec 0.22 with const generics
2021-12-03 21:50:16 -06:00
Noa 6ec00c1e33
Normalize some whitespace 2021-12-01 13:57:59 -06:00
Noa 0d88ebe5b9
Upgrade to bitvec 0.22 with const generics 2021-12-01 13:05:59 -06:00
Noa 763ef01101
Release 0.11.1 2021-10-08 15:13:17 -05:00
Jochen Kupperschmidt 436aedc606 Update nix to 0.23 2021-10-07 09:15:19 -06:00
Taiki Sugawara ecd7d1a7e4 Implement grab and ungrab 2021-08-25 10:55:41 -06:00
Noah a458675fb8 Update to nix 0.22, remove custom conversion from nix::Error -> io::Error 2021-08-09 15:22:51 -06:00
Julius Lehmann 4fbd2f17b0 Add with_switches to uinput 2021-08-09 08:58:14 -06:00
Sean Young ed4245c380
Support autorepeats and getting keymap entries (#46)
* 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>
2021-07-20 10:40:49 -06:00
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