From 1381e883e14d54678a73d46126800b4b80686e98 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 14 Jun 2026 14:24:15 +0100 Subject: [PATCH] Bind Move health to configured source path --- crates/muninn-daemon/src/main.rs | 16 ++++++++++++---- crates/odin-core/src/documents.rs | 2 ++ scripts/health-nightwing-muninn.ps1 | 2 +- scripts/restart-nightwing-muninn.ps1 | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/crates/muninn-daemon/src/main.rs b/crates/muninn-daemon/src/main.rs index 972e08a..68eda4b 100644 --- a/crates/muninn-daemon/src/main.rs +++ b/crates/muninn-daemon/src/main.rs @@ -704,6 +704,7 @@ fn build_move_controller_state_record( buttons: move_button_names(report), battery01: move_battery01(report.get(12).copied().unwrap_or_default()), observed_at, + source_path: source.hidraw_path.clone(), } } @@ -732,6 +733,7 @@ fn build_move_controller_state_record_from_joystick( buttons: joystick_button_names(buttons), battery01: f32::NAN, observed_at, + source_path: source.hidraw_path.clone(), } } @@ -1216,12 +1218,17 @@ fn verify_move_sources_fresh( for source in &options.move_state_sources { let latest = states .iter() - .filter(|state| state.host_id == options.host_id && state.move_id == source.move_id) + .filter(|state| { + state.host_id == options.host_id + && state.move_id == source.move_id + && state.source_path == source.hidraw_path + }) .max_by_key(|state| unix_timestamp_sort_key(&state.observed_at)) .ok_or_else(|| { anyhow!( - "Muninn Move source {} has no controller-state records", - source.move_id + "Muninn Move source {} at {} has no controller-state records", + source.move_id, + source.hidraw_path ) })?; let observed_seconds = parse_unix_timestamp(&latest.observed_at).with_context(|| { @@ -1318,10 +1325,11 @@ fn move_state_status(options: Options) -> Result<()> { } for state in states { println!( - "{} seq={} move={} buttons=[{}] trigger={:.3} accel={:?} gyro={:?} battery={:.3} observed={}", + "{} seq={} move={} source={} buttons=[{}] trigger={:.3} accel={:?} gyro={:?} battery={:.3} observed={}", state.stream_id, state.sequence, state.move_id, + state.source_path, state.buttons.join(","), state.trigger_value, state.accelerometer_xyz, diff --git a/crates/odin-core/src/documents.rs b/crates/odin-core/src/documents.rs index cf85fc6..07954a0 100644 --- a/crates/odin-core/src/documents.rs +++ b/crates/odin-core/src/documents.rs @@ -484,6 +484,8 @@ pub struct MuninnMoveControllerStateRecord { pub battery01: f32, #[cultcache(key = 11)] pub observed_at: String, + #[cultcache(key = 12, default)] + pub source_path: String, } #[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)] diff --git a/scripts/health-nightwing-muninn.ps1 b/scripts/health-nightwing-muninn.ps1 index d1fc0d7..08f3be9 100644 --- a/scripts/health-nightwing-muninn.ps1 +++ b/scripts/health-nightwing-muninn.ps1 @@ -3,7 +3,7 @@ param( [string] $MuninnExe = "/home/metacrat/.local/bin/muninn", [string] $StorePath = "/home/metacrat/.local/state/gamecult/muninn/muninn.telemetry.cc", [string] $PidPath = "/home/metacrat/.local/state/gamecult/muninn/muninn.pid", - [string] $MoveState = "move-usb=/dev/input/by-id/usb-Sony_Computer_Entertainment_Motion_Controller-joystick", + [string] $MoveState = "move-usb=/dev/hidraw1", [int] $IntervalSeconds = 15 ) diff --git a/scripts/restart-nightwing-muninn.ps1 b/scripts/restart-nightwing-muninn.ps1 index 03a09d6..ac7ec64 100644 --- a/scripts/restart-nightwing-muninn.ps1 +++ b/scripts/restart-nightwing-muninn.ps1 @@ -3,7 +3,7 @@ param( [string] $MuninnExe = "/home/metacrat/.local/bin/muninn", [string] $StorePath = "/home/metacrat/.local/state/gamecult/muninn/muninn.telemetry.cc", [string] $LogRoot = "/home/metacrat/.local/state/gamecult/muninn", - [string] $MoveState = "move-usb=/dev/input/by-id/usb-Sony_Computer_Entertainment_Motion_Controller-joystick", + [string] $MoveState = "move-usb=/dev/hidraw1", [string] $MoveEvidenceStream = "muninn:nightwing:move-evidence", [int] $IntervalSeconds = 15 )