mirror of
				https://github.com/Djeeberjr/fw-anwesenheit.git
				synced 2025-11-03 23:24:10 +00:00 
			
		
		
		
	add option to set pm3 binary
This commit is contained in:
		
							parent
							
								
									1d6a142178
								
							
						
					
					
						commit
						ccd453cd59
					
				
							
								
								
									
										11
									
								
								src/pm3.rs
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								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<String>) -> Result<(), Box<dyn Error>> {
 | 
			
		||||
    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())
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user