Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
270cdca14f | |||
e9705db5ba |
@ -15,7 +15,7 @@ const HALF_KEY_SEPARATOR: char = ':';
|
|||||||
// nightly only...
|
// nightly only...
|
||||||
//pub trait KeyCode = Into<usize> + TryFrom<usize> + Copy + Clone + Eq + Hash + Default + 'static;
|
//pub trait KeyCode = Into<usize> + TryFrom<usize> + Copy + Clone + Eq + Hash + Default + 'static;
|
||||||
|
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq, Debug)]
|
||||||
pub enum KeyState {
|
pub enum KeyState {
|
||||||
DOWN,
|
DOWN,
|
||||||
UP,
|
UP,
|
||||||
@ -255,7 +255,6 @@ impl<K, T, E, R> KeyMaps<K, T, E, R>
|
|||||||
//impl KeyMapper for KeyMaps {
|
//impl KeyMapper for KeyMaps {
|
||||||
//impl KeyMaps {
|
//impl KeyMaps {
|
||||||
pub fn send_event(&mut self, mut event: &mut E, device: &K) -> Result<R> {
|
pub fn send_event(&mut self, mut event: &mut E, device: &K) -> Result<R> {
|
||||||
//println!("type: {} code: {} value: {}", event.type_, event.code, event.value);
|
|
||||||
let value = event.value();
|
let value = event.value();
|
||||||
if value != KeyState::OTHER {
|
if value != KeyState::OTHER {
|
||||||
// todo: index check here...
|
// todo: index check here...
|
||||||
|
@ -228,6 +228,7 @@ pub fn main_res() -> Result<()> {
|
|||||||
|
|
||||||
fn send_event(key_map: &mut LinuxKeyMaps, mut event: input_event, device: &Device) -> Result<()> {
|
fn send_event(key_map: &mut LinuxKeyMaps, mut event: input_event, device: &Device) -> Result<()> {
|
||||||
if event.type_ == EV_KEY_U16 {
|
if event.type_ == EV_KEY_U16 {
|
||||||
|
// println!("type: {} code: {:?} value: {:?}", event.type_, event.code(), event.value());
|
||||||
key_map.send_event(&mut event, &device)?
|
key_map.send_event(&mut event, &device)?
|
||||||
} else {
|
} else {
|
||||||
device.write_event(&mut event)?
|
device.write_event(&mut event)?
|
||||||
@ -592,6 +593,7 @@ pub fn key_map() -> HashMap<&'static str, u16> {
|
|||||||
("P0", KEY_KP0),
|
("P0", KEY_KP0),
|
||||||
("PDOT", KEY_KPDOT),
|
("PDOT", KEY_KPDOT),
|
||||||
("PENT", KEY_KPENTER),
|
("PENT", KEY_KPENTER),
|
||||||
|
("TOUCHPAD_TOGGLE", KEY_TOUCHPAD_TOGGLE),
|
||||||
].iter().cloned().map(|(m, v)| (m, v as u16)).collect()
|
].iter().cloned().map(|(m, v)| (m, v as u16)).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@ After=systemd-udevd.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStart=/usr/bin/rusty-keys
|
ExecStart=/usr/bin/rusty-keys
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1s
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=default.target
|
||||||
|
Loading…
Reference in New Issue
Block a user