I've sent this patch to the devel list before I subscribed, but I never got a
response if it was approved so I'm sending it again if someone is interested.
I've created this pacth to support a diseqc switch behind a rotor. It works on
my system so feel free to test it and reply with results. It allows you to
specify a port of the switch in the "input connection" menu. It also fixes
one or two other things that I thought was wrong. (read the comments in the
patch)
NOTES:
- Only Positioner 1.3 with 2 LNB's as input has been tested
- for Positioner 1.2 with 2 LNB's it seemed to make more sense to have the
stored positioned store in the diseqc_pos column instead of diseqc_port
column. This allows to have the diseqc swith behind rotor 1.2.
P.S.
I'm no coder so no need to critisize my coding skills if somthing don't make
sense. I hope this helps someone and if it's good enough I hope it makes into
the svn.
diff -Naur mythtv/libs/libmythtv/dvbdiseqc.cpp mythtv-diseqc/libs/libmythtv/dvbdiseqc.cpp
--- mythtv/libs/libmythtv/dvbdiseqc.cpp 2005-12-31 20:00:34.000000000 -0600
+++ mythtv-diseqc/libs/libmythtv/dvbdiseqc.cpp 2005-12-31 19:44:44.000000000 -0600
@@ -94,6 +94,22 @@
if (!Diseqc1xSwitch(tuning, reset, havetuned, 10))
return false;
break;
+ case 10: // 1.2 Positioner (HH Motor with 2 lnbs)
+ if (!PositionerGoto(tuning,reset,havetuned))
+ return false;
+ tuning.diseqc_type = 3;
+ if (!Diseqc1xSwitch(tuning, reset, havetuned, 2))
+ return false;
+ tuning.diseqc_type = 10;
+ break;
+ case 11: // 1.3 Positioner (HH Motor with USALS with 2 lnbs)
+ if (!PositionerGotoAngular(tuning, reset, havetuned))
+ return false;
+ tuning.diseqc_type = 3;
+ if (!Diseqc1xSwitch(tuning, reset, havetuned, 2))
+ return false;
+ tuning.diseqc_type = 11;
+ break;
default:
VERBOSE(VB_IMPORTANT, LOC_ERR + "Unsupported DiSEqC type("
@@ -157,7 +173,7 @@
"Tone Switches only support two ports.");
if (ioctl(fd_frontend, FE_DISEQC_SEND_BURST,
- (tuning.diseqc_port == 1 ? SEC_MINI_A : SEC_MINI_B )) < 0)
+ (tuning.diseqc_port == 0 ? SEC_MINI_A : SEC_MINI_B )) < 0) // I think tuning.diseqc_portshould be 0 instead of 1
{
VERBOSE(VB_IMPORTANT, LOC_ERR +
"Setting Tone Switch failed." + ENO);
@@ -200,11 +216,23 @@
usleep(DISEQC_SHORT_WAIT);
+ if ((tuning.diseqc_type == 7) || (tuning.diseqc_type == 11))
+ {
+ VERBOSE(VB_CHANNEL, LOC + QString("Sending 1.3 Command: %1 %2 %3 %4 %5")
+ .arg(cmd.msg[0], 2, 16)
+ .arg(cmd.msg[1], 2, 16)
+ .arg(cmd.msg[2], 2, 16)
+ .arg(cmd.msg[3], 2, 16)
+ .arg(cmd.msg[4], 2, 16));
+ }
+ else
+ {
VERBOSE(VB_CHANNEL, LOC + QString("Sending 1.0 Command: %1 %2 %3 %4")
.arg(cmd.msg[0], 2, 16)
.arg(cmd.msg[1], 2, 16)
.arg(cmd.msg[2], 2, 16)
.arg(cmd.msg[3], 2, 16));
+ }
if (ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1)
{
@@ -217,14 +245,15 @@
// Check to see if its a 1.1 or 1.2 device. If so repeat the message repeats times.
if ((tuning.diseqc_type == 3) || (tuning.diseqc_type == 5) ||
- (tuning.diseqc_type == 6) || (tuning.diseqc_type == 7))
+ (tuning.diseqc_type == 6) || (tuning.diseqc_type == 7) ||
+ (tuning.diseqc_type == 10) || (tuning.diseqc_type == 11))
{
int repeats = repeat;
while (repeats--)
{
- if (tuning.diseqc_type == 7)
+ if (tuning.diseqc_type == 7 || (tuning.diseqc_type == 11))
{
VERBOSE(VB_CHANNEL, LOC +
QString("Sending 1.3 Repeat Command: %1 %2 %3 %4 %5")
@@ -244,7 +273,7 @@
.arg(cmd.msg[3],2,16));
}
- cmd.msg[0] = CMD_REPEAT;
+ cmd.msg[0] = CMD_REPEAT;
if (ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1)
{
VERBOSE(VB_IMPORTANT, LOC_ERR +
@@ -253,7 +282,7 @@
}
usleep(DISEQC_SHORT_WAIT);
- cmd.msg[0] = CMD_FIRST;
+ cmd.msg[0] = CMD_FIRST;
if (ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd) == -1)
{
VERBOSE(VB_IMPORTANT, LOC_ERR +
@@ -264,7 +293,9 @@
}
}
- if (ioctl(fd_frontend, FE_DISEQC_SEND_BURST, SEC_MINI_A ) == -1)
+ //this should depend on the port selected I think and not always SEC_MINI_A
+ if (ioctl(fd_frontend, FE_DISEQC_SEND_BURST,
+ (tuning.diseqc_port == 0 ? SEC_MINI_A : SEC_MINI_B )) < 0)
{
VERBOSE(VB_IMPORTANT, LOC_ERR +
"FE_DISEQC_SEND_BURST failed" + ENO);
@@ -365,11 +396,13 @@
.arg(tuning.diseqc_port)
.arg(tuning.tone==SEC_TONE_ON?"Tone ON":"Tone OFF")
.arg(tuning.voltage==SEC_VOLTAGE_13?"13V":"18V"));
-
+/*
+this causes problems with Diseqc swith behind rotor.
if ((prev_tuning.diseqc_port != tuning.diseqc_port ||
prev_tuning.tone != tuning.tone ||
prev_tuning.voltage != tuning.voltage ) || reset)
{
+*/
dvb_diseqc_master_cmd cmd =
{{CMD_FIRST, MASTER_TO_LSS, WRITE_N1, 0xf0, 0x00, 0x00}, 4};
@@ -410,7 +443,7 @@
prev_tuning.voltage = tuning.voltage;
havetuned = true;
- }
+// }
havetuned |=
(prev_tuning.diseqc_port == tuning.diseqc_port) &&
@@ -499,13 +532,18 @@
return true;
}
+
+//for diseqc 1.2, I think it makes more sense to
+//have the positioners memorized position stored in
+//prev_tuning.diseqc_pos instead of prev_tuning.diseqc_port
+//This way we can do a diseqc switch behind 1.2 motor
bool DVBDiSEqC::PositionerGoto(DVBTuning& tuning, bool reset, bool& havetuned)
{
// A reset seems to be required for my positioner to work consistently
VERBOSE(VB_CHANNEL, LOC + QString("1.2 Motor - Goto Stored Position %1")
- .arg(tuning.diseqc_port));
+ .arg(tuning.diseqc_pos));
- if ((prev_tuning.diseqc_port != tuning.diseqc_port ||
+ if ((prev_tuning.diseqc_pos != tuning.diseqc_pos ||
prev_tuning.tone != tuning.tone ||
prev_tuning.voltage != tuning.voltage) || reset)
{
@@ -516,7 +554,7 @@
}
dvb_diseqc_master_cmd cmd =
- {{CMD_FIRST, MASTER_TO_POSITIONER, GOTO, tuning.diseqc_port,
+ {{CMD_FIRST, MASTER_TO_POSITIONER, GOTO, tuning.diseqc_pos,
0x00, 0x00}, 4};
if (!SendDiSEqCMessage(tuning,cmd))
@@ -525,13 +563,13 @@
return false;
}
- prev_tuning.diseqc_port = tuning.diseqc_port;
+ prev_tuning.diseqc_pos = tuning.diseqc_pos;
prev_tuning.tone = tuning.tone;
prev_tuning.voltage = tuning.voltage;
}
havetuned |=
- (prev_tuning.diseqc_port == tuning.diseqc_port) &&
+ (prev_tuning.diseqc_pos == tuning.diseqc_pos) &&
(prev_tuning.voltage == tuning.voltage) &&
(prev_tuning.tone == tuning.tone);
diff -Naur mythtv/libs/libmythtv/videosource.cpp mythtv-diseqc/libs/libmythtv/videosource.cpp
--- mythtv/libs/libmythtv/videosource.cpp 2005-12-31 20:00:34.000000000 -0600
+++ mythtv-diseqc/libs/libmythtv/videosource.cpp 2005-12-31 19:45:31.000000000 -0600
@@ -1238,6 +1238,8 @@
addSelection("DiSEqC v1.2 Positioner","6");
addSelection("DiSEqC v1.3 Positioner (Goto X)","7");
addSelection("DiSEqC v1.1 or 2.1 (10-way method2)","8");
+ addSelection("DiSEqC v1.2 Positioner with 2 LNBS","10");
+ addSelection("DiSEqC v1.3 Positioner (Goto X) with 2 LNBS","11");
setHelpText(QObject::tr("Select the input type for DVB-S cards. "
"Leave as Single LNB/Input for DVB-C or DVB-T. "
"The inputs are mapped from Input Connections option "
@@ -1683,7 +1685,8 @@
{
setLabel(QObject::tr("DiSEqC Satellite Location"));
setValue("0.0");
- setHelpText(QObject::tr("The longitude of the satellite "
+ setHelpText(QObject::tr("For 1.2 positioner enter the satellite's stored position "
+ "or for the GotoX (DiSEqC 1.3/USALS) positioner, this is a longitude of the satellite "
"you are aiming at. For western hemisphere use "
"a negative value. Value is in decimal."));
// setVisible(false);
@@ -1707,6 +1710,17 @@
};
};
+class DiSEqCPortPos: public SpinBoxSetting, public CISetting {
+ public:
+ DiSEqCPortPos(const CardInput& parent):
+ SpinBoxSetting(0,1,0),
+ CISetting(parent, "diseqc_port") {
+ setLabel(QObject::tr("DiSEqC Port"));
+ setValue(0);
+ setHelpText(QObject::tr("Port umber of a DiSEqC switch "
+ "behind a positioner. "));
+ };
+};
class FreeToAir: public CheckBoxSetting, public CISetting {
public:
@@ -1880,6 +1894,7 @@
{
group->addChild(diseqcpos = new DiSEqCPos(*this));
group->addChild(diseqcport = new DiSEqCPort(*this));
+ group->addChild(diseqcportpos = new DiSEqCPortPos(*this));
group->addChild(lnblofswitch = new LNBLofSwitch(*this));
group->addChild(lnblofhi = new LNBLofHi(*this));
group->addChild(lnbloflo = new LNBLofLo(*this));
@@ -1990,17 +2005,28 @@
{
//Check for DiSEqC type
diseqcpos->setVisible(true);
+ diseqcportpos->setVisible(true);
lnblofswitch->setVisible(true);
lnbloflo->setVisible(true);
lnblofhi->setVisible(true);
- if (CardUtil::GetDISEqCType(_cardid) == CardUtil::POSITIONER_X)
+ if (CardUtil::GetDISEqCType(_cardid) == CardUtil::POSITIONER_1_2 ||
+ CardUtil::GetDISEqCType(_cardid) == CardUtil::POSITIONER_1_2_SWITCH ||
+ CardUtil::GetDISEqCType(_cardid) == CardUtil::POSITIONER_X ||
+ CardUtil::GetDISEqCType(_cardid) == CardUtil::POSITIONER_X_SWITCH)
+ {
diseqcpos->setEnabled(true);
+ diseqcportpos->setEnabled(true);
+ }
else
+ {
diseqcpos->setEnabled(false);
+ diseqcportpos->setEnabled(false);
+ }
}
else
{
diseqcpos->setVisible(false);
+ diseqcportpos->setVisible(false);
lnblofswitch->setVisible(false);
lnbloflo->setVisible(false);
lnblofhi->setVisible(false);
@@ -2418,7 +2444,7 @@
mtxt.arg(i), "", QString::number(i)));
break;
case 7:
- for (i = 1; i < 20; ++i)
+ for (i = 1; i < 50; ++i)
list.append(DVBDiSEqCInputList(
itxt.arg(i), "", QString::number(i)));
break;
@@ -2427,6 +2453,17 @@
list.append(DVBDiSEqCInputList(
stxt.arg(i+1,2), QString::number(i), ""));
break;
+ case 10:
+ for (i = 1; i < 50; ++i)
+ list.append(DVBDiSEqCInputList(
+ mtxt.arg(i), "", QString::number(i)));
+ break;
+ case 11:
+ for (i = 1; i < 50; ++i)
+ list.append(DVBDiSEqCInputList(
+ itxt.arg(i), "", QString::number(i)));
+ break;
+
default:
list.append(DVBDiSEqCInputList(
QString("DVBInput"), QString(""), QString("")));
diff -Naur mythtv/libs/libmythtv/videosource.h mythtv-diseqc/libs/libmythtv/videosource.h
--- mythtv/libs/libmythtv/videosource.h 2005-12-31 20:00:34.000000000 -0600
+++ mythtv-diseqc/libs/libmythtv/videosource.h 2005-12-31 19:44:47.000000000 -0600
@@ -53,6 +53,8 @@
POSITIONER_X,
POSITIONER_1_2_SWITCH_2,
POSITIONER_X_SWITCH_2,
+ POSITIONER_1_2_SWITCH,
+ POSITIONER_X_SWITCH,
};
/// \brief dvb card type
static const QString DVB;
@@ -522,6 +524,7 @@
class DVBLNBChooser;
class DiSEqCPos;
class DiSEqCPort;
+class DiSEqCPortPos;
class LNBLofSwitch;
class LNBLofLo;
class LNBLofHi;
@@ -573,6 +576,7 @@
DVBLNBChooser *lnbsettings;
DiSEqCPos *diseqcpos;
DiSEqCPort *diseqcport;
+ DiSEqCPortPos *diseqcportpos;
LNBLofSwitch *lnblofswitch;
LNBLofLo *lnbloflo;
LNBLofHi *lnblofhi;
_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev