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:
parent
95bc2c59f7
commit
0aef88bedb
36
examples/cainfo.rs
Normal file
36
examples/cainfo.rs
Normal 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(())
|
||||
}
|
@ -25,8 +25,6 @@ fn check_frontend(path: &Path) -> Result<()> {
|
||||
status.read(&fe)?;
|
||||
println!("{}", &status);
|
||||
|
||||
dbg!(&status);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user