1 diff -Naur enigma_org/include/lib/dvb/frontend.h enigma/include/lib/dvb/frontend.h
2 --- enigma_org/include/lib/dvb/frontend.h 2007-08-06 22:54:26.000000000 +0200
3 +++ enigma/include/lib/dvb/frontend.h 2007-08-06 22:47:44.000000000 +0200
5 class eFrontend: public Object
10 #if HAVE_DVB_API_VERSION < 3
25 - curRotorPos; // current Orbital Position
32 + curRotorPos; // current Orbital Position
35 eTransponder *transponder;
36 static eFrontend *frontend;
37 eTimer rotorTimer1, rotorTimer2,
38 #if HAVE_DVB_API_VERSION >=3
42 - checkRotorLockTimer, checkLockTimer, updateTransponderTimer;
43 + checkRotorLockTimer, checkLockTimer, updateTransponderTimer;
45 int tries, noRotorCmd, wasLoopthrough, lostlockcount;
46 Signal1<void, eTransponder*> tpChanged;
50 - int runningPowerInput;
52 + int idlePowerInput_l,
57 // Non blocking rotor turning
64 #if HAVE_DVB_API_VERSION < 3
65 FrontendParameters front;
66 diff -Naur enigma_org/lib/dvb/frontend.cpp enigma/lib/dvb/frontend.cpp
67 --- enigma_org/lib/dvb/frontend.cpp 2007-08-06 22:54:26.000000000 +0200
68 +++ enigma/lib/dvb/frontend.cpp 2007-08-06 22:55:48.000000000 +0200
71 eFrontend* eFrontend::frontend;
73 +#ifndef I2C_SLAVE_FORCE
74 +#define I2C_SLAVE_FORCE 0x0706
77 eFrontend::eFrontend(int type, const char *demod, const char *sec)
79 curRotorPos(10000), transponder(0), rotorTimer1(eApp),
83 checkRotorLockTimer(eApp), checkLockTimer(eApp),
84 - updateTransponderTimer(eApp), sn(0), noRotorCmd(0)
85 + updateTransponderTimer(eApp), sn(0), noRotorCmd(0),
86 + idlePowerInput_l(0), idlePowerInput_h(0)
88 CONNECT(rotorTimer1.timeout, eFrontend::RotorStartLoop );
89 CONNECT(rotorTimer2.timeout, eFrontend::RotorRunningLoop );
96 +void setCurrentLimitingMode(int mode)
98 +#if HAVE_DVB_API_VERSION < 3
99 +#warning FIXME setCurrentLimitingMode just for frontends with LNBP21
100 + if ( eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM7020
101 + || eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM500PLUS
102 + || eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM600PVR )
104 + int fd=::open("/dev/i2c/0", O_RDWR);
107 + unsigned char data[2];
108 + ::ioctl(fd, I2C_SLAVE_FORCE, 0x10 >> 1);
109 + if(::read(fd, data, 1) != 1)
110 + eDebug("error read lnbp (%m)");
113 + if (mode == STATIC)
114 + data[0] |= 0x80; // set static current limiting
116 + data[0] &= ~0x80; // set dynamic current limiting
117 + if(::write(fd, data, 1) != 1)
118 + eDebug("error write lnbp (%m)");
123 + eDebug("couldn't open /dev/i2c/0 (%m)");
128 void eFrontend::checkRotorLock()
133 eDebug("[FE] rotor has stopped..");
135 + setCurrentLimitingMode(DYNAMIC);
136 /*emit*/ tunedIn(transponder, 0);
137 // eDebug("!!!!!!!!!!!!!!!! TUNED IN OK 1 !!!!!!!!!!!!!!!!");
138 if ( !eDVB::getInstance()->getScanAPI() )
140 seq.voltage=SEC_VOLTAGE_OFF;
143 - return ::ioctl(secfd, SEC_SEND_SEQUENCE, &seq);
144 + int ret = ::ioctl(secfd, SEC_SEND_SEQUENCE, &seq);
146 + eDebug("SEC_SEND_SEQUENCE failed(%m)");
150 int eFrontend::SendSequence( const eSecCmdSequence &seq )
151 @@ -1033,10 +1073,7 @@
152 // send DiSEqC Sequence ( normal diseqc switches )
153 seq.continuousTone = eSecCmdSequence::TONE_OFF;
154 if ( SendSequence(seq) < 0 )
156 - eDebug("SendSequence failed (%m)");
159 else if ( lnb->getDiSEqC().SeqRepeat ) // Sequence Repeat selected ?
161 usleep( 100000 ); // between seq repeats we wait 75ms
162 @@ -1048,6 +1085,7 @@
163 usleep( 100000 ); // wait 100ms
165 // send DiSEqC Sequence (Rotor)
166 + setCurrentLimitingMode(STATIC);
167 seq.commands=&commands[seq.numCommands]; // last command is rotor cmd... see above...
168 seq.numCommands=1; // only rotor cmd
169 seq.toneBurst = eSecCmdSequence::NONE;
170 @@ -1072,7 +1110,6 @@
172 dvb_diseqc_master_cmd *commands = seq.commands;
176 int secTone = seq.continuousTone;
178 @@ -1086,14 +1123,12 @@
180 seq.continuousTone=SEC_TONE_OFF;
181 if ( SendSequence(seq) < 0 )
183 - eDebug("SendSequence failed (%m)");
186 else if ( lnb->getDiSEqC().SeqRepeat ) // Sequence Repeat selected ?
188 usleep( 100000 ); // between seq repeats we wait 100ms
189 - SendSequence(seq); // then repeat the cmd
190 + if ( SendSequence(seq) < 0 )
194 if ( lastLNB != lnb )
195 @@ -1103,15 +1138,48 @@
199 - usleep( 100*1000 ); // wait 100ms
200 -// eDebug("sleep 100ms");
201 + usleep( 50*1000 ); // wait 50ms
202 +// eDebug("sleep 50ms");
205 + // get power input of Rotor on idle 13V .. only working with a dreambox
206 + if ( !idlePowerInput_l )
208 + idlePowerInput_l = readInputPower();
209 + if ( idlePowerInput_l < 0 )
210 + return idlePowerInput_l;
211 +// eDebug("idle power input l = %dmA", idlePowerInput_l );
214 -// get power input of Rotor on idle not work on dbox yet .. only dreambox
215 - idlePowerInput = readInputPower();
216 - if ( idlePowerInput < 0 )
217 - return idlePowerInput;
218 -// eDebug("idle power input = %dmA", idlePowerInput );
219 + setCurrentLimitingMode(STATIC);
221 + // get power input of Rotor on idle 18V .. only working with a dreambox
222 + if ( !idlePowerInput_h)
224 +#if HAVE_DVB_API_VERSION < 3
225 + if (::ioctl(secfd, SEC_SET_VOLTAGE, increased ? SEC_VOLTAGE_18_5 : SEC_VOLTAGE_18) < 0 )
226 + eDebug("SEC_SET_VOLTAGE failed (%m)");
228 + if ( ::ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18) < 0 )
229 + eDebug("FE_SET_VOLTAGE failed (%m)");
231 + usleep( 50*1000 ); // wait 50ms
232 + idlePowerInput_h = readInputPower();
233 + if ( idlePowerInput_h < 0 )
235 + setCurrentLimitingMode(DYNAMIC);
236 + return idlePowerInput_h;
238 +// eDebug("idle power input h = %dmA", idlePowerInput_h );
239 +#if HAVE_DVB_API_VERSION < 3
240 + if (::ioctl(secfd, SEC_SET_VOLTAGE, increased ? SEC_VOLTAGE_13_5 : SEC_VOLTAGE_13) < 0 )
241 + eDebug("SEC_SET_VOLTAGE failed (%m)");
243 + if ( ::ioctl(fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13) < 0 )
244 + eDebug("FE_SET_VOLTAGE failed (%m)");
246 + usleep( 50*1000 ); // wait 50ms
249 // send DiSEqC Sequence (Rotor)
250 seq.commands=&commands[seq.numCommands]; // last command is rotor cmd... see above...
251 @@ -1122,7 +1190,7 @@
252 seq.continuousTone=secTone;
253 if ( SendSequence(seq) < 0 )
255 - eDebug("SendSequence failed (%m)");
256 + setCurrentLimitingMode(DYNAMIC);
259 // set rotor start timeout // 2 sek..
260 @@ -1147,11 +1215,14 @@
262 runningPowerInput = readInputPower();
263 if ( runningPowerInput < 0 )
265 + setCurrentLimitingMode(DYNAMIC);
268 // eDebug("running %d mA", runningPowerInput);
269 // eDebug("delta %d mA", DeltaA);
271 - if ( abs(runningPowerInput-idlePowerInput ) >= (DeltaA&0xFF) ) // rotor running ?
272 + if ( abs(runningPowerInput-idlePowerInput_l ) >= (DeltaA&0xFF) ) // rotor running ?
274 if ( (DeltaA & 0x200) == 0x200 )
276 @@ -1182,17 +1253,43 @@
279 gettimeofday(&now,0);
281 + if ( voltageState == eSecCmdSequence::VOLTAGE_13 )
283 + timeval tmp = rotorTimeout - now;
284 + int timeout_msek = tmp.tv_sec * 1000 + tmp.tv_usec / 1000;
285 + if ( timeout_msek < 149700 ) // rotor running at least 300msek?
287 + // then switch to higher voltage
288 +#if HAVE_DVB_API_VERSION < 3
289 + if (::ioctl(secfd, SEC_SET_VOLTAGE, increased ? SEC_VOLTAGE_18_5 : SEC_VOLTAGE_18) < 0 )
290 + eDebug("SEC_SET_VOLTAGE failed (%m)");
292 + if ( ::ioctl(fd, FE_SET_VOLTAGE, voltage) < 0 )
293 + eDebug("FE_SET_VOLTAGE failed (%m)");
294 + curVoltage = voltage;
296 + voltageState = eSecCmdSequence::VOLTAGE_18;
300 if ( rotorTimeout < now )
302 eDebug("Rotor timeouted :-(");
303 /* emit */ s_RotorTimeout();
304 + setCurrentLimitingMode(DYNAMIC);
308 + int &idlePowerInput = (voltageState == eSecCmdSequence::VOLTAGE_13) ? idlePowerInput_l : idlePowerInput_h;
310 runningPowerInput = readInputPower();
311 if ( runningPowerInput < 0 )
313 + setCurrentLimitingMode(DYNAMIC);
315 -// eDebug("running %d mA", runningPowerInput);
317 + // eDebug("running %d mA, idle %d mA", runningPowerInput, idlePowerInput);
319 if ( abs( idlePowerInput-runningPowerInput ) <= (DeltaA&0xFF) ) // rotor stoped ?
321 @@ -1216,7 +1313,8 @@
323 if (type != eSystemInfo::feSatellite)
325 - if ( eSystemInfo::getInstance()->canMeasureLNBCurrent() == 1 )
326 + setCurrentLimitingMode(DYNAMIC);
327 + if ( voltageState == eSecCmdSequence::VOLTAGE_18 )
329 if ( voltage != eSecCmdSequence::VOLTAGE_18 )
330 #if HAVE_DVB_API_VERSION < 3
331 @@ -1228,7 +1326,7 @@
332 curVoltage = voltage;
335 - else // can only measure with lower lnb voltage ( 13V )
338 if ( voltage != eSecCmdSequence::VOLTAGE_13 )
339 #if HAVE_DVB_API_VERSION < 3
340 @@ -1466,7 +1564,10 @@
341 checkLockTimer.stop();
343 if ( curRotorPos > 11000 )
346 + setCurrentLimitingMode(DYNAMIC);
349 // eDebug("ROTOR STOPPED 1");
350 /* emit */ s_RotorStopped();
351 @@ -1886,16 +1987,10 @@
352 commands[cmdCount-1].u.diseqc.params[1]);
355 - // drive rotor with 18V when we can measure inputpower
356 - // or we know which orbital pos currently is selected
357 + // when we can measure inputpower we start rotor turning with 13V
358 if ( lnb->getDiSEqC().useRotorInPower&1 )
360 - if ( eSystemInfo::getInstance()->canMeasureLNBCurrent() == 1 ) // can measure with voltage > 13V ?
361 - seq.voltage = eSecCmdSequence::VOLTAGE_18;
363 - seq.voltage = eSecCmdSequence::VOLTAGE_13;
366 + voltageState = seq.voltage = eSecCmdSequence::VOLTAGE_13;
367 + else // without measure input power we must start with the correct voltage
368 seq.voltage = voltage;
370 lastRotorCmd=RotorCmd;
371 @@ -1926,14 +2021,12 @@
374 if ( SendSequence(seq) < 0 )
376 - eDebug("SendSequence failed (%m)");
379 else if ( lnb->getDiSEqC().DiSEqCMode >= eDiSEqC::V1_1 && lnb->getDiSEqC().SeqRepeat ) // Sequence Repeat ?
381 usleep( 100000 ); // between seq repeats we wait 80ms
382 - SendSequence(seq); // just do it *g*
383 + if ( SendSequence(seq) < 0 )
387 else if ( lastcsw != csw )
388 @@ -2083,10 +2176,7 @@
389 seq.continuousTone = eSecCmdSequence::TONE_OFF;
390 seq.toneBurst = eSecCmdSequence::NONE;
391 if (SendSequence(seq) < 0 )
393 - eDebug("SendSequence failed (%m)");
397 if ( ioctl(fd, FE_SET_POWER_STATE, FE_POWER_OFF) < 0 )
398 eDebug("FE_SET_POWER_STATE failed (%m)");
399 diff -Naur enigma_org/lib/system/info.cpp enigma/lib/system/info.cpp
400 --- enigma_org/lib/system/info.cpp 2007-08-06 22:54:26.000000000 +0200
401 +++ enigma/lib/system/info.cpp 2007-08-06 22:47:44.000000000 +0200
405 cpustr="STB04500, 252MHz";
406 - hasrfmod = hashdd = haslcd = hasci
407 - = canrecordts = hasstandbywakeuptimer = cantimeshift = 1;
408 - // check if the box revision is new enough to measure
409 - // lnb power with > 13V ( revisions with lnbp21 can this )
410 - int fd = open("/dev/dbox/fp0", O_RDWR);
413 - if ( ::ioctl( fd, 0x100, 0 ) == 0 )
414 - canmeasurelnbcurrent=1;
416 - canmeasurelnbcurrent=2;
419 + hasrfmod = hashdd = haslcd = hasci = canrecordts =
420 + hasstandbywakeuptimer = cantimeshift = canmeasurelnbcurrent = 1;
422 defaulttimertype=ePlaylistEntry::RecTimerEntry|ePlaylistEntry::recDVR;