From ccd453cd598d9a0f0d28cc51ef9b1d46e4c378c7 Mon Sep 17 00:00:00 2001 From: Niklas Kapelle Date: Wed, 23 Apr 2025 16:54:11 +0200 Subject: [PATCH] add option to set pm3 binary --- src/pm3.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pm3.rs b/src/pm3.rs index 5b34941..e067e1a 100644 --- a/src/pm3.rs +++ b/src/pm3.rs @@ -1,3 +1,4 @@ +use std::env; use std::error::Error; use std::io::{self, BufRead}; use std::process::{Command, Stdio}; @@ -6,9 +7,17 @@ use tokio::time::{Duration, sleep}; use tokio::sync::mpsc; pub async fn run_pm3(tx: mpsc::Sender) -> Result<(), Box> { + let pm3_path = match env::var("PM3_BIN") { + Ok(path) => path, + Err(_) => { + println!("PM3_BIN not set. Using default value"); + "pm3".to_owned() + }, + }; + let mut cmd = Command::new("stdbuf") .arg("-oL") - .arg("pm3") + .arg(pm3_path) .arg("-c") .arg("lf hitag reader -@") .stdout(Stdio::piped())