diff --git a/qemu/src/lib.rs b/qemu/src/lib.rs index 6a84bd4..d83cc49 100644 --- a/qemu/src/lib.rs +++ b/qemu/src/lib.rs @@ -137,7 +137,7 @@ impl Qemu { match events.recv().await { Ok(qapi::qmp::Event::DEVICE_DELETED { ref data, .. }) if data.device.as_ref() == Some(&id) => { // work around qemu bug. without this delay, device_add will work but the new device might be immediately deleted - sleep(Duration::from_millis(128)).await; + sleep(Duration::from_millis(256)).await; break Ok(()) }, diff --git a/src/main.rs b/src/main.rs index 3dc30a2..ed87aaa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -161,8 +161,8 @@ async fn main_result(spawner: &Arc) -> Result { }; let repeat = false; - let bus = None; - let mut route_keyboard = Route::new(config.qemu.routing, qemu.clone(), "screenstub-route-kbd".into(), bus.clone(), repeat); + //let bus = None; + let mut route_keyboard = Route::new(config.qemu.routing, qemu.clone(), "screenstub-route-kbd".into(), Some("pci.23".into()), repeat); if let Some(builder) = route_keyboard.builder() { builder .name("screenstub-kbd") @@ -171,7 +171,7 @@ async fn main_result(spawner: &Arc) -> Result { } let mut events_keyboard = route_keyboard.spawn(spawner, error_sender.clone()); - let mut route_relative = Route::new(config.qemu.routing, qemu.clone(), "screenstub-route-mouse".into(), bus.clone(), repeat); + let mut route_relative = Route::new(config.qemu.routing, qemu.clone(), "screenstub-route-mouse".into(), Some("pci.22".into()), repeat); if let Some(builder) = route_relative.builder() { builder .name("screenstub-mouse") @@ -180,7 +180,7 @@ async fn main_result(spawner: &Arc) -> Result { } let mut events_relative = route_relative.spawn(spawner, error_sender.clone()); - let mut route_absolute = Route::new(config.qemu.routing, qemu.clone(), "screenstub-route-tablet".into(), bus, repeat); + let mut route_absolute = Route::new(config.qemu.routing, qemu.clone(), "screenstub-route-tablet".into(), Some("pci.21".into()), repeat); if let Some(builder) = route_absolute.builder() { builder .name("screenstub-tablet") diff --git a/src/route.rs b/src/route.rs index 0448b52..417c197 100644 --- a/src/route.rs +++ b/src/route.rs @@ -180,12 +180,10 @@ pub struct RouteUInputVirtio { impl UInputCommands for RouteUInputVirtio { fn command_create(&self, qemu: &Arc, path: &Path) -> Pin> + Send>> { - let name = match self.bus.is_some() { - true => "virtio-input-host-device", // TODO: double-check this, what is the virtio bus for? - false => "virtio-input-host-pci", - }; - let command = qmp::device_add::new(name, Some(self.id.clone()), self.bus.clone(), vec![ + let name = "virtio-input-host-pci"; + let command = qmp::device_add::new(name,Some(self.id.clone()) , self.bus.clone(), vec![ ("evdev".into(), Any::String(path.display().to_string())), + //("addr".into(), Any::String("3".to_string())) ]); let deadline = Instant::now() + Duration::from_millis(512); // HACK: wait for udev to see device and change permissions let qemu = qemu.clone(); @@ -213,12 +211,15 @@ pub struct RouteUInputInputLinux { impl UInputCommands for RouteUInputInputLinux { fn command_create(&self, qemu: &Arc, path: &Path) -> Pin> + Send>> { let path = path.display(); - let command = qmp::object_add::new(&self.id, "input-linux", vec![ + let command = qmp::object_add::new("input-linux", &self.id, vec![ ("evdev".into(), Any::String(path.to_string())), ("repeat".into(), Any::Bool(self.repeat)), ]); let qemu = qemu.clone(); + let id_ = self.id.clone(); async move { + let _ = qemu.execute_qmp(qmp::object_del { id: id_ }).await; + tokio::time::sleep(Duration::from_millis(512)).await; qemu.execute_qmp(command).map_ok(drop).await }.boxed() } @@ -283,7 +284,7 @@ pub enum Route { impl Route { pub fn new(routing: ConfigQemuRouting, qemu: Arc, id: String, bus: Option, repeat: bool) -> Self { match routing { - ConfigQemuRouting::InputLinux => Route::InputLinux(RouteUInput::new_input_linux(qemu, id, repeat)), + ConfigQemuRouting::InputLinux => Route::InputLinux(RouteUInput::new_input_linux(qemu, id, false)), ConfigQemuRouting::VirtioHost => Route::VirtioHost(RouteUInput::new_virtio_host(qemu, id, bus)), ConfigQemuRouting::Qmp => Route::Qmp(RouteQmp::new(qemu)), ConfigQemuRouting::Spice => unimplemented!("SPICE routing"), diff --git a/x/src/lib.rs b/x/src/lib.rs index a517922..c37b951 100644 --- a/x/src/lib.rs +++ b/x/src/lib.rs @@ -88,7 +88,7 @@ pub struct XContext { window: xcore::Window, ext_input: xcore::QueryExtensionReply, ext_test: xcore::QueryExtensionReply, - ext_dpms: xcore::QueryExtensionReply, +// ext_dpms: xcore::QueryExtensionReply, ext_xkb: xcore::QueryExtensionReply, setup: xcore::Setup, @@ -128,8 +128,8 @@ impl XContext { .expect("XKB required"); let ext_test = sink.extension(ExtensionKind::Test).await.await? .expect("XTest required"); - let ext_dpms = sink.extension(ExtensionKind::DPMS).await.await? - .expect("DPMS required"); + // let ext_dpms = sink.extension(ExtensionKind::DPMS).await.await? +// .expect("DPMS required"); let _ = sink.execute(xinput::XIQueryVersionRequest { major_opcode: ext_input.major_opcode, major_version: 2, @@ -211,7 +211,7 @@ impl XContext { ext_input, ext_test, ext_xkb, - ext_dpms, + // ext_dpms, display, sink, @@ -506,13 +506,14 @@ impl XContext { Ok(match event { ExtensionEvent::Core(xcore::Events::VisibilityNotify(event)) => { - let dpms_blank = { +/* let dpms_blank = { let info = self.sink.execute(dpms::InfoRequest { major_opcode: self.ext_dpms.major_opcode, }).await.await?; info.power_level.get() != dpms::DPMSMode::On - }; + };*/ + let dpms_blank = false; self.event_queue.push(if dpms_blank { XEvent::Visible(false) } else {