1 #include <lib/dvb/dvb.h>
2 #include <lib/dvb/sec.h>
3 #include <lib/dvb/rotor_calc.h>
4 #include <lib/dvb/dvbtime.h>
8 #if HAVE_DVB_API_VERSION < 3
9 #define FREQUENCY Frequency
11 #define FREQUENCY frequency
13 #include <lib/base/eerror.h>
18 #define eSecDebug(arg...) eDebug(arg)
20 #define eSecDebug(arg...)
23 DEFINE_REF(eDVBSatelliteEquipmentControl);
25 eDVBSatelliteEquipmentControl *eDVBSatelliteEquipmentControl::instance;
27 int eDVBSatelliteEquipmentControl::m_params[MAX_PARAMS];
29 defaults are set in python lib/python/Components/NimManager.py
30 in InitSecParams function via setParam call
33 void eDVBSatelliteEquipmentControl::setParam(int param, int value)
35 if (param >= 0 && param < MAX_PARAMS)
36 m_params[param]=value;
39 eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends)
40 :m_lnbidx(-1), m_curSat(m_lnbs[0].m_satellites.end()), m_avail_frontends(avail_frontends), m_rotorMoving(false)
51 setLNBThreshold(11700000);
53 setDiSEqCMode(eDVBSatelliteDiseqcParameters::V1_0);
54 setToneburst(eDVBSatelliteDiseqcParameters::NO);
56 setCommittedCommand(eDVBSatelliteDiseqcParameters::BB);
57 setCommandOrder(0); // committed, toneburst
61 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
62 setToneMode(eDVBSatelliteSwitchParameters::HILO);
68 setLNBThreshold(11700000);
70 setDiSEqCMode(eDVBSatelliteDiseqcParameters::V1_0);
71 setToneburst(eDVBSatelliteDiseqcParameters::NO);
73 setCommittedCommand(eDVBSatelliteDiseqcParameters::AB);
74 setCommandOrder(0); // committed, toneburst
78 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
79 setToneMode(eDVBSatelliteSwitchParameters::HILO);
85 setLNBThreshold(11700000);
87 setDiSEqCMode(eDVBSatelliteDiseqcParameters::V1_2);
88 setToneburst(eDVBSatelliteDiseqcParameters::NO);
90 setCommittedCommand(eDVBSatelliteDiseqcParameters::AA);
91 setCommandOrder(0); // committed, toneburst
94 setLaDirection(eDVBSatelliteRotorParameters::NORTH);
95 setLoDirection(eDVBSatelliteRotorParameters::EAST);
98 setUseInputpower(true);
99 setInputpowerDelta(50);
102 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
103 setToneMode(eDVBSatelliteSwitchParameters::HILO);
107 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
108 setToneMode(eDVBSatelliteSwitchParameters::HILO);
112 setVoltageMode(eDVBSatelliteSwitchParameters::HV);
113 setToneMode(eDVBSatelliteSwitchParameters::HILO);
114 setRotorPosNum(1); // stored pos 1
117 int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite &sat, iDVBFrontend *fe, int slot_id, int *highest_score_lnb)
119 int score=0, satcount=0;
121 if (highest_score_lnb)
122 *highest_score_lnb = -1;
124 for (int idx=0; idx <= m_lnbidx; ++idx )
127 eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx];
128 if ( lnb_param.slot_mask & slot_id ) // lnb for correct tuner?
131 eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
133 satcount += lnb_param.m_satellites.size();
135 std::map<int, eDVBSatelliteSwitchParameters>::iterator sit =
136 lnb_param.m_satellites.find(sat.orbital_position);
137 if ( sit != lnb_param.m_satellites.end())
142 satpos_depends_ptr=-1,
143 csw = di_param.m_committed_cmd,
144 ucsw = di_param.m_uncommitted_cmd,
145 toneburst = di_param.m_toneburst_param,
148 fe->getData(eDVBFrontend::LINKED_PREV_PTR, linked_prev_ptr);
149 fe->getData(eDVBFrontend::SATPOS_DEPENDS_PTR, satpos_depends_ptr);
151 if ( sat.frequency > lnb_param.m_lof_threshold )
153 if (!(sat.polarisation & eDVBFrontendParametersSatellite::Polarisation::Vertical))
158 if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
161 if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
162 csw = 0xF0 | (csw << 2);
164 if (di_param.m_committed_cmd <= eDVBSatelliteDiseqcParameters::SENDNO)
167 if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2 ) // ROTOR
178 if (m_not_linked_slot_mask & slot_id) // frontend with direct connection?
183 fe->getData(eDVBFrontend::ROTOR_POS, curRotorPos);
184 fe->getData(eDVBFrontend::LINKED_NEXT_PTR, linked_next_ptr);
185 fe->getData(eDVBFrontend::CSW, ocsw);
186 fe->getData(eDVBFrontend::UCSW, oucsw);
187 fe->getData(eDVBFrontend::TONEBURST, oToneburst);
188 while (ret && linked_prev_ptr != -1) // check for linked tuners..
190 eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_prev_ptr;
191 if (linked_fe->m_inuse)
193 if ( (csw != ocsw) ||
194 ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) ||
195 ( rotor && curRotorPos != sat.orbital_position ) )
200 linked_fe->m_frontend->getData(eDVBFrontend::LINKED_PREV_PTR, (long&)linked_prev_ptr);
202 while (ret && linked_next_ptr != -1) // check for linked tuners..
204 eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_next_ptr;
205 if (linked_fe->m_inuse)
207 if ( (csw != ocsw) ||
208 ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) ||
209 ( rotor && curRotorPos != sat.orbital_position ) )
214 linked_fe->m_frontend->getData(eDVBFrontend::LINKED_NEXT_PTR, (long&)linked_next_ptr);
217 else // linked frontend..
222 while (linked_prev_ptr != -1)
224 eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_prev_ptr;
225 linked_fe->m_frontend->getData(eDVBFrontend::LINKED_PREV_PTR, (long&)linked_prev_ptr);
226 if (linked_prev_ptr == -1)
228 iDVBFrontend *sec_fe = linked_fe->m_frontend;
229 sec_fe->getData(eDVBFrontend::ROTOR_POS, curRotorPos);
230 if (linked_fe->m_inuse)
232 sec_fe->getData(eDVBFrontend::CSW, ocsw);
233 sec_fe->getData(eDVBFrontend::UCSW, oucsw);
234 sec_fe->getData(eDVBFrontend::TONEBURST, oToneburst);
235 if ( (csw != ocsw) ||
236 ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) ||
237 ( rotor && curRotorPos != sat.orbital_position ) )
246 if (ret && rotor && curRotorPos != -1)
247 ret -= abs(curRotorPos-sat.orbital_position);
250 if (satpos_depends_ptr != -1)
252 eDVBRegisteredFrontend *satpos_depends_to_fe = (eDVBRegisteredFrontend*) satpos_depends_ptr;
253 if ( satpos_depends_to_fe->m_inuse )
255 if (!rotor || curRotorPos != sat.orbital_position)
262 int lof = sat.frequency > lnb_param.m_lof_threshold ?
263 lnb_param.m_lof_hi : lnb_param.m_lof_lo;
264 int tuner_freq = abs(sat.frequency - lof);
265 if (tuner_freq < 900000 || tuner_freq > 2200000)
271 if (highest_score_lnb)
272 *highest_score_lnb = idx;
277 if (score && satcount)
278 score -= (satcount-1);
279 if (score && m_not_linked_slot_mask & slot_id)
280 score += 5; // increase score for tuners with direct sat connection
284 bool need_turn_fast(int turn_speed)
286 if (turn_speed == eDVBSatelliteRotorParameters::FAST)
288 else if (turn_speed != eDVBSatelliteRotorParameters::SLOW)
290 int begin = turn_speed >> 16; // high word is start time
291 int end = turn_speed&0xFFFF; // low word is end time
292 time_t now_time = ::time(0);
294 localtime_r(&now_time, &nowTime);
295 int now = (nowTime.tm_hour + 1) * 60 + nowTime.tm_min + 1;
296 bool neg = end <= begin;
302 if ((now >= begin && now < end) ^ neg)
308 #define VOLTAGE(x) (lnb_param.m_increased_voltage ? iDVBFrontend::voltage##x##_5 : iDVBFrontend::voltage##x)
310 RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, const eDVBFrontendParametersSatellite &sat, int slot_id, unsigned int tunetimeout)
313 if (canTune(sat, &frontend, slot_id, &lnb_idx))
315 eDVBSatelliteLNBParameters &lnb_param = m_lnbs[lnb_idx];
316 eDVBSatelliteDiseqcParameters &di_param = lnb_param.m_diseqc_parameters;
317 eDVBSatelliteRotorParameters &rotor_param = lnb_param.m_rotor_parameters;
319 std::map<int, eDVBSatelliteSwitchParameters>::iterator sit =
320 lnb_param.m_satellites.find(sat.orbital_position);
321 if ( sit != lnb_param.m_satellites.end())
323 eDVBSatelliteSwitchParameters &sw_param = sit->second;
324 bool doSetFrontend = true;
325 bool doSetVoltageToneFrontend = true;
326 bool allowDiseqc1_2 = true;
327 bool sendDiSEqC = false;
329 voltage = iDVBFrontend::voltageOff,
330 tone = iDVBFrontend::toneOff,
331 csw = di_param.m_committed_cmd,
332 ucsw = di_param.m_uncommitted_cmd,
333 toneburst = di_param.m_toneburst_param,
339 satposDependPtr = -1;
340 iDVBFrontend *sec_fe=&frontend;
342 frontend.getData(eDVBFrontend::SATPOS_DEPENDS_PTR, satposDependPtr);
344 if (!(m_not_linked_slot_mask & slot_id)) // frontend with direct connection?
346 long linked_prev_ptr;
347 frontend.getData(eDVBFrontend::LINKED_PREV_PTR, linked_prev_ptr);
348 while (linked_prev_ptr != -1)
350 eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_prev_ptr;
351 sec_fe = linked_fe->m_frontend;
352 sec_fe->getData(eDVBFrontend::LINKED_PREV_PTR, (long&)linked_prev_ptr);
354 if (satposDependPtr != -1)
355 allowDiseqc1_2 = false;
358 sec_fe->getData(eDVBFrontend::CSW, lastcsw);
359 sec_fe->getData(eDVBFrontend::UCSW, lastucsw);
360 sec_fe->getData(eDVBFrontend::TONEBURST, lastToneburst);
361 sec_fe->getData(eDVBFrontend::ROTOR_CMD, lastRotorCmd);
362 sec_fe->getData(eDVBFrontend::ROTOR_POS, curRotorPos);
364 if ( sat.frequency > lnb_param.m_lof_threshold )
368 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_hi;
370 parm.FREQUENCY = sat.frequency - lnb_param.m_lof_lo;
372 parm.FREQUENCY = abs(parm.FREQUENCY);
374 frontend.setData(eDVBFrontend::FREQ_OFFSET, sat.frequency - parm.FREQUENCY);
376 if (!(sat.polarisation & eDVBFrontendParametersSatellite::Polarisation::Vertical))
379 if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_14V
380 || ( sat.polarisation & eDVBFrontendParametersSatellite::Polarisation::Vertical
381 && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) )
382 voltage = VOLTAGE(13);
383 else if ( sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::_18V
384 || ( !(sat.polarisation & eDVBFrontendParametersSatellite::Polarisation::Vertical)
385 && sw_param.m_voltage_mode == eDVBSatelliteSwitchParameters::HV ) )
386 voltage = VOLTAGE(18);
387 if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::ON)
388 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && (band&1) ) )
389 tone = iDVBFrontend::toneOn;
390 else if ( (sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::OFF)
391 || ( sw_param.m_22khz_signal == eDVBSatelliteSwitchParameters::HILO && !(band&1) ) )
392 tone = iDVBFrontend::toneOff;
394 eSecCommandList sec_sequence;
396 if (di_param.m_diseqc_mode >= eDVBSatelliteDiseqcParameters::V1_0)
398 if ( di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO )
399 csw = 0xF0 | (csw << 2);
401 if (di_param.m_committed_cmd <= eDVBSatelliteDiseqcParameters::SENDNO)
405 (di_param.m_committed_cmd != eDVBSatelliteDiseqcParameters::SENDNO);
406 bool changed_csw = send_csw && csw != lastcsw;
409 (di_param.m_uncommitted_cmd && di_param.m_diseqc_mode > eDVBSatelliteDiseqcParameters::V1_0);
410 bool changed_ucsw = send_ucsw && ucsw != lastucsw;
413 (di_param.m_toneburst_param != eDVBSatelliteDiseqcParameters::NO);
414 bool changed_burst = send_burst && toneburst != lastToneburst;
416 int send_mask = 0; /*
419 4 send toneburst first
420 8 send toneburst at end */
421 if (changed_burst) // toneburst first and toneburst changed
423 if (di_param.m_command_order&1)
437 if ((di_param.m_command_order&4) && send_csw)
439 if (di_param.m_command_order==4 && send_burst)
444 if ( di_param.m_use_fast
445 && di_param.m_committed_cmd < eDVBSatelliteDiseqcParameters::SENDNO
447 && ((csw / 4) == (lastcsw / 4)) )
448 eDebug("dont send committed cmd (fast diseqc)");
452 if (!(di_param.m_command_order&4) && send_ucsw)
454 if (!(di_param.m_command_order&1) && send_burst)
460 eDebugNoNewLine("sendmask: ");
461 for (int i=3; i >= 0; --i)
462 if ( send_mask & (1<<i) )
463 eDebugNoNewLine("1");
465 eDebugNoNewLine("0");
468 if (doSetVoltageToneFrontend)
471 bool useGotoXX = false;
472 if ( di_param.m_diseqc_mode == eDVBSatelliteDiseqcParameters::V1_2
473 && !sat.no_rotor_command_on_tune
476 if (sw_param.m_rotorPosNum) // we have stored rotor pos?
477 RotorCmd=sw_param.m_rotorPosNum;
478 else // we must calc gotoxx cmd
480 eDebug("Entry for %d,%d? not in Rotor Table found... i try gotoXX?", sat.orbital_position / 10, sat.orbital_position % 10 );
483 double SatLon = abs(sat.orbital_position)/10.00,
484 SiteLat = rotor_param.m_gotoxx_parameters.m_latitude,
485 SiteLon = rotor_param.m_gotoxx_parameters.m_longitude;
487 if ( rotor_param.m_gotoxx_parameters.m_la_direction == eDVBSatelliteRotorParameters::SOUTH )
490 if ( rotor_param.m_gotoxx_parameters.m_lo_direction == eDVBSatelliteRotorParameters::WEST )
491 SiteLon = 360 - SiteLon;
493 eDebug("siteLatitude = %lf, siteLongitude = %lf, %lf degrees", SiteLat, SiteLon, SatLon );
494 double satHourAngle =
495 calcSatHourangle( SatLon, SiteLat, SiteLon );
496 eDebug("PolarmountHourAngle=%lf", satHourAngle );
498 static int gotoXTable[10] =
499 { 0x00, 0x02, 0x03, 0x05, 0x06, 0x08, 0x0A, 0x0B, 0x0D, 0x0E };
501 if (SiteLat >= 0) // Northern Hemisphere
503 int tmp=(int)round( fabs( 180 - satHourAngle ) * 10.0 );
504 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
506 if (satHourAngle < 180) // the east
511 else // Southern Hemisphere
513 if (satHourAngle < 180) // the east
515 int tmp=(int)round( fabs( satHourAngle ) * 10.0 );
516 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
521 int tmp=(int)round( fabs( 360 - satHourAngle ) * 10.0 );
522 RotorCmd = (tmp/10)*0x10 + gotoXTable[ tmp % 10 ];
526 eDebug("RotorCmd = %04x", RotorCmd);
532 int vlt = iDVBFrontend::voltageOff;
533 eSecCommand::pair compare;
535 compare.tone = iDVBFrontend::toneOff;
536 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) );
537 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
538 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) );
540 if ( RotorCmd != -1 && RotorCmd != lastRotorCmd )
542 if (rotor_param.m_inputpower_parameters.m_use)
543 vlt = VOLTAGE(18); // in input power mode set 18V for measure input power
545 vlt = VOLTAGE(13); // in normal mode start turning with 13V
550 // check if voltage is already correct..
551 compare.voltage = vlt;
553 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
555 // check if voltage is disabled
556 compare.voltage = iDVBFrontend::voltageOff;
558 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
560 // voltage is changed... use DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS
561 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, vlt) );
562 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_SWITCH_CMDS]) );
563 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +3) );
565 // voltage was disabled.. use DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_SWITCH_CMDS
566 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, vlt) );
567 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_SWITCH_CMDS]) );
569 sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_SWITCHPARMS) );
570 for (int seq_repeat = 0; seq_repeat < (di_param.m_seq_repeat?2:1); ++seq_repeat)
574 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
575 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_TONEBURST]) );
585 loops <<= di_param.m_repeats;
587 for ( int i = 0; i < loops;) // fill commands...
589 eDVBDiseqcCommand diseqc;
590 memset(diseqc.data, 0, MAX_DISEQC_LENGTH);
592 diseqc.data[0] = i ? 0xE1 : 0xE0;
593 diseqc.data[1] = 0x10;
594 if ( (send_mask & 2) && (di_param.m_command_order & 4) )
596 diseqc.data[2] = 0x39;
597 diseqc.data[3] = ucsw;
599 else if ( send_mask & 1 )
601 diseqc.data[2] = 0x38;
602 diseqc.data[3] = csw;
604 else // no committed command confed.. so send uncommitted..
606 diseqc.data[2] = 0x39;
607 diseqc.data[3] = ucsw;
609 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
615 if (diseqc.data[2] == 0x38 && (send_mask & 2))
617 else if (diseqc.data[2] == 0x39 && (send_mask & 1))
619 int tmp = m_params[DELAY_BETWEEN_DISEQC_REPEATS];
622 int delay = di_param.m_repeats ? (tmp - 54) / 2 : tmp; // standard says 100msek between two repeated commands
623 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay) );
625 diseqc.data[3]=(cmd==0x38) ? csw : ucsw;
626 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
629 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, delay ) );
631 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) );
633 else // delay 120msek when no command is in repeat gap
634 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, tmp) );
637 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) );
640 if ( send_mask & 8 ) // toneburst at end of sequence
642 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_TONEBURST, di_param.m_toneburst_param) );
643 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_TONEBURST]) );
649 eDebug("RotorCmd %02x, lastRotorCmd %02lx", RotorCmd, lastRotorCmd);
650 if ( RotorCmd != -1 && RotorCmd != lastRotorCmd )
652 eSecCommand::pair compare;
656 compare.tone = iDVBFrontend::toneOff;
657 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) );
658 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, iDVBFrontend::toneOff) );
659 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) );
661 compare.voltage = iDVBFrontend::voltageOff;
663 // the next is a check if voltage is switched off.. then we first set a voltage :)
664 // else we set voltage after all diseqc stuff..
665 sec_sequence.push_back( eSecCommand(eSecCommand::IF_NOT_VOLTAGE_GOTO, compare) );
667 if (rotor_param.m_inputpower_parameters.m_use)
668 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) ); // set 18V for measure input power
670 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)) ); // in normal mode start turning with 13V
672 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_ENABLE_VOLTAGE_BEFORE_MOTOR_CMD]) ); // wait 750ms when voltage was disabled
673 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +9) ); // no need to send stop rotor cmd and recheck voltage
676 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_BETWEEN_SWITCH_AND_MOTOR_CMD]) ); // wait 700ms when diseqc changed
678 eDVBDiseqcCommand diseqc;
679 memset(diseqc.data, 0, MAX_DISEQC_LENGTH);
681 diseqc.data[0] = 0xE0;
682 diseqc.data[1] = 0x31; // positioner
683 diseqc.data[2] = 0x60; // stop
684 sec_sequence.push_back( eSecCommand(eSecCommand::IF_ROTORPOS_VALID_GOTO, +5) );
685 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
686 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) );
687 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
688 // wait 150msec after send rotor stop cmd
689 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_MOTOR_STOP_CMD]) );
691 diseqc.data[0] = 0xE0;
692 diseqc.data[1] = 0x31; // positioner
696 diseqc.data[2] = 0x6E; // drive to angular position
697 diseqc.data[3] = ((RotorCmd & 0xFF00) / 0x100);
698 diseqc.data[4] = RotorCmd & 0xFF;
703 diseqc.data[2] = 0x6B; // goto stored sat position
704 diseqc.data[3] = RotorCmd;
705 diseqc.data[4] = 0x00;
708 if ( rotor_param.m_inputpower_parameters.m_use )
709 { // use measure rotor input power to detect rotor state
710 bool turn_fast = need_turn_fast(rotor_param.m_inputpower_parameters.m_turning_speed);
711 eSecCommand::rotor cmd;
712 eSecCommand::pair compare;
713 compare.voltage = VOLTAGE(18);
715 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
716 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) );
717 // measure idle power values
718 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER]) ); // wait 150msec after voltage change
719 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 1) );
722 sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) );
723 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(13)) );
724 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MEASURE_IDLE_INPUTPOWER]) ); // wait 150msec before measure
725 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_IDLE_INPUTPOWER, 0) );
727 sec_sequence.push_back( eSecCommand(eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO, compare) );
728 ////////////////////////////
729 sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_DISEQC_RETRYS, m_params[MOTOR_COMMAND_RETRIES]) ); // 2 retries
730 sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_ROTORPARMS) );
731 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
732 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, 40) ); // 2 seconds rotor start timout
734 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // 50msec delay
735 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
736 cmd.direction=1; // check for running rotor
737 cmd.deltaA=rotor_param.m_inputpower_parameters.m_delta;
740 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) ); // check if rotor has started
741 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +2 ) ); // timeout .. we assume now the rotor is already at the correct position
742 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // goto loop start
743 sec_sequence.push_back( eSecCommand(eSecCommand::IF_NO_MORE_ROTOR_DISEQC_RETRYS_GOTO, turn_fast ? 10 : 9 ) ); // timeout .. we assume now the rotor is already at the correct position
744 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -8) ); // goto loop start
746 sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_MOVING) );
748 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, VOLTAGE(18)) );
749 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, m_params[MOTOR_RUNNING_TIMEOUT]*20) ); // 2 minutes running timeout
750 // rotor running loop
751 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 50) ); // wait 50msec
752 sec_sequence.push_back( eSecCommand(eSecCommand::MEASURE_RUNNING_INPUTPOWER) );
753 cmd.direction=0; // check for stopped rotor
755 sec_sequence.push_back( eSecCommand(eSecCommand::IF_INPUTPOWER_DELTA_GOTO, cmd ) );
756 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +2 ) ); // timeout ? this should never happen
757 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) ); // running loop start
758 /////////////////////
759 sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
760 sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_STOPPED) );
763 { // use normal turning mode
764 doSetVoltageToneFrontend=false;
766 eSecCommand::rotor cmd;
767 eSecCommand::pair compare;
768 compare.voltage = VOLTAGE(13);
770 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) );
771 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, compare.voltage) );
772 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MOTOR_CMD]) ); // wait 150msec after voltage change
774 sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_ROTORPARMS) );
775 sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_MOVING) );
776 sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) );
778 compare.voltage = voltage;
780 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // correct final voltage?
781 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 2000) ); // wait 2 second before set high voltage
782 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
785 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) );
786 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) );
787 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) );
788 sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
790 cmd.direction=1; // check for running rotor
794 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TIMEOUT, m_params[MOTOR_RUNNING_TIMEOUT]*4) ); // 2 minutes running timeout
795 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 250) ); // 250msec delay
796 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TUNER_LOCKED_GOTO, cmd ) );
797 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TIMEOUT_GOTO, +3 ) );
798 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -3) ); // goto loop start
799 sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_ROTORPARAMS) );
800 sec_sequence.push_back( eSecCommand(eSecCommand::SET_ROTOR_STOPPED) );
801 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, +3) );
802 sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
803 sec_sequence.push_back( eSecCommand(eSecCommand::GOTO, -4) );
805 sec_fe->setData(eDVBFrontend::NEW_ROTOR_CMD, RotorCmd);
806 sec_fe->setData(eDVBFrontend::NEW_ROTOR_POS, sat.orbital_position);
813 sec_sequence.push_back( eSecCommand(eSecCommand::INVALIDATE_CURRENT_SWITCHPARMS) );
818 sec_sequence.push_front( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) );
820 sec_fe->setData(eDVBFrontend::NEW_CSW, csw);
821 sec_fe->setData(eDVBFrontend::NEW_UCSW, ucsw);
822 sec_fe->setData(eDVBFrontend::NEW_TONEBURST, di_param.m_toneburst_param);
824 if (doSetVoltageToneFrontend)
826 eSecCommand::pair compare;
827 compare.voltage = voltage;
829 sec_sequence.push_back( eSecCommand(eSecCommand::IF_VOLTAGE_GOTO, compare) ); // voltage already correct ?
830 sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, voltage) );
831 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_FINAL_VOLTAGE_CHANGE]) );
833 sec_sequence.push_back( eSecCommand(eSecCommand::IF_TONE_GOTO, compare) );
834 sec_sequence.push_back( eSecCommand(eSecCommand::SET_TONE, tone) );
835 sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_CONT_TONE]) );
838 sec_sequence.push_back( eSecCommand(eSecCommand::UPDATE_CURRENT_SWITCHPARMS) );
842 sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT, tunetimeout) );
843 sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
847 sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) );
849 frontend.setSecSequence(sec_sequence);
854 eDebug("found no useable satellite configuration for %s freq %d%s %s on orbital position (%d)",
855 sat.system ? "DVB-S2" : "DVB-S",
857 sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal ? "H" :
858 eDVBFrontendParametersSatellite::Polarisation::Vertical ? "V" :
859 eDVBFrontendParametersSatellite::Polarisation::CircularLeft ? "CL" : "CR",
860 sat.modulation == eDVBFrontendParametersSatellite::Modulation::Auto ? "AUTO" :
861 eDVBFrontendParametersSatellite::Modulation::QPSK ? "QPSK" :
862 eDVBFrontendParametersSatellite::Modulation::M8PSK ? "8PSK" : "QAM16",
863 sat.orbital_position );
867 RESULT eDVBSatelliteEquipmentControl::clear()
869 eSecDebug("eDVBSatelliteEquipmentControl::clear()");
870 for (int i=0; i <= m_lnbidx; ++i)
872 m_lnbs[i].m_satellites.clear();
873 m_lnbs[i].slot_mask = 0;
877 m_not_linked_slot_mask=0;
879 //reset some tuner configuration
880 for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
883 if (!strcmp(it->m_frontend->getDescription(), "BCM4501 (internal)") && !it->m_frontend->getData(eDVBFrontend::LINKED_PREV_PTR, tmp) && tmp != -1)
885 FILE *f=fopen("/proc/stb/tsmux/lnb_b_input", "w");
886 if (!f || fwrite("B", 1, 1, f) != 1)
887 eDebug("set /proc/stb/tsmux/lnb_b_input to B failed!! (%m)");
890 eDebug("set /proc/stb/tsmux/lnb_b_input to B OK");
894 it->m_frontend->setData(eDVBFrontend::SATPOS_DEPENDS_PTR, -1);
895 it->m_frontend->setData(eDVBFrontend::LINKED_PREV_PTR, -1);
896 it->m_frontend->setData(eDVBFrontend::LINKED_NEXT_PTR, -1);
897 it->m_frontend->setData(eDVBFrontend::ROTOR_POS, -1);
898 it->m_frontend->setData(eDVBFrontend::ROTOR_CMD, -1);
904 /* LNB Specific Parameters */
905 RESULT eDVBSatelliteEquipmentControl::addLNB()
907 if ( (m_lnbidx+1) < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)))
908 m_curSat=m_lnbs[++m_lnbidx].m_satellites.end();
911 eDebug("no more LNB free... cnt is %d", m_lnbidx);
914 eSecDebug("eDVBSatelliteEquipmentControl::addLNB(%d)", m_lnbidx);
918 RESULT eDVBSatelliteEquipmentControl::setLNBSlotMask(int slotmask)
920 eSecDebug("eDVBSatelliteEquipmentControl::setLNBSlotMask(%d)", slotmask);
921 if ( currentLNBValid() )
922 m_lnbs[m_lnbidx].slot_mask = slotmask;
928 RESULT eDVBSatelliteEquipmentControl::setLNBLOFL(int lofl)
930 eSecDebug("eDVBSatelliteEquipmentControl::setLNBLOFL(%d)", lofl);
931 if ( currentLNBValid() )
932 m_lnbs[m_lnbidx].m_lof_lo = lofl;
938 RESULT eDVBSatelliteEquipmentControl::setLNBLOFH(int lofh)
940 eSecDebug("eDVBSatelliteEquipmentControl::setLNBLOFH(%d)", lofh);
941 if ( currentLNBValid() )
942 m_lnbs[m_lnbidx].m_lof_hi = lofh;
948 RESULT eDVBSatelliteEquipmentControl::setLNBThreshold(int threshold)
950 eSecDebug("eDVBSatelliteEquipmentControl::setLNBThreshold(%d)", threshold);
951 if ( currentLNBValid() )
952 m_lnbs[m_lnbidx].m_lof_threshold = threshold;
958 RESULT eDVBSatelliteEquipmentControl::setLNBIncreasedVoltage(bool onoff)
960 eSecDebug("eDVBSatelliteEquipmentControl::setLNBIncreasedVoltage(%d)", onoff);
961 if ( currentLNBValid() )
962 m_lnbs[m_lnbidx].m_increased_voltage = onoff;
968 /* DiSEqC Specific Parameters */
969 RESULT eDVBSatelliteEquipmentControl::setDiSEqCMode(int diseqcmode)
971 eSecDebug("eDVBSatelliteEquipmentControl::setDiSEqcMode(%d)", diseqcmode);
972 if ( currentLNBValid() )
973 m_lnbs[m_lnbidx].m_diseqc_parameters.m_diseqc_mode = (eDVBSatelliteDiseqcParameters::t_diseqc_mode)diseqcmode;
979 RESULT eDVBSatelliteEquipmentControl::setToneburst(int toneburst)
981 eSecDebug("eDVBSatelliteEquipmentControl::setToneburst(%d)", toneburst);
982 if ( currentLNBValid() )
983 m_lnbs[m_lnbidx].m_diseqc_parameters.m_toneburst_param = (eDVBSatelliteDiseqcParameters::t_toneburst_param)toneburst;
989 RESULT eDVBSatelliteEquipmentControl::setRepeats(int repeats)
991 eSecDebug("eDVBSatelliteEquipmentControl::setRepeats(%d)", repeats);
992 if ( currentLNBValid() )
993 m_lnbs[m_lnbidx].m_diseqc_parameters.m_repeats=repeats;
999 RESULT eDVBSatelliteEquipmentControl::setCommittedCommand(int command)
1001 eSecDebug("eDVBSatelliteEquipmentControl::setCommittedCommand(%d)", command);
1002 if ( currentLNBValid() )
1003 m_lnbs[m_lnbidx].m_diseqc_parameters.m_committed_cmd=command;
1009 RESULT eDVBSatelliteEquipmentControl::setUncommittedCommand(int command)
1011 eSecDebug("eDVBSatelliteEquipmentControl::setUncommittedCommand(%d)", command);
1012 if ( currentLNBValid() )
1013 m_lnbs[m_lnbidx].m_diseqc_parameters.m_uncommitted_cmd = command;
1019 RESULT eDVBSatelliteEquipmentControl::setCommandOrder(int order)
1021 eSecDebug("eDVBSatelliteEquipmentControl::setCommandOrder(%d)", order);
1022 if ( currentLNBValid() )
1023 m_lnbs[m_lnbidx].m_diseqc_parameters.m_command_order=order;
1029 RESULT eDVBSatelliteEquipmentControl::setFastDiSEqC(bool onoff)
1031 eSecDebug("eDVBSatelliteEquipmentControl::setFastDiSEqc(%d)", onoff);
1032 if ( currentLNBValid() )
1033 m_lnbs[m_lnbidx].m_diseqc_parameters.m_use_fast=onoff;
1039 RESULT eDVBSatelliteEquipmentControl::setSeqRepeat(bool onoff)
1041 eSecDebug("eDVBSatelliteEquipmentControl::setSeqRepeat(%d)", onoff);
1042 if ( currentLNBValid() )
1043 m_lnbs[m_lnbidx].m_diseqc_parameters.m_seq_repeat = onoff;
1049 /* Rotor Specific Parameters */
1050 RESULT eDVBSatelliteEquipmentControl::setLongitude(float longitude)
1052 eSecDebug("eDVBSatelliteEquipmentControl::setLongitude(%f)", longitude);
1053 if ( currentLNBValid() )
1054 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_longitude=longitude;
1060 RESULT eDVBSatelliteEquipmentControl::setLatitude(float latitude)
1062 eSecDebug("eDVBSatelliteEquipmentControl::setLatitude(%f)", latitude);
1063 if ( currentLNBValid() )
1064 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_latitude=latitude;
1070 RESULT eDVBSatelliteEquipmentControl::setLoDirection(int direction)
1072 eSecDebug("eDVBSatelliteEquipmentControl::setLoDirection(%d)", direction);
1073 if ( currentLNBValid() )
1074 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_lo_direction=direction;
1080 RESULT eDVBSatelliteEquipmentControl::setLaDirection(int direction)
1082 eSecDebug("eDVBSatelliteEquipmentControl::setLaDirection(%d)", direction);
1083 if ( currentLNBValid() )
1084 m_lnbs[m_lnbidx].m_rotor_parameters.m_gotoxx_parameters.m_la_direction=direction;
1090 RESULT eDVBSatelliteEquipmentControl::setUseInputpower(bool onoff)
1092 eSecDebug("eDVBSatelliteEquipmentControl::setUseInputpower(%d)", onoff);
1093 if ( currentLNBValid() )
1094 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_use=onoff;
1100 RESULT eDVBSatelliteEquipmentControl::setInputpowerDelta(int delta)
1102 eSecDebug("eDVBSatelliteEquipmentControl::setInputpowerDelta(%d)", delta);
1103 if ( currentLNBValid() )
1104 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_delta=delta;
1110 /* Satellite Specific Parameters */
1111 RESULT eDVBSatelliteEquipmentControl::addSatellite(int orbital_position)
1113 eSecDebug("eDVBSatelliteEquipmentControl::addSatellite(%d)", orbital_position);
1114 if ( currentLNBValid() )
1116 std::map<int, eDVBSatelliteSwitchParameters>::iterator it =
1117 m_lnbs[m_lnbidx].m_satellites.find(orbital_position);
1118 if ( it == m_lnbs[m_lnbidx].m_satellites.end() )
1120 std::pair<std::map<int, eDVBSatelliteSwitchParameters>::iterator, bool > ret =
1121 m_lnbs[m_lnbidx].m_satellites.insert(
1122 std::pair<int, eDVBSatelliteSwitchParameters>(orbital_position, eDVBSatelliteSwitchParameters())
1125 m_curSat = ret.first;
1137 RESULT eDVBSatelliteEquipmentControl::setVoltageMode(int mode)
1139 eSecDebug("eDVBSatelliteEquipmentControl::setVoltageMode(%d)", mode);
1140 if ( currentLNBValid() && m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
1141 m_curSat->second.m_voltage_mode = (eDVBSatelliteSwitchParameters::t_voltage_mode)mode;
1148 RESULT eDVBSatelliteEquipmentControl::setToneMode(int mode)
1150 eSecDebug("eDVBSatelliteEquipmentControl::setToneMode(%d)", mode);
1151 if ( currentLNBValid() )
1153 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
1154 m_curSat->second.m_22khz_signal = (eDVBSatelliteSwitchParameters::t_22khz_signal)mode;
1163 RESULT eDVBSatelliteEquipmentControl::setRotorPosNum(int rotor_pos_num)
1165 eSecDebug("eDVBSatelliteEquipmentControl::setRotorPosNum(%d)", rotor_pos_num);
1166 if ( currentLNBValid() )
1168 if ( m_curSat != m_lnbs[m_lnbidx].m_satellites.end() )
1169 m_curSat->second.m_rotorPosNum=rotor_pos_num;
1178 RESULT eDVBSatelliteEquipmentControl::setRotorTurningSpeed(int speed)
1180 eSecDebug("eDVBSatelliteEquipmentControl::setRotorTurningSpeed(%d)", speed);
1181 if ( currentLNBValid() )
1182 m_lnbs[m_lnbidx].m_rotor_parameters.m_inputpower_parameters.m_turning_speed = speed;
1190 int orb_pos, lofl, lofh;
1191 sat_compare(int o, int lofl, int lofh)
1192 :orb_pos(o), lofl(lofl), lofh(lofh)
1194 sat_compare(const sat_compare &x)
1195 :orb_pos(x.orb_pos), lofl(x.lofl), lofh(x.lofh)
1197 bool operator < (const sat_compare & cmp) const
1199 if (orb_pos == cmp.orb_pos)
1201 if ( abs(lofl-cmp.lofl) < 200000 )
1203 if (abs(lofh-cmp.lofh) < 200000)
1205 return lofh<cmp.lofh;
1207 return lofl<cmp.lofl;
1209 return orb_pos < cmp.orb_pos;
1213 RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2)
1215 eSecDebug("eDVBSatelliteEquipmentControl::setTunerLinked(%d, %d)", tu1, tu2);
1218 eDVBRegisteredFrontend *p1=NULL, *p2=NULL;
1220 for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
1222 if (it->m_frontend->getSlotID() == tu1)
1224 else if (it->m_frontend->getSlotID() == tu2)
1229 p1->m_frontend->setData(eDVBFrontend::LINKED_PREV_PTR, (long)p2);
1230 p2->m_frontend->setData(eDVBFrontend::LINKED_NEXT_PTR, (long)p1);
1231 if (!strcmp(p1->m_frontend->getDescription(), p2->m_frontend->getDescription()) && !strcmp(p1->m_frontend->getDescription(), "BCM4501 (internal)"))
1233 FILE *f=fopen("/proc/stb/tsmux/lnb_b_input", "w");
1234 if (!f || fwrite("A", 1, 1, f) != 1)
1235 eDebug("set /proc/stb/tsmux/lnb_b_input to A failed!! (%m)");
1238 eDebug("set /proc/stb/tsmux/lnb_b_input to A OK");
1248 RESULT eDVBSatelliteEquipmentControl::setTunerDepends(int tu1, int tu2)
1250 eSecDebug("eDVBSatelliteEquipmentControl::setTunerDepends(%d, %d)", tu1, tu2);
1254 eDVBRegisteredFrontend *p1=NULL, *p2=NULL;
1256 for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_avail_frontends.begin()); it != m_avail_frontends.end(); ++it)
1258 if (it->m_frontend->getSlotID() == tu1)
1260 else if (it->m_frontend->getSlotID() == tu2)
1265 p1->m_frontend->setData(eDVBFrontend::SATPOS_DEPENDS_PTR, (long)p2);
1266 p2->m_frontend->setData(eDVBFrontend::SATPOS_DEPENDS_PTR, (long)p1);
1272 void eDVBSatelliteEquipmentControl::setSlotNotLinked(int slot_no)
1274 eSecDebug("eDVBSatelliteEquipmentControl::setSlotNotLinked(%d)", slot_no);
1275 m_not_linked_slot_mask |= (1 << slot_no);
1278 bool eDVBSatelliteEquipmentControl::isRotorMoving()
1280 return m_rotorMoving;
1283 void eDVBSatelliteEquipmentControl::setRotorMoving(bool b)