Ticket #9726: 0029-mythtv-0.26-reset_diseqc_bus_only_once_v4.patch

File 0029-mythtv-0.26-reset_diseqc_bus_only_once_v4.patch, 4.4 KB (added by warpme@…, 12 years ago)

reset disecq only once for SCR busses

  • mythtv/libs/libmythtv/diseqc.cpp

    diff -Naur mythtv-0.26-20120823-g6566c3c-old/mythtv/libs/libmythtv/diseqc.cpp mythtv-0.26-20120823-g6566c3c-new/mythtv/libs/libmythtv/diseqc.cpp
    old new  
    8787
    8888#define LOC      QString("DiSEqCDevTree: ")
    8989
     90bool diseqc_bus_already_reset = false;
     91
    9092QString DiSEqCDevDevice::TableToString(uint type, const TypeTable *table)
    9193{
    9294    for (; !table->name.isEmpty(); table++)
     
    709711 *  \param hard_reset If true, the bus will be power cycled.
    710712 *  \return True if successful.
    711713 */
    712 bool DiSEqCDevTree::ResetDiseqc(bool hard_reset)
     714bool DiSEqCDevTree::ResetDiseqc(bool hard_reset, bool is_SCR)
    713715{
    714716    Reset();
    715717
     
    721723
    722724        SetVoltage(SEC_VOLTAGE_OFF);
    723725        usleep(DISEQC_POWER_OFF_WAIT);
     726        diseqc_bus_already_reset = false;
    724727    }
    725728
    726     // make sure the bus is powered
    727     SetVoltage(SEC_VOLTAGE_18);
    728     usleep(DISEQC_POWER_ON_WAIT);
    729     // some DiSEqC devices need more time. see #8465
    730     usleep(DISEQC_POWER_ON_WAIT);
    731 
    732     // issue a global reset command
    733     LOG(VB_CHANNEL, LOG_INFO, LOC + "Resetting DiSEqC Bus");
    734     if (!SendCommand(DISEQC_ADR_ALL, DISEQC_CMD_RESET))
     729    if (!diseqc_bus_already_reset || !is_SCR)
    735730    {
    736         LOG(VB_GENERAL, LOG_ERR, LOC + "DiSEqC reset failed" + ENO);
    737         return false;
     731        // make sure the bus is powered
     732        SetVoltage(SEC_VOLTAGE_18);
     733        usleep(DISEQC_POWER_ON_WAIT);
     734        // some DiSEqC devices need more time. see #8465
     735        usleep(DISEQC_POWER_ON_WAIT);
     736
     737        // issue a global reset command
     738        LOG(VB_CHANNEL, LOG_INFO, LOC + "Resetting DiSEqC Bus");
     739        if (!SendCommand(DISEQC_ADR_ALL, DISEQC_CMD_RESET))
     740        {
     741            LOG(VB_GENERAL, LOG_ERR, LOC + "DiSEqC reset failed" + ENO);
     742            return false;
     743        }
     744       
     745        if (is_SCR)
     746            diseqc_bus_already_reset = true;
     747    }
     748    else
     749    {
     750        LOG(VB_CHANNEL, LOG_INFO, LOC + "Skiping reset: already done for this SCR bus");
    738751    }
    739752
    740753    usleep(DISEQC_LONG_WAIT);
     
    742755    return true;
    743756}
    744757
    745 void DiSEqCDevTree::Open(int fd_frontend)
     758void DiSEqCDevTree::Open(int fd_frontend, bool is_SCR)
    746759{
    747760    m_fd_frontend = fd_frontend;
    748761
    749762    // issue reset command
    750     ResetDiseqc(false /* do a soft reset */);
     763    ResetDiseqc(false, is_SCR);
    751764}
    752765
    753766bool DiSEqCDevTree::SetVoltage(uint voltage)
  • mythtv/libs/libmythtv/diseqc.h

    diff -Naur mythtv-0.26-20120823-g6566c3c-old/mythtv/libs/libmythtv/diseqc.h mythtv-0.26-20120823-g6566c3c-new/mythtv/libs/libmythtv/diseqc.h
    old new  
    9696    bool SendCommand(uint adr, uint cmd, uint repeats = 0,
    9797                     uint data_len = 0, unsigned char *data = NULL);
    9898
    99     bool ResetDiseqc(bool hard_reset);
     99    bool ResetDiseqc(bool hard_reset, bool is_SCR);
    100100
    101101    // frontend fd
    102     void Open(int fd_frontend);
     102    void Open(int fd_frontend, bool is_SCR);
    103103    void Close(void) { m_fd_frontend = -1; }
    104104    int  GetFD(void) const { return m_fd_frontend; }
    105105
  • mythtv/libs/libmythtv/dvbchannel.cpp

    diff -Naur mythtv-0.26-20120823-g6566c3c-old/mythtv/libs/libmythtv/dvbchannel.cpp mythtv-0.26-20120823-g6566c3c-new/mythtv/libs/libmythtv/dvbchannel.cpp
    old new  
    267267    // Turn on the power to the LNB
    268268    if (tunerType.IsDiSEqCSupported())
    269269    {
     270
    270271        diseqc_tree = diseqc_dev.FindTree(GetCardID());
    271272        if (diseqc_tree)
    272             diseqc_tree->Open(fd_frontend);
     273        {
     274            bool is_SCR = false;
     275
     276            DiSEqCDevSCR *scr = diseqc_tree->FindSCR(diseqc_settings);
     277            if (scr)
     278            {
     279                is_SCR = true;
     280                LOG(VB_CHANNEL, LOG_INFO, LOC + "Requested DVB channel is on SCR system");
     281            }
     282            else
     283                LOG(VB_CHANNEL, LOG_INFO, LOC + "Requested DVB channel is on non-SCR system");
     284
     285            diseqc_tree->Open(fd_frontend, is_SCR);
     286        }
    273287    }
    274288
    275289    dvbcam->Start();