pub struct LircMode2 { /* private fields */ }
Expand description
A program used to decode IR into key events for a lirc device.
LircMode2
programs can be used to inspect infrared pulses, spaces,
and timeouts received by a lirc IR receiver.
Minimum kernel version
The minimum kernel version required to use this feature is 4.18.
Examples
use std::fs::File;
use std::convert::TryInto;
use aya::programs::LircMode2;
let file = File::open("/dev/lirc0")?;
let mut bpf = aya::Bpf::load_file("imon_rsc.o")?;
let decoder: &mut LircMode2 = bpf.program_mut("imon_rsc").unwrap().try_into().unwrap();
decoder.load()?;
decoder.attach(file)?;
Implementations
sourceimpl LircMode2
impl LircMode2
sourcepub fn load(&mut self) -> Result<(), ProgramError>
pub fn load(&mut self) -> Result<(), ProgramError>
Loads the program inside the kernel.
sourcepub fn attach<T: AsRawFd>(
&mut self,
lircdev: T
) -> Result<LircLinkId, ProgramError>
pub fn attach<T: AsRawFd>(
&mut self,
lircdev: T
) -> Result<LircLinkId, ProgramError>
Attaches the program to the given lirc device.
The returned value can be used to detach, see LircMode2::detach.
sourcepub fn detach(&mut self, link_id: LircLinkId) -> Result<(), ProgramError>
pub fn detach(&mut self, link_id: LircLinkId) -> Result<(), ProgramError>
Detaches the program.
See LircMode2::attach.
sourcepub fn take_link(
&mut self,
link_id: LircLinkId
) -> Result<OwnedLink<LircLink>, ProgramError>
pub fn take_link(
&mut self,
link_id: LircLinkId
) -> Result<OwnedLink<LircLink>, ProgramError>
Takes ownership of the link referenced by the provided link_id.
The link will be detached on Drop
and the caller is now responsible
for managing its lifetime.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for LircMode2
impl Send for LircMode2
impl Sync for LircMode2
impl Unpin for LircMode2
impl UnwindSafe for LircMode2
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more