mirror of
https://codeberg.org/icewind/evtype.git
synced 2026-06-03 09:34:11 +02:00
reduce dependencies
This commit is contained in:
parent
830c4e1d68
commit
f4fb676799
5 changed files with 10 additions and 138 deletions
126
Cargo.lock
generated
126
Cargo.lock
generated
|
|
@ -46,20 +46,6 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "err-derive"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82f46c91bbed409ee74495549acbfcc7fae856e712e1df15afe75d0775eedc6c"
|
||||
dependencies = [
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote 1.0.3",
|
||||
"rustversion",
|
||||
"syn 1.0.16",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "evdev"
|
||||
version = "0.10.1"
|
||||
|
|
@ -79,7 +65,6 @@ name = "evtype"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"ctrlc",
|
||||
"err-derive",
|
||||
"evdev",
|
||||
"main_error",
|
||||
"nix 0.9.0",
|
||||
|
|
@ -212,56 +197,12 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "0.4.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7959c6467d962050d639361f7703b2051c43036d03493c36f01d440fdd3138a"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote 1.0.3",
|
||||
"syn 1.0.16",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr"
|
||||
version = "0.4.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4002d9f55991d5e019fb940a90e1a95eb80c24e77cb2462dd4dc869604d543a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote 1.0.3",
|
||||
"syn 1.0.16",
|
||||
"syn-mid",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.4.6"
|
||||
|
|
@ -305,17 +246,6 @@ version = "0.3.24"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
|
||||
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote 1.0.3",
|
||||
"syn 1.0.16",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.8.0"
|
||||
|
|
@ -328,8 +258,8 @@ version = "0.8.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3384590878eb0cab3b128e844412e2d010821e7e091211b9d87324173ada7db8"
|
||||
dependencies = [
|
||||
"quote 0.3.15",
|
||||
"syn 0.11.11",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -338,31 +268,9 @@ version = "0.11.11"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||
dependencies = [
|
||||
"quote 0.3.15",
|
||||
"quote",
|
||||
"synom",
|
||||
"unicode-xid 0.0.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "123bd9499cfb380418d509322d7a6d52e5315f064fe4b3ad18a53d6b92c07859"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote 1.0.3",
|
||||
"unicode-xid 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn-mid"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7be3539f6c128a931cf19dcee741c1af532c7fd387baa739c03dd2e96479338a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote 1.0.3",
|
||||
"syn 1.0.16",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -371,19 +279,7 @@ version = "0.11.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
|
||||
dependencies = [
|
||||
"unicode-xid 0.0.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "synstructure"
|
||||
version = "0.12.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote 1.0.3",
|
||||
"syn 1.0.16",
|
||||
"unicode-xid 0.2.0",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -392,18 +288,6 @@ version = "0.0.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce"
|
||||
|
||||
[[package]]
|
||||
name = "void"
|
||||
version = "1.0.2"
|
||||
|
|
|
|||
|
|
@ -15,6 +15,5 @@ path = "src/client.rs"
|
|||
[dependencies]
|
||||
evdev = { git = "https://github.com/myfreeweb/evdev", branch = "uinput" }
|
||||
nix = "0.9.0"
|
||||
err-derive = "0.2.3"
|
||||
main_error = "0.1.0"
|
||||
ctrlc = "3.1.4"
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
use err_derive::Error;
|
||||
|
||||
#[derive(Clone, Debug, Error)]
|
||||
pub enum Error {
|
||||
#[error(display = "Unsupported character '{}'", _0)]
|
||||
UnknownCharacter(char),
|
||||
#[error(display = "Error sending keycode: {}", _0)]
|
||||
Evdev(#[error(source)] nix::Error),
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
use crate::common::Error;
|
||||
use crate::keyboard::{char_to_key, create_device};
|
||||
use evdev::{data, raw, uinput};
|
||||
use main_error::MainError;
|
||||
|
|
@ -10,12 +9,11 @@ use std::os::unix::net::UnixListener;
|
|||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
|
||||
mod common;
|
||||
mod keyboard;
|
||||
|
||||
const TYPE_DELAY: Duration = Duration::from_millis(10);
|
||||
|
||||
fn type_string(dev: &mut uinput::Device, text: &str) -> Result<(), Error> {
|
||||
fn type_string(dev: &mut uinput::Device, text: &str) -> Result<(), MainError> {
|
||||
for c in text.chars() {
|
||||
let (key, shift) = char_to_key(c)?;
|
||||
dev.write(data::KEY, key as u16, 1)?;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
use crate::common::Error;
|
||||
use evdev::raw::uinput_setup;
|
||||
use evdev::{
|
||||
data,
|
||||
uinput::{Builder, Device},
|
||||
uinput_ioctl,
|
||||
};
|
||||
use main_error::MainError;
|
||||
|
||||
pub fn char_to_key(c: char) -> Result<(data::Key, bool), Error> {
|
||||
pub fn char_to_key(c: char) -> Result<(data::Key, bool), MainError> {
|
||||
match c {
|
||||
'0' => Ok((data::KEY_0, false)),
|
||||
'1' => Ok((data::KEY_1, false)),
|
||||
|
|
@ -104,11 +104,11 @@ pub fn char_to_key(c: char) -> Result<(data::Key, bool), Error> {
|
|||
'?' => Ok((data::KEY_SLASH, true)),
|
||||
' ' => Ok((data::KEY_SPACE, false)),
|
||||
'\n' => Ok((data::KEY_ENTER, false)),
|
||||
c => Err(Error::UnknownCharacter(c)),
|
||||
_ => Err("Invalid character".to_string().into()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_device() -> Result<Device, Error> {
|
||||
pub fn create_device() -> Result<Device, MainError> {
|
||||
let mut conf = uinput_setup::default();
|
||||
conf.set_name("EvType")?;
|
||||
conf.id.bustype = 0x16;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue