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

FeDevice::set_tone(); FeDevice::set_voltage()

This commit is contained in:
Andrey Dyldin 2021-01-26 16:30:53 +02:00
parent 9e949b3bbd
commit 8fb4794c1c
2 changed files with 46 additions and 16 deletions

View File

@ -33,6 +33,8 @@ use {
nix::{
ioctl_read,
ioctl_write_ptr,
ioctl_write_int_bad,
request_code_none,
},
sys::*,
@ -341,6 +343,50 @@ impl FeDevice {
Ok(())
}
/// Turns on/off generation of the continuous 22kHz tone
///
/// allowed `value`'s:
///
/// - SEC_TONE_ON - turn 22kHz on
/// - SEC_TONE_OFF - turn 22kHz off
pub fn set_tone(&self, value: u32) -> Result<()> {
ioctl_write_int_bad!(#[inline] ioctl_call, request_code_none!(b'o', 66));
unsafe {
ioctl_call(self.as_raw_fd(), value as _)
}.context("frontend set tone")?;
Ok(())
}
/// Sets the DC voltage level for LNB
///
/// allowed `value`'s:
///
/// - SEC_VOLTAGE_13 for 13V
/// - SEC_VOLTAGE_18 for 18V
/// - SEC_VOLTAGE_OFF turns LNB power supply off
///
/// Different power levels used to select internal antennas for different polarizations:
///
/// - 13V:
/// - Vertical in linear LNB
/// - Right in circular LNB
/// - 18V:
/// - Horizontal in linear LNB
/// - Left in circular LNB
/// - OFF is needed with external power supply, for example
/// to use same LNB with several receivers.
pub fn set_voltage(&self, value: u32) -> Result<()> {
ioctl_write_int_bad!(#[inline] ioctl_call, request_code_none!(b'o', 67));
unsafe {
ioctl_call(self.as_raw_fd(), value as _)
}.context("frontend set voltage")?;
Ok(())
}
/// Sets DiSEqC master command
///
/// `msg` is a message no more 6 bytes length

View File

@ -734,19 +734,3 @@ impl FeEvent {
#[inline]
pub fn as_mut_ptr(&mut self) -> *mut FeEvent { self as *mut _ }
}
pub const FE_DISEQC_RESET_OVERLOAD: IoctlInt = io_none(b'o', 62);
pub const FE_DISEQC_RECV_SLAVE_REPLY: IoctlInt = io_read::<DiseqcSlaveReply>(b'o', 64);
pub const FE_DISEQC_SEND_BURST: IoctlInt = io_none(b'o', 65);
pub const FE_SET_TONE: IoctlInt = io_none(b'o', 66);
pub const FE_SET_VOLTAGE: IoctlInt = io_none(b'o', 67);
pub const FE_ENABLE_HIGH_LNB_VOLTAGE: IoctlInt = io_none(b'o', 68);
pub const FE_READ_BER: IoctlInt = io_read::<u32>(b'o', 70);
pub const FE_READ_SIGNAL_STRENGTH: IoctlInt = io_read::<u16>(b'o', 71);
pub const FE_READ_SNR: IoctlInt = io_read::<u16>(b'o', 72);
pub const FE_READ_UNCORRECTED_BLOCKS: IoctlInt = io_read::<u32>(b'o', 73);
pub const FE_SET_FRONTEND_TUNE_MODE: IoctlInt = io_none(b'o', 81);