Ticket #2473: 2473-v1.patch

File 2473-v1.patch, 10.7 KB (added by danielk, 18 years ago)

Partially reviewed patch (I need someone with DiSEqC to sanity check this too).

  • libs/libmythtv/diseqc.h

     
    369369    void SetLOFSwitch(uint lof_switch)    { m_lof_switch = lof_switch; }
    370370    void SetLOFHigh(  uint lof_hi)        { m_lof_hi     = lof_hi;     }
    371371    void SetLOFLow(   uint lof_lo)        { m_lof_lo     = lof_lo;     }
     372    void SetPolarityInverted(bool inv)    { m_pol_inv    = inv;        }
    372373
    373374    // Gets
    374375    dvbdev_lnb_t GetType(void)      const { return m_type;             }
    375376    uint         GetLOFSwitch(void) const { return m_lof_switch;       }
    376377    uint         GetLOFHigh(void)   const { return m_lof_hi;           }
    377378    uint         GetLOFLow(void)    const { return m_lof_lo;           }
     379    bool         IsPolarityInverted(void) const { return m_pol_inv;    }
    378380    bool         IsHighBand(const DVBTuning&) const;
    379381    bool         IsHorizontal(const DVBTuning&) const;
    380382    uint32_t     GetIntermediateFrequency(const DiSEqCDevSettings&,
     
    393395    uint         m_lof_switch;
    394396    uint         m_lof_hi;
    395397    uint         m_lof_lo;
     398    /// If a signal is circularly polarized the polarity will flip
     399    /// on each reflection, so antenna systems with an even number
     400    /// of reflectors will need to set this value.
     401    bool         m_pol_inv;
    396402
    397403    static const TypeTable LNBTypeTable[5];
    398404};
  • libs/libmythtv/dbcheck.cpp

     
    1010#include "mythdbcon.h"
    1111
    1212/// This is the DB schema version expected by the running MythTV instance.
    13 const QString currentDatabaseVersion = "1160";
     13const QString currentDatabaseVersion = "1161";
    1414
    1515static bool UpdateDBVersionNumber(const QString &newnumber);
    1616static bool performActualUpdate(const QString updates[], QString version,
     
    25462546            return false;
    25472547    }
    25482548
     2549    if (dbver == "1160")
     2550    {
     2551        const QString updates[] = {
     2552"ALTER TABLE diseqc_tree ADD COLUMN lnb_pol_inv TINYINT NOT NULL DEFAULT '0';",
     2553""
     2554};
     2555
     2556        if (!performActualUpdate(updates, "1161", dbver))
     2557            return false;
     2558    }
     2559
    25492560//"ALTER TABLE capturecard DROP COLUMN dvb_recordts;" in 0.21
    25502561//"ALTER TABLE capturecard DROP COLUMN dvb_hw_decoder;" in 0.21
    25512562//"ALTER TABLE cardinput DROP COLUMN preference;" in 0.22
  • libs/libmythtv/diseqcsettings.cpp

     
    489489    uint                       lof_sw;
    490490    uint                       lof_lo;
    491491    uint                       lof_hi;
     492    bool                       pol_inv;
    492493};
    493494
    494495static lnb_preset lnb_presets[] =
    495496{
    496     /* description, type, LOF switch, LOF low, LOF high */
     497    /* description, type, LOF switch, LOF low, LOF high, inverted polarity */
    497498    { DeviceTree::tr("Single (Europe)"),
    498       DiSEqCDevLNB::kTypeVoltageControl,               0,  9750000,        0 },
     499      DiSEqCDevLNB::kTypeVoltageControl,
     500             0,  9750000,        0, false },
    499501    { DeviceTree::tr("Universal (Europe)"),
    500       DiSEqCDevLNB::kTypeVoltageAndToneControl, 11700000,  9750000, 10600000 },
     502      DiSEqCDevLNB::kTypeVoltageAndToneControl,
     503      11700000,  9750000, 10600000, false },
    501504    { DeviceTree::tr("Circular (N. America)"),
    502       DiSEqCDevLNB::kTypeVoltageControl,               0, 11250000,        0 },
     505      DiSEqCDevLNB::kTypeVoltageControl,
     506             0, 11250000,        0, false },
     507    { DeviceTree::tr("Circular (Inv) (N. America)"),
     508      DiSEqCDevLNB::kTypeVoltageControl,
     509             0, 11250000,        0, true  },
    503510    { DeviceTree::tr("Linear (N. America)"),
    504       DiSEqCDevLNB::kTypeVoltageControl,               0, 10750000,        0 },
     511      DiSEqCDevLNB::kTypeVoltageControl,
     512             0, 10750000,        0, false },
    505513    { DeviceTree::tr("C Band"),
    506       DiSEqCDevLNB::kTypeVoltageControl,               0,  5150000,        0 },
     514      DiSEqCDevLNB::kTypeVoltageControl,
     515             0,  5150000,        0, false },
    507516    { DeviceTree::tr("DishPro Bandstacked"),
    508       DiSEqCDevLNB::kTypeBandstacked,                  0, 11250000, 14350000 },
     517      DiSEqCDevLNB::kTypeBandstacked,
     518             0, 11250000, 14350000, false },
     519    { DeviceTree::tr("DishPro Bandstacked (Inv))"),
     520      DiSEqCDevLNB::kTypeBandstacked,
     521             0, 11250000, 14350000, true  },
    509522    { QString::null,
    510       DiSEqCDevLNB::kTypeVoltageControl,               0,        0,        0 },
     523      DiSEqCDevLNB::kTypeVoltageControl,
     524             0,        0,        0, false },
    511525};
    512526
    513527uint FindPreset(const DiSEqCDevLNB &lnb)
     
    518532        if (lnb_presets[i].type   == lnb.GetType()      &&
    519533            lnb_presets[i].lof_sw == lnb.GetLOFSwitch() &&
    520534            lnb_presets[i].lof_lo == lnb.GetLOFLow()    &&
    521             lnb_presets[i].lof_hi == lnb.GetLOFHigh())
     535            lnb_presets[i].lof_hi == lnb.GetLOFHigh()   &&
     536            lnb_presets[i].pol_inv== lnb.IsPolarityInverted())
    522537        {
    523538            break;
    524539        }
     
    677692    DiSEqCDevLNB &m_lnb;
    678693};
    679694
     695class LNBPolarityInvertedSetting : public CheckBoxSetting
     696{
     697  public:
     698    LNBPolarityInvertedSetting(DiSEqCDevLNB &lnb) : m_lnb(lnb)
     699    {
     700        setLabel(DeviceTree::tr("LNB Reversed"));
     701        QString help = DeviceTree::tr(
     702            "This defines whether the signal reaching the LNB "
     703            "is reversed from normal polarization. This happens "
     704            "to circular signals bouncing twice on a toroidal "
     705            "dish.");
     706        setHelpText(help);
     707    }
     708
     709    virtual void load(void)
     710    {
     711        setValue(m_lnb.IsPolarityInverted());
     712    }
     713
     714    virtual void save(void)
     715    {
     716        m_lnb.SetPolarityInverted(getValue());
     717    }
     718
     719  private:
     720    DiSEqCDevLNB &m_lnb;
     721};
     722
    680723//////////////////////////////////////// LNBConfig
    681724
    682725LNBConfig::LNBConfig(DiSEqCDevLNB &lnb)
     
    696739    group->addChild(m_lof_lo);
    697740    m_lof_hi = new LNBLOFHighSetting(lnb);
    698741    group->addChild(m_lof_hi);
     742    m_pol_inv = new LNBPolarityInvertedSetting(lnb);
     743    group->addChild(m_pol_inv);
    699744    connect(m_type, SIGNAL(valueChanged(const QString&)),
    700745            this,   SLOT(  UpdateType(  void)));
    701746    connect(preset, SIGNAL(valueChanged(const QString&)),
     
    722767        m_lof_switch->setValue(QString::number(preset.lof_sw / 1000));
    723768        m_lof_lo->setValue(QString::number(preset.lof_lo / 1000));
    724769        m_lof_hi->setValue(QString::number(preset.lof_hi / 1000));
     770        m_pol_inv->setValue(preset.pol_inv);
    725771        m_type->setEnabled(false);
    726772        m_lof_switch->setEnabled(false);
    727773        m_lof_hi->setEnabled(false);
    728774        m_lof_lo->setEnabled(false);
     775        m_pol_inv->setEnabled(false);
    729776    }
    730777}
    731778
     
    741788            m_lof_switch->setEnabled(false);
    742789            m_lof_hi->setEnabled(false);
    743790            m_lof_lo->setEnabled(true);
     791            m_pol_inv->setEnabled(true);
    744792            break;
    745793        case DiSEqCDevLNB::kTypeVoltageAndToneControl:
    746794            m_lof_switch->setEnabled(true);
    747795            m_lof_hi->setEnabled(true);
    748796            m_lof_lo->setEnabled(true);
     797            m_pol_inv->setEnabled(true);
    749798            break;
    750799        case DiSEqCDevLNB::kTypeBandstacked:
    751800            m_lof_switch->setEnabled(false);
    752801            m_lof_hi->setEnabled(true);
    753802            m_lof_lo->setEnabled(true);
     803            m_pol_inv->setEnabled(true);
    754804            break;
    755805    }
    756806}
  • libs/libmythtv/diseqcsettings.h

     
    7575class LNBLOFSwitchSetting;
    7676class LNBLOFLowSetting;
    7777class LNBLOFHighSetting;
     78class LNBPolarityInvertedSetting;
    7879
    7980class LNBConfig : public ConfigurationWizard
    8081{
     
    9293    LNBLOFSwitchSetting *m_lof_switch;
    9394    LNBLOFLowSetting    *m_lof_lo;
    9495    LNBLOFHighSetting   *m_lof_hi;
     96    LNBPolarityInvertedSetting *m_pol_inv;
    9597};
    9698
    9799class DeviceTree : public ListBoxSetting
  • libs/libmythtv/diseqc.cpp

     
    19071907DiSEqCDevLNB::DiSEqCDevLNB(DiSEqCDevTree &tree, uint devid)
    19081908    : DiSEqCDevDevice(tree, devid),
    19091909      m_type(kTypeVoltageAndToneControl), m_lof_switch(11700000),
    1910       m_lof_hi(10600000),       m_lof_lo(9750000)
     1910      m_lof_hi(10600000),       m_lof_lo(9750000),
     1911      m_pol_inv(false)
    19111912{
    19121913    Reset();
    19131914}
     
    19421943    query.prepare(
    19431944        "SELECT subtype,         lnb_lof_switch, "
    19441945        "       lnb_lof_hi,      lnb_lof_lo, "
    1945         "       cmd_repeat "
     1946        "       lnb_pol_inv,     cmd_repeat "
    19461947        "FROM diseqc_tree "
    19471948        "WHERE diseqcid = :DEVID");
    19481949    query.bindValue(":DEVID", GetDeviceID());
     
    19591960        m_lof_hi     = query.value(2).toInt();
    19601961        m_lof_lo     = query.value(3).toInt();
    19611962        m_repeat     = query.value(4).toUInt();
     1963        m_pol_inv    = query.value(5).toUInt();
    19621964    }
    19631965
    19641966    return true;
     
    19821984            "    lnb_lof_switch  = :LOFSW,   "
    19831985            "    lnb_lof_lo      = :LOFLO,   "
    19841986            "    lnb_lof_hi      = :LOFHI,   "
     1987            "    lnb_pol_inv     = :POLINV "
    19851988            "    cmd_repeat      = :REPEAT   "
    19861989            "WHERE diseqcid = :DEVID");
    19871990    }
     
    19911994            "INSERT INTO diseqc_tree"
    19921995            " ( parentid,      ordinal,         type, "
    19931996            "   description,   subtype,         lnb_lof_switch, "
    1994             "   lnb_lof_lo,    lnb_lof_hi,      cmd_repeat ) "
     1997            "   lnb_lof_lo,    lnb_lof_hi,      lnb_pol_inv, "
     1998            "   cmd_repeat ) "
    19951999            "VALUES "
    19962000            " (:PARENT,       :ORDINAL,         'lnb', "
    19972001            "  :DESC,         :TYPE,            :LOFSW, "
    1998             "  :LOFLO,        :LOFHI,           :REPEAT ) ");
     2002            "  :LOFLO,        :LOFHI,           :POLINV, "
     2003            "  :REPEAT ) ");
    19992004    }
    20002005
    20012006    if (m_parent)
     
    20072012    query.bindValue(":LOFSW",   m_lof_switch);
    20082013    query.bindValue(":LOFLO",   m_lof_lo);
    20092014    query.bindValue(":LOFHI",   m_lof_hi);
     2015    query.bindValue(":POLINV",  m_pol_inv);
    20102016    query.bindValue(":REPEAT",  m_repeat);
    20112017    query.bindValue(":DEVID",   GetDeviceID());
    20122018
     
    20582064    (void) tuning;
    20592065#ifdef USING_DVB
    20602066    char pol = tuning.PolarityChar();
    2061     return (pol == 'h' || pol == 'l');
     2067    return (pol == 'h' || pol == 'l') ^ IsPolarityInverted();
    20622068#else
    20632069    return false;
    20642070#endif // !USING_DVB