feat: add libinput support

Signed-off-by: sisungo <[email protected]>
This commit is contained in:
2026-09-30 00:23:36 +00:00
parent cb4c459175
commit 5700a89954
17 changed files with 675 additions and 201 deletions
+1
View File
@@ -9,3 +9,4 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "2"
tokio = { version = "1", features = ["net", "io-util"] }
rustc-hash = "2"
+9
View File
@@ -3,6 +3,7 @@ use crate::{
repr::{Error, Request, de_reply},
};
use rule::parser::When;
use rustc_hash::FxHashMap;
use serde::de::DeserializeOwned;
use std::{
io::{Read, Write},
@@ -26,6 +27,10 @@ impl Client {
})
}
pub fn inner(&self) -> &UnixStream {
&self.stream
}
pub fn send(&mut self, req: &Request) -> std::io::Result<()> {
self.buf.clear();
serde_json::to_writer(&mut self.buf, req).unwrap();
@@ -61,6 +66,10 @@ impl Client {
self.invoke(&Request::ListDevices(when))
}
pub fn get_device(&mut self, name: String) -> Result<FxHashMap<String, String>, Error> {
self.invoke(&Request::GetDevice(name))
}
pub fn wait_for_idle(&mut self) -> Result<(), Error> {
self.invoke(&Request::WaitForIdle)
}
+6
View File
@@ -15,6 +15,12 @@ pub enum Request {
#[serde(rename = "/org.semilabs.os/LxDeviced/WaitForIdle@LXDEVICED_0.1.0")]
WaitForIdle,
#[serde(rename = "/org.semilabs.os/LxDeviced/WaitForEvent@LXDEVICED_0.1.0")]
WaitForEvent,
#[serde(rename = "/org.semilabs.os/LxDeviced/GetDevice@LXDEVICED_0.1.0")]
GetDevice(String),
}
pub fn ser_reply<T: Serialize>(result: Result<T, Error>) -> String {