Bind Move health to configured source path

This commit is contained in:
Meta Vens 2026-06-14 14:24:15 +01:00
commit 4b307e4841
3 changed files with 14 additions and 6 deletions

View file

@ -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,

View file

@ -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
)

View file

@ -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
)