Ticket #518: mythdiseqcupdate-1.patch
File mythdiseqcupdate-1.patch, 4.4 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/dvbdiseqc.cpp
71 71 break; 72 72 case 2: // v1.0 2 Way 73 73 case 3: // v1.1 2 Way 74 if (!Diseqc1xSwitch(tuning, reset, havetuned, 2)) 75 return false; 76 break; 74 77 case 4: // v1.0 4 Way 75 78 case 5: // v1.1 4 Way 76 if (!Diseqc1xSwitch(tuning, reset, havetuned ))79 if (!Diseqc1xSwitch(tuning, reset, havetuned, 4)) 77 80 return false; 78 81 break; 79 82 case 6: // 1.2 Positioner (HH Motor) … … 85 88 return false; 86 89 break; 87 90 case 8: // v1.1 10 Way 88 if (!Diseqc1xSwitch _10way(tuning, reset, havetuned))91 if (!Diseqc1xSwitch(tuning, reset, havetuned, 10)) 89 92 return false; 90 93 break; 91 94 … … 322 325 return true; 323 326 } 324 327 325 bool DVBDiSEqC::Diseqc1xSwitch _10way(DVBTuning& tuning, bool reset,326 bool& havetuned )328 bool DVBDiSEqC::Diseqc1xSwitch(DVBTuning& tuning, bool reset, 329 bool& havetuned, unsigned int ports) 327 330 { 331 332 328 333 if (reset) 329 334 { 330 335 if (!DiseqcReset()) … … 334 339 } 335 340 } 336 341 337 GENERAL(QString("DiSEqC 1.1 Switch - Port %1").arg(tuning.diseqc_port)); 342 CHANNEL(QString("DiSEqC 1.1 Switch (%1 ports) - Port %2 - %3 %4") 343 .arg(ports) 344 .arg(tuning.diseqc_port) 345 .arg(tuning.tone==SEC_TONE_ON?"Tone ON":"Tone OFF") 346 .arg(tuning.voltage==SEC_VOLTAGE_13?"13V":"18V")); 338 347 339 348 if ((prev_tuning.diseqc_port != tuning.diseqc_port || 340 349 prev_tuning.tone != tuning.tone || 341 350 prev_tuning.voltage != tuning.voltage) || reset) 342 351 { 343 if (tuning.diseqc_port > 9) 344 { 345 ERRNO("Supports only up to 10-way switches."); 346 return false; 347 } 348 349 dvb_diseqc_master_cmd cmd = 352 dvb_diseqc_master_cmd cmd = 350 353 {{CMD_FIRST, MASTER_TO_LSS, WRITE_N1, 0xf0, 0x00, 0x00}, 4}; 351 354 352 cmd.msg[DATA_1] = 0xF0 353 | (tuning.diseqc_port & 0x0F); 354 355 if (!SendDiSEqCMessage(tuning,cmd)) 355 if (tuning.diseqc_port >= ports ) 356 356 { 357 ERRNO( "Setting DiSEqC failed.\n");357 ERRNO(QString("Supports only up to %d-way switches.").arg(ports)); 358 358 return false; 359 359 } 360 360 361 prev_tuning.diseqc_port = tuning.diseqc_port;362 prev_tuning.tone = tuning.tone;363 prev_tuning.voltage = tuning.voltage;364 havetuned = true;365 361 366 } 367 368 return true; 369 } 370 371 bool DVBDiSEqC::Diseqc1xSwitch(DVBTuning& tuning, bool reset, 372 bool& havetuned) 373 { 374 if (reset) 375 { 376 if (!DiseqcReset()) 362 switch (ports) 377 363 { 378 ERRNO("DiseqcReset() failed"); 379 return false; 380 } 381 } 364 case 10: 365 cmd.msg[COMMAND] = WRITE_N1; 382 366 383 GENERAL(QString("DiSEqC 1.0 Switch - Port %1").arg(tuning.diseqc_port)); 367 cmd.msg[DATA_1] = 0xF0 368 | (tuning.diseqc_port & 0x0F); 369 break; 370 case 4: 371 case 2: 372 cmd.msg[COMMAND] = WRITE_N0; 384 373 385 if ((prev_tuning.diseqc_port != tuning.diseqc_port || 386 prev_tuning.tone != tuning.tone || 387 prev_tuning.voltage != tuning.voltage) || reset) 388 { 389 if (tuning.diseqc_port > 3) 390 { 391 ERRNO("Supports only up to 4-way switches."); 392 return false; 374 cmd.msg[DATA_1] = 0xF0 375 | (((tuning.diseqc_port) * 4) & 0x0F) 376 | ((tuning.voltage == SEC_VOLTAGE_18) ? 2 : 0) 377 | ((tuning.tone == SEC_TONE_ON) ? 1 : 0); 378 break; 379 default: 380 ERRNO("Unsupported number of ports for DiSEqC 1.1 Switch"); 393 381 } 394 382 395 dvb_diseqc_master_cmd cmd =396 {{CMD_FIRST, MASTER_TO_LSS, WRITE_N0, 0xf0, 0x00, 0x00}, 4};397 398 cmd.msg[DATA_1] = 0xF0399 | (((tuning.diseqc_port) * 4) & 0x0F)400 | ((tuning.voltage == SEC_VOLTAGE_18) ? 2 : 0)401 | ((tuning.tone == SEC_TONE_ON) ? 1 : 0);402 403 383 if (!SendDiSEqCMessage(tuning,cmd)) 404 384 { 405 385 ERRNO("Setting DiSEqC failed.\n");