2021-01-20 04:20:18 +01:00
|
|
|
use {
|
2022-03-19 22:08:33 +01:00
|
|
|
anyhow::{bail, Context, Result},
|
2022-03-27 18:31:48 +02:00
|
|
|
libdvb_rs::{FeDevice, FeStatus},
|
2022-03-19 22:08:33 +01:00
|
|
|
std::{thread, time::Duration},
|
2021-01-20 04:20:18 +01:00
|
|
|
};
|
|
|
|
|
2021-03-07 23:04:58 +01:00
|
|
|
fn main() -> Result<()> {
|
|
|
|
let mut args = std::env::args().skip(1);
|
|
|
|
|
|
|
|
let adapter = match args.next() {
|
|
|
|
Some(v) => v.parse::<u32>().context("adapter number")?,
|
|
|
|
None => bail!("adapter number not defined"),
|
|
|
|
};
|
2021-01-20 04:20:18 +01:00
|
|
|
|
2021-03-07 23:04:58 +01:00
|
|
|
let device = match args.next() {
|
|
|
|
Some(v) => v.parse::<u32>().context("device number")?,
|
|
|
|
None => 0,
|
|
|
|
};
|
|
|
|
|
2021-03-16 09:43:37 +01:00
|
|
|
let fe = FeDevice::open_ro(adapter, device)?;
|
2021-01-20 04:20:18 +01:00
|
|
|
let mut status = FeStatus::default();
|
|
|
|
|
|
|
|
let delay = Duration::from_secs(1);
|
|
|
|
loop {
|
|
|
|
status.read(&fe)?;
|
2021-01-29 18:45:49 +01:00
|
|
|
println!("{}", &status);
|
2021-01-20 04:20:18 +01:00
|
|
|
thread::sleep(delay);
|
|
|
|
}
|
|
|
|
}
|