linuxdvb: transition to diseqc send command in new code.
This commit is contained in:
parent
b200f5b393
commit
9c40f25c6f
5 changed files with 48 additions and 10 deletions
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "tvheadend.h"
|
||||
#include "linuxdvb_private.h"
|
||||
#include "diseqc.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
|
|
@ -254,6 +254,10 @@ linuxdvb_diseqc_t *linuxdvb_switch_create0
|
|||
linuxdvb_diseqc_t *linuxdvb_rotor_create0
|
||||
( const char *name, htsmsg_t *conf );
|
||||
|
||||
int
|
||||
linuxdvb_diseqc_send
|
||||
(int fd, uint8_t framing, uint8_t addr, uint8_t cmd, uint8_t len, ...);
|
||||
|
||||
/*
|
||||
* Satconf
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "tvheadend.h"
|
||||
#include "linuxdvb_private.h"
|
||||
#include "diseqc.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -143,7 +142,7 @@ static int
|
|||
linuxdvb_rotor_gotox_tune
|
||||
( linuxdvb_rotor_t *lr, linuxdvb_mux_t *lm, int fd )
|
||||
{
|
||||
if (diseqc_send_msg(fd, 0xE0, 0x31, 0x6B, lr->lr_position, 0, 0, 4)) {
|
||||
if (linuxdvb_diseqc_send(fd, 0xE0, 0x31, 0x6B, 1, (int)lr->lr_position)) {
|
||||
tvherror("linuxdvb", "failed to set GOTOX pos %d", lr->lr_position);
|
||||
return -1;
|
||||
}
|
||||
|
@ -206,7 +205,7 @@ linuxdvb_rotor_usals_tune
|
|||
fabs(pos), (pos > 0.0) ? 'E' : 'W',
|
||||
motor_angle, (motor_angle > 0.0) ? "counter-" : "");
|
||||
|
||||
if (diseqc_send_msg(fd, 0xE0, 0x31, 0x6E, angle_1, angle_2, 0, 5)) {
|
||||
if (linuxdvb_diseqc_send(fd, 0xE0, 0x31, 0x6E, 2, angle_1, angle_2)) {
|
||||
tvherror("linuxdvb", "failed to send USALS command");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "tvheadend.h"
|
||||
#include "linuxdvb_private.h"
|
||||
#include "diseqc.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -474,6 +473,44 @@ linuxdvb_diseqc_create0
|
|||
return ld;
|
||||
}
|
||||
|
||||
int
|
||||
linuxdvb_diseqc_send
|
||||
(int fd, uint8_t framing, uint8_t addr, uint8_t cmd, uint8_t len, ...)
|
||||
{
|
||||
int i;
|
||||
va_list ap;
|
||||
struct dvb_diseqc_master_cmd message;
|
||||
#if ENABLE_TRACE
|
||||
char buf[256];
|
||||
size_t c = 0;
|
||||
#endif
|
||||
|
||||
/* Build message */
|
||||
message.msg_len = len + 3;
|
||||
message.msg[0] = framing;
|
||||
message.msg[1] = addr;
|
||||
message.msg[2] = cmd;
|
||||
va_start(ap, len);
|
||||
for (i = 0; i < len; i++) {
|
||||
message.msg[3 + i] = (uint8_t)va_arg(ap, int);
|
||||
#if ENABLE_TRACE
|
||||
c += snprintf(buf + c, sizeof(buf) - c, "%02X ", message.msg[3 + i]);
|
||||
#endif
|
||||
}
|
||||
va_end(ap);
|
||||
|
||||
tvhtrace("linuxdvb", "sending diseqc (len %d) %02X %02X %02X %s",
|
||||
len + 3, framing, addr, cmd, buf);
|
||||
|
||||
/* Send */
|
||||
if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &message)) {
|
||||
tvherror("linuxdvb", "failed to send diseqc cmd (e=%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Editor Configuration
|
||||
*
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "tvheadend.h"
|
||||
#include "linuxdvb_private.h"
|
||||
#include "diseqc.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -110,16 +109,16 @@ linuxdvb_switch_tune
|
|||
|
||||
/* Uncommitted */
|
||||
if (ls->ls_uncomitted) {
|
||||
uint8_t s = 0xF0 | (ls->ls_uncomitted - 1);
|
||||
if (diseqc_send_msg(fd, 0xE0, 0x10, 0x39, s, 0, 0, 4))
|
||||
int s = 0xF0 | (ls->ls_uncomitted - 1);
|
||||
if (linuxdvb_diseqc_send(fd, 0xE0, 0x10, 0x39, 1, s))
|
||||
return -1;
|
||||
usleep(15000);
|
||||
}
|
||||
|
||||
/* Committed */
|
||||
if (ls->ls_committed) {
|
||||
uint8_t s = 0xF0 | (ls->ls_committed - 1);
|
||||
if (diseqc_send_msg(fd, 0xE0, 0x10, 0x38, s, 0, 0, 4))
|
||||
int s = 0xF0 | (ls->ls_committed - 1);
|
||||
if (linuxdvb_diseqc_send(fd, 0xE0, 0x10, 0x38, 1, s))
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue