Ticket #2135: diseqc-powerup-delay.patch

File diseqc-powerup-delay.patch, 1.8 KB (added by yeasah@…, 13 years ago)
  • libs/libmythtv/diseqc.cpp

     
    2929// DiSEqC sleep intervals per eutelsat spec
    3030#define DISEQC_SHORT_WAIT     (15 * 1000)
    3131#define DISEQC_LONG_WAIT      (100 * 1000)
     32#define DISEQC_POWER_OFF_WAIT (1000 * 1000)
     33#define DISEQC_POWER_ON_WAIT  (500 * 1000)
    3234
    3335// Number of times to retry ioctls after receiving ETIMEDOUT before giving up
    3436#define TIMEOUT_RETRIES       10
     
    641643{
    642644    Reset();
    643645
    644     VERBOSE(VB_CHANNEL, LOC + "Resetting DiSEqC Bus");
     646    // power cycle the bus if requested
     647    // tests show that the wait times required can be very long (~1sec)
     648    if (hard_reset)
     649    {
     650        VERBOSE(VB_CHANNEL, LOC + "Power-cycling DiSEqC Bus");
    645651
     652        SetVoltage(SEC_VOLTAGE_OFF);
     653        usleep(DISEQC_POWER_OFF_WAIT);
     654    }
     655
     656    // make sure the bus is powered
     657    SetVoltage(SEC_VOLTAGE_18);
     658    usleep(DISEQC_POWER_ON_WAIT);
     659
    646660    // issue a global reset command
     661    VERBOSE(VB_CHANNEL, LOC + "Resetting DiSEqC Bus");
    647662    if (!SendCommand(DISEQC_ADR_ALL, DISEQC_CMD_RESET))
    648663    {
    649664        VERBOSE(VB_IMPORTANT, LOC_ERR +
     
    653668
    654669    usleep(DISEQC_LONG_WAIT);
    655670
    656     // power cycle the bus if requested
    657     if (hard_reset)
    658     {
    659         VERBOSE(VB_CHANNEL, LOC + "Power-cycling DiSEqC Bus");
    660671
    661         SetVoltage(SEC_VOLTAGE_OFF);
    662         usleep(DISEQC_LONG_WAIT);
    663 
    664         SetVoltage(SEC_VOLTAGE_18);
    665         usleep(DISEQC_LONG_WAIT);
    666     }
    667 
    668672    return true;
    669673}
    670674
    671675void DiSEqCDevTree::Open(int fd_frontend)
    672676{
    673677    m_fd_frontend = fd_frontend;
    674     ResetDiseqc(true);
     678
     679    // issue reset command
     680    ResetDiseqc(false);
    675681}
    676682
    677683bool DiSEqCDevTree::SetVoltage(uint voltage)