Skip to content

Commit

Permalink
Ensure cir decode irp uses the timeout from lirc device
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Young <[email protected]>
  • Loading branch information
seanyoung committed May 6, 2024
1 parent c47cb0d commit 681038f
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/bin/commands/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ pub fn decode_irp(decode: &crate::Decode, irp_str: &String) {
}
};

let input_on_cli = !decode.file.is_empty() || !decode.rawir.is_empty();

#[cfg(target_os = "linux")]
let lircdev = open_lirc(input_on_cli, decode, &mut abs_tolerance, &mut max_gap);

#[cfg(not(target_os = "linux"))]
if !input_on_cli {
eprintln!("no infrared input provided");
std::process::exit(2);
}

let mut options = Options {
name: "irp",
aeps: abs_tolerance,
Expand All @@ -44,17 +55,6 @@ pub fn decode_irp(decode: &crate::Decode, irp_str: &String) {
}
};

let input_on_cli = !decode.file.is_empty() || !decode.rawir.is_empty();

#[cfg(target_os = "linux")]
let lircdev = open_lirc(input_on_cli, decode, &mut abs_tolerance, &mut max_gap);

#[cfg(not(target_os = "linux"))]
if !input_on_cli {
eprintln!("no infrared input provided");
std::process::exit(2);
}

let mut decoder = Decoder::new(options);

let mut feed_decoder = |raw: &[InfraredData]| {
Expand Down

0 comments on commit 681038f

Please sign in to comment.