mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
Screenstub derivation. Murmur.
This commit is contained in:
parent
09c56ccf0c
commit
bfdd94bf7e
7 changed files with 202 additions and 4 deletions
|
|
@ -4,7 +4,7 @@ let
|
|||
sources = import ../nix/sources.nix;
|
||||
pkgs = import sources.nixpkgs args;
|
||||
|
||||
overlay = self: super: {
|
||||
overlay = self: super: rec {
|
||||
dino = super.callPackage "${sources.qyliss-nixlib}/overlays/patches/dino" {
|
||||
inherit (super) dino;
|
||||
};
|
||||
|
|
@ -15,6 +15,8 @@ let
|
|||
unstable = import sources.nixpkgs-unstable { inherit (self) config; };
|
||||
nur = import sources.NUR { nurpkgs = self; pkgs = self; };
|
||||
|
||||
screenstub = unstable.callPackage ./screenstub { };
|
||||
|
||||
linuxPackagesFor = kernel:
|
||||
(super.linuxPackagesFor kernel).extend (_: ksuper: {
|
||||
vendor-reset =
|
||||
|
|
|
|||
29
pkgs/screenstub/default.nix
Normal file
29
pkgs/screenstub/default.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
fetchFromGitHub
|
||||
, rustPlatform
|
||||
, pkg-config
|
||||
, lib
|
||||
, libxcb
|
||||
, udev
|
||||
, python3
|
||||
}: rustPlatform.buildRustPackage rec {
|
||||
pname = "screenstub";
|
||||
version = "2021-01-08";
|
||||
src = fetchFromGitHub {
|
||||
owner = "arcnmx";
|
||||
repo = pname;
|
||||
rev = "e379279fedaaa1d06b1d89da4cf54752814a456f";
|
||||
sha256 = "0qv15rpazrpdspfcvyizbjdrrm2nrqz0790pa8zvp5bjsw4mvwvx";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./main.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ pkg-config python3 ];
|
||||
buildInputs = [ libxcb udev ];
|
||||
|
||||
cargoSha256 = "0yijg5v731n49ygav2cfiawnw84hxd6kvik5hmz544vikxj96bj4";
|
||||
|
||||
doCheck = false;
|
||||
}
|
||||
142
pkgs/screenstub/main.patch
Normal file
142
pkgs/screenstub/main.patch
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
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<Spawner>) -> Result<i32, Error> {
|
||||
};
|
||||
|
||||
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<Spawner>) -> Result<i32, Error> {
|
||||
}
|
||||
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<Spawner>) -> Result<i32, Error> {
|
||||
}
|
||||
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<Qemu>, path: &Path) -> Pin<Box<dyn Future<Output=Result<(), Error>> + 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<Qemu>, path: &Path) -> Pin<Box<dyn Future<Output=Result<(), Error>> + 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<Qemu>, id: String, bus: Option<String>, 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 {
|
||||
Loading…
Add table
Add a link
Reference in a new issue