+ eDebug("found no useable satellite configuration for orbital position (%d)", sat.orbital_position );
+ return -1;
+}
+
+RESULT eDVBSatelliteEquipmentControl::clear()
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::clear()");
+ for (int i=0; i <= m_lnbidx; ++i)
+ {
+ m_lnbs[i].m_satellites.clear();
+ m_lnbs[i].slot_mask = 0;
+ }
+ m_lnbidx=-1;
+
+ m_not_linked_slot_mask=0;
+
+ //reset some tuner configuration
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
+ {
+ long tmp;
+ if (!strcmp(it->m_frontend->getDescription(), "BCM4501 (internal)") && !it->m_frontend->getData(eDVBFrontend::LINKED_PREV_PTR, tmp) && tmp != -1)
+ {
+ FILE *f=fopen("/proc/stb/tsmux/lnb_b_input", "w");
+ if (!f || fwrite("B", 1, 1, f) != 1)
+ eDebug("set /proc/stb/tsmux/lnb_b_input to B failed!! (%m)");
+ else
+ {
+ eDebug("set /proc/stb/tsmux/lnb_b_input to B OK");
+ fclose(f);
+ }
+ }
+ it->m_frontend->setData(eDVBFrontend::SATPOS_DEPENDS_PTR, -1);
+ it->m_frontend->setData(eDVBFrontend::LINKED_PREV_PTR, -1);
+ it->m_frontend->setData(eDVBFrontend::LINKED_NEXT_PTR, -1);
+ it->m_frontend->setData(eDVBFrontend::ROTOR_POS, -1);
+ it->m_frontend->setData(eDVBFrontend::ROTOR_CMD, -1);
+ }
+
+ return 0;
+}
+
+/* LNB Specific Parameters */
+RESULT eDVBSatelliteEquipmentControl::addLNB()
+{
+ if ( (m_lnbidx+1) < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)))
+ m_curSat=m_lnbs[++m_lnbidx].m_satellites.end();
+ else
+ {
+ eDebug("no more LNB free... cnt is %d", m_lnbidx);
+ return -ENOSPC;
+ }
+ eSecDebug("eDVBSatelliteEquipmentControl::addLNB(%d)", m_lnbidx);
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setLNBSlotMask(int slotmask)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setLNBSlotMask(%d)", slotmask);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].slot_mask = slotmask;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setLNBLOFL(int lofl)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setLNBLOFL(%d)", lofl);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_lof_lo = lofl;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setLNBLOFH(int lofh)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setLNBLOFH(%d)", lofh);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_lof_hi = lofh;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setLNBThreshold(int threshold)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setLNBThreshold(%d)", threshold);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_lof_threshold = threshold;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setLNBIncreasedVoltage(bool onoff)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setLNBIncreasedVoltage(%d)", onoff);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_increased_voltage = onoff;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+/* DiSEqC Specific Parameters */
+RESULT eDVBSatelliteEquipmentControl::setDiSEqCMode(int diseqcmode)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setDiSEqcMode(%d)", diseqcmode);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_diseqc_parameters.m_diseqc_mode = (eDVBSatelliteDiseqcParameters::t_diseqc_mode)diseqcmode;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setToneburst(int toneburst)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setToneburst(%d)", toneburst);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_diseqc_parameters.m_toneburst_param = (eDVBSatelliteDiseqcParameters::t_toneburst_param)toneburst;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setRepeats(int repeats)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setRepeats(%d)", repeats);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_diseqc_parameters.m_repeats=repeats;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setCommittedCommand(int command)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setCommittedCommand(%d)", command);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_diseqc_parameters.m_committed_cmd=command;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setUncommittedCommand(int command)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setUncommittedCommand(%d)", command);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_diseqc_parameters.m_uncommitted_cmd = command;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setCommandOrder(int order)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setCommandOrder(%d)", order);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_diseqc_parameters.m_command_order=order;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setFastDiSEqC(bool onoff)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setFastDiSEqc(%d)", onoff);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_diseqc_parameters.m_use_fast=onoff;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setSeqRepeat(bool onoff)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setSeqRepeat(%d)", onoff);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_diseqc_parameters.m_seq_repeat = onoff;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+/* Rotor Specific Parameters */
+RESULT eDVBSatelliteEquipmentControl::setLongitude(float longitude)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setLongitude(%f)", longitude);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_longitude=longitude;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setLatitude(float latitude)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setLatitude(%f)", latitude);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_latitude=latitude;
+ else
+ return -ENOENT;
+ return 0;
+}
+
+RESULT eDVBSatelliteEquipmentControl::setLoDirection(int direction)
+{
+ eSecDebug("eDVBSatelliteEquipmentControl::setLoDirection(%d)", direction);
+ if ( currentLNBValid() )
+ m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_lo_direction=direction;
+ else
+ return -ENOENT;
+ return 0;
+}