1
0
mirror of https://github.com/danog/libdvb.git synced 2024-11-26 20:04:39 +01:00

examples/cainfo: initial commit

This commit is contained in:
Andrey Dyldin 2021-01-29 22:50:57 +02:00
parent 95bc2c59f7
commit 0aef88bedb
3 changed files with 37 additions and 3 deletions

36
examples/cainfo.rs Normal file
View File

@ -0,0 +1,36 @@
use {
std::{
path::Path,
},
anyhow::{
Context,
Result,
},
libdvb::{
CaDevice,
},
};
fn check_ca(path: &Path) -> Result<()> {
println!("CA: {}", path.display());
let ca = CaDevice::open(path, 0)?;
Ok(())
}
fn main() -> Result<()> {
let mut args = std::env::args().skip(1);
if let Some(path) = args.next() {
let path = Path::new(path);
check_ca(&path)?;
} else {
eprintln!("path to ca device is not defined");
}
Ok(())
}

View File

@ -25,8 +25,6 @@ fn check_frontend(path: &Path) -> Result<()> {
status.read(&fe)?;
println!("{}", &status);
dbg!(&status);
Ok(())
}

View File

@ -110,7 +110,7 @@ impl CaDevice {
Ok(())
}
pub fn new(path: &Path, slot_id: u8) -> Result<CaDevice> {
pub fn open(path: &Path, slot_id: u8) -> Result<CaDevice> {
let file = OpenOptions::new()
.read(true)
.write(true)