housekeeping
This commit is contained in:
parent
9a9594b2e7
commit
4a40cf473e
1 changed files with 0 additions and 22 deletions
22
src/main.rs
22
src/main.rs
|
|
@ -1,13 +1,11 @@
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use evdev::*;
|
use evdev::*;
|
||||||
use regex::Regex;
|
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use std::{
|
use std::{
|
||||||
fs::{File, OpenOptions},
|
fs::{File, OpenOptions},
|
||||||
path::Path,
|
path::Path,
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEVICES_PATH: &str = "/proc/bus/input/devices";
|
|
||||||
const HAPTIC_PATH: &str = "/sys/class/timed_output/vibrator/enable";
|
const HAPTIC_PATH: &str = "/sys/class/timed_output/vibrator/enable";
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
|
|
@ -47,25 +45,6 @@ fn main() {
|
||||||
HAPTIC_PATH
|
HAPTIC_PATH
|
||||||
));
|
));
|
||||||
|
|
||||||
/*let devices_list: String = {
|
|
||||||
let mut str = String::new();
|
|
||||||
|
|
||||||
File::open(Path::new(DEVICES_PATH))
|
|
||||||
.expect(&format!(
|
|
||||||
"Unable to open {} to read devices list!",
|
|
||||||
DEVICES_PATH
|
|
||||||
))
|
|
||||||
.read_to_string(&mut str)
|
|
||||||
.expect(&format!("Unable to read devices list at {}!", DEVICES_PATH));
|
|
||||||
|
|
||||||
str
|
|
||||||
};
|
|
||||||
let kbd_regex = Regex::new(r"(?ms)Integrated keyboard(.*?)kbd (?<event>.*?) \n").unwrap();
|
|
||||||
let event_num = &kbd_regex.captures(&devices_list).expect(&format!(
|
|
||||||
"No valid keyboard devices found in {}",
|
|
||||||
DEVICES_PATH
|
|
||||||
))["event"];*/
|
|
||||||
|
|
||||||
let device_path = enumerate()
|
let device_path = enumerate()
|
||||||
.find(|x| {
|
.find(|x| {
|
||||||
x.1.name()
|
x.1.name()
|
||||||
|
|
@ -75,7 +54,6 @@ fn main() {
|
||||||
.expect("No valid keyboard device found")
|
.expect("No valid keyboard device found")
|
||||||
.0;
|
.0;
|
||||||
|
|
||||||
//let device_path = format!("/dev/input/{}", event_num);
|
|
||||||
let mut device =
|
let mut device =
|
||||||
Device::open(&device_path).expect(&format!("Unable to open device at {:?}", &device_path));
|
Device::open(&device_path).expect(&format!("Unable to open device at {:?}", &device_path));
|
||||||
loop {
|
loop {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue