# HG changeset patch # User flub@devork.be # Date 1562503348 -7200 # Sun Jul 07 14:42:28 2019 +0200 # Node ID 1d44fb2ec44f10f4e9c988a18fa81f8335b20d85 # Parent 8f49f3a29406d31649425a1afb887a020bed69bc Remove this temp binary again diff --git a/src/bin/acpid-client.rs b/src/bin/acpid-client.rs deleted file mode 100644 --- a/src/bin/acpid-client.rs +++ /dev/null @@ -1,38 +0,0 @@ -extern crate failure; - -use std::os::unix::net::UnixStream; - -use std::io::prelude::*; - -fn main() { - let argv: Vec = std::env::args().collect(); - run(argv).unwrap_or_else(|err| { - print_error(err); - std::process::exit(1); - }); -} - -fn run(_argv: Vec) -> Result<(), failure::Error> { - let stream = UnixStream::connect("/run/acpid.socket").unwrap(); - println!("peer: {:?}", stream.peer_addr()); - let buffer = std::io::BufReader::new(stream); - let lines_iter = buffer.split('\n' as u8); - for bytes in lines_iter { - // println!("read line from buf: {:?}", bytes); - let bytes = bytes.unwrap(); - if bytes.starts_with(b"video/brightnessup BRTUP") { - println!("up"); - }; - if bytes.starts_with(b"video/brightnessdown BRTDN") { - println!("down"); - }; - } - Ok(()) -} - -fn print_error(err: failure::Error) { - eprintln!("{}", err); - for cause in err.iter_causes() { - eprintln!("{}", cause) - } -}