Ticket #1037: legacysw.patch

File legacysw.patch, 4.7 KB (added by nooneimprt4nt@…, 20 years ago)
  • libs/libmythtv/videosource.cpp

     
    12421242        addSelection("DiSEqC v1.2 Positioner","6");
    12431243        addSelection("DiSEqC v1.3 Positioner (Goto X)","7");
    12441244        addSelection("DiSEqC v1.1 or 2.1 (10-way method2)","8");
     1245        addSelection("SW21 Switch","9");
     1246        addSelection("SW64 Switch","10");
    12451247        setHelpText(QObject::tr("Select the input type for DVB-S cards. "
    12461248                    "Leave as Single LNB/Input for DVB-C or DVB-T. "
    12471249                    "The inputs are mapped from Input Connections option "
     
    24042406    QString stxt = "DiSEqC Switch Input %1";
    24052407    QString mtxt = "DiSEqC v1.2 Motor Position %1";
    24062408    QString itxt = "DiSEqC v1.3 Input %1";
     2409    QString l21txt = "SW21 Input %1";
     2410    QString l64txt = "SW64 Input %1";
    24072411
    24082412    uint i;
    24092413    switch (dvb_diseqc_type)
     
    24332437                list.append(DVBDiSEqCInputList(
    24342438                                stxt.arg(i+1,2), QString::number(i), ""));
    24352439            break;
     2440        case 9:
     2441            for (i = 0; i < 2; ++i)
     2442                list.append(DVBDiSEqCInputList(
     2443                                l21txt.arg(i+1,2), QString::number(i), ""));
     2444            break;
     2445        case 10:
     2446            for (i = 0; i < 3; ++i)
     2447                list.append(DVBDiSEqCInputList(
     2448                                l64txt.arg(i+1,2), QString::number(i), ""));
     2449            break;
    24362450        default:
    24372451            list.append(DVBDiSEqCInputList(
    24382452                            QString("DVBInput"), QString(""), QString("")));
  • libs/libmythtv/dvbdiseqc.h

     
    3737   
    3838    bool ToneVoltageLnb(DVBTuning& tuning, bool reset, bool& havetuned);
    3939    bool ToneSwitch(DVBTuning& tuning, bool reset, bool& havetuned);
     40    bool LegacyDishSwitch(DVBTuning& tuning, bool reset, bool& havetuned);
    4041    bool Diseqc1xSwitch(DVBTuning& tuning, bool reset, bool& havetuned,
    4142                        uint ports);
    4243    bool PositionerGoto(DVBTuning& tuning, bool reset, bool& havetuned);
  • libs/libmythtv/dvbdiseqc.cpp

     
    9494            if (!Diseqc1xSwitch(tuning, reset, havetuned, 10))
    9595                return false;
    9696            break;
     97        case 9: // SW21
     98        case 10: // SW64
     99            if (!LegacyDishSwitch(tuning, reset, havetuned))
     100                return false;
     101            break;
    97102 
    98103        default:
    99104            VERBOSE(VB_IMPORTANT, LOC_ERR + "Unsupported DiSEqC type("
     
    103108    return true;
    104109}
    105110
     111bool DVBDiSEqC::LegacyDishSwitch(DVBTuning& tuning, bool reset,
     112             bool& havetuned)
     113{
     114    if (reset)
     115    {
     116      //Do legacy switches need to be reset?
     117    }
     118    GENERAL(QString("Legacy Dish Switch - Port %1").arg(tuning.diseqc_port));
     119    if ((prev_tuning.diseqc_port != tuning.diseqc_port ||
     120   prev_tuning.tone != tuning.tone ||
     121   prev_tuning.voltage != tuning.voltage) || reset)
     122    {
     123
     124   uint8_t cmd = 0x00;
     125
     126   switch(tuning.diseqc_type) {
     127       //is there a pattern here?
     128       case 9: //SW21
     129      if(! tuning.diseqc_port)
     130          cmd=0x34;
     131      else
     132          cmd=0x65;
     133      break;
     134       case 10: //SW64
     135      if(tuning.diseqc_port == 0)
     136          if(tuning.voltage == SEC_VOLTAGE_13)
     137         cmd=0x39;
     138          else
     139         cmd=0x1A;
     140      else if(tuning.diseqc_port == 1)
     141          if(tuning.voltage == SEC_VOLTAGE_13)
     142         cmd=0x4B;
     143          else
     144         cmd=0x5C;
     145      else
     146          if(tuning.voltage == SEC_VOLTAGE_13)
     147         cmd=0x0D;
     148          else
     149         cmd=0x2E;
     150      break;
     151   }
     152   if(tuning.voltage == SEC_VOLTAGE_18)
     153       cmd|=0x80;
     154
     155#ifdef FE_DISHNETWORK_SEND_LEGACY_CMD
     156   if (ioctl(fd_frontend, FE_DISHNETWORK_SEND_LEGACY_CMD, cmd) <0)
     157   {
     158       ERRNO("Setup: Sending init command failed.");
     159       return false;
     160   }
     161#else
     162    VERBOSE(VB_IMPORTANT, "Kernel does not support Legacy Dish Switch!");
     163#endif
     164   usleep(DISEQC_SHORT_WAIT);
     165
     166   prev_tuning.diseqc_port = tuning.diseqc_port;
     167   prev_tuning.tone = tuning.tone;
     168   prev_tuning.voltage = tuning.voltage;
     169   havetuned = true;
     170    }
     171    return true;
     172}
     173
    106174/*****************************************************************************
    107175                        Backward Compatible Methods
    108176 ****************************************************************************/