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

ioctl_diseqc_master_cmd

This commit is contained in:
Andrey Dyldin 2021-01-20 22:41:25 +02:00
parent 3037f42446
commit 111ebb256f
2 changed files with 34 additions and 0 deletions

View File

@ -372,6 +372,34 @@ impl FeDevice {
self.ioctl(FE_GET_PROPERTY, cmd.as_mut_ptr())
}
/// Sets DiSEqC master command
///
/// `msg` is a message no more 6 bytes length
///
/// Example DiSEqC commited command:
///
/// ```
/// [0xE0, 0x10, 0x38, 0xF0 | value]
/// ```
///
/// - byte 1 is a framing (master command without response)
/// - byte 2 is an address (any LNB)
/// - byte 3 is a command (commited)
/// - last 4 bits of byte 4 is:
/// - xx00 - switch input
/// - 00x0 - bit is set on SEC_VOLTAGE_18
/// - 000x - bit is set on SEC_TONE_ON
///
pub fn ioctl_diseqc_master_cmd(&self, msg: &[u8]) -> Result<()> {
let mut cmd = DiseqcMasterCmd::default();
debug_assert!(msg.len() <= cmd.msg.len());
cmd.msg[0 .. msg.len()].copy_from_slice(msg);
cmd.len = msg.len() as u8;
self.ioctl(FE_DISEQC_SEND_MASTER_CMD, cmd.as_ptr())
}
/// Returns the current API version
/// major - first byte
/// minor - second byte

View File

@ -177,6 +177,12 @@ impl Default for DiseqcMasterCmd {
}
impl DiseqcMasterCmd {
#[inline]
pub fn as_ptr(&self) -> *const DiseqcMasterCmd { self as *const _ }
}
/// DiSEqC received data
#[repr(C)]
#[derive(Debug)]