Ticket #5403: mythtv_multiproto.5.patch

File mythtv_multiproto.5.patch, 26.0 KB (added by wagabunda, 16 years ago)

corrected "Failed to get frontend parameters for DVB-S/S2 frontend" error, when adapter delivery is never set (after reboot)

  • libs/libmythtv/dtvconfparserhelpers.h

     
    3333#define _DTVCONFPARSERHELPERS_H_
    3434
    3535#include <qstring.h>
     36#include "dvbtypes.h"
    3637
    3738// The following are a set of helper classes to allow easy translation
    3839// between the different string representations of various tuning params.
     
    191192    static const DTVParamHelperStruct confTable[];
    192193    static const DTVParamHelperStruct vdrTable[];
    193194    static const DTVParamHelperStruct parseTable[];
     195#ifdef DVB_API_MULTIPROTO
     196    static const uint kDBStrCnt = 15;
     197#else
    194198    static const uint kDBStrCnt = 10;
     199#endif
    195200    static const char *dbStr[kDBStrCnt];
    196201
    197202  public:
    198203    enum
    199204    {
     205#ifdef DVB_API_MULTIPROTO
    200206        kFECNone,
     207        kFEC_1_4,
     208        kFEC_1_3,
     209        kFEC_2_5,
    201210        kFEC_1_2,
     211        kFEC_3_5,
    202212        kFEC_2_3,
    203213        kFEC_3_4,
    204214        kFEC_4_5,
     
    206216        kFEC_6_7,
    207217        kFEC_7_8,
    208218        kFEC_8_9,
     219        kFEC_9_10,
    209220        kFECAuto,
     221#else
     222        kFECNone,
     223        kFEC_1_2,
     224        kFEC_2_3,
     225        kFEC_3_4,
     226        kFEC_4_5,
     227        kFEC_5_6,
     228        kFEC_6_7,
     229        kFEC_7_8,
     230        kFEC_8_9,
     231        kFECAuto,
     232#endif
    210233    };
    211234
    212235    DTVCodeRate(int _default = kFECAuto) : DTVParamHelper(_default) { }
  • libs/libmythtv/dtvconfparserhelpers.cpp

     
    145145
    146146const DTVParamHelperStruct DTVCodeRate::confTable[] =
    147147{
     148#ifdef DVB_API_MULTIPROTO
     149    { "DVBFE_FEC_AUTO", kFECAuto  },
     150    { "DVBFE_FEC_1_4",  kFEC_1_4  },
     151    { "DVBFE_FEC_1_3",  kFEC_1_3  },
     152    { "DVBFE_FEC_2_5",  kFEC_2_5  },
     153    { "DVBFE_FEC_1_2",  kFEC_1_2  },
     154    { "DVBFE_FEC_3_5",  kFEC_3_5  },
     155    { "DVBFE_FEC_2_3",  kFEC_2_3  },
     156    { "DVBFE_FEC_3_4",  kFEC_3_4  },
     157    { "DVBFE_FEC_4_5",  kFEC_4_5  },   
     158    { "DVBFE_FEC_5_6",  kFEC_5_6  },
     159    { "DVBFE_FEC_6_7",  kFEC_6_7  },
     160    { "DVBFE_FEC_7_8",  kFEC_7_8  },
     161    { "DVBFE_FEC_8_9",  kFEC_8_9  },
     162    { "DVBFE_FEC_9_10", kFEC_9_10 },
     163    { "DVBFE_FEC_NONE", kFECNone  },
     164    { NULL,             kFECAuto  },
     165#else
    148166    { "FEC_AUTO", kFECAuto },
    149167    { "FEC_1_2",  kFEC_1_2  },
    150168    { "FEC_2_3",  kFEC_2_3  },
     
    156174    { "FEC_8_9",  kFEC_8_9  },
    157175    { "FEC_NONE", kFECNone },
    158176    { NULL,       kFECAuto },
     177#endif
    159178};
    160179
    161180const DTVParamHelperStruct DTVCodeRate::vdrTable[] =
    162181{
    163182    { "999", kFECAuto },
     183    { "14",  kFEC_1_4 },
     184    { "13",  kFEC_1_3 },
     185    { "25",  kFEC_2_5 },
    164186    { "12",  kFEC_1_2 },
     187    { "35",  kFEC_3_5 },
    165188    { "23",  kFEC_2_3 },
    166189    { "34",  kFEC_3_4 },
    167190    { "45",  kFEC_4_5 },
     
    169192    { "67",  kFEC_6_7 },
    170193    { "78",  kFEC_7_8 },
    171194    { "89",  kFEC_8_9 },
     195    { "910", kFEC_9_10 },
    172196    { "0",   kFECNone },
    173197    { NULL,  kFECAuto }
    174198};
     
    176200const DTVParamHelperStruct DTVCodeRate::parseTable[] =
    177201{
    178202    { "auto", kFECAuto },
     203    { "1/4",  kFEC_1_4 },
     204    { "1/3",  kFEC_1_3 },
     205    { "2/5",  kFEC_2_5 },
    179206    { "1/2",  kFEC_1_2 },
     207    { "3/5",  kFEC_3_5 },
    180208    { "2/3",  kFEC_2_3 },
    181209    { "3/4",  kFEC_3_4 },
    182210    { "4/5",  kFEC_4_5 },
     
    184212    { "6/7",  kFEC_6_7 },
    185213    { "7/8",  kFEC_7_8 },
    186214    { "8/9",  kFEC_8_9 },
     215    { "9/10", kFEC_9_10},
    187216    { "none", kFECNone },
    188217    { NULL,   kFECAuto }
    189218};
     
    191220const char *DTVCodeRate::dbStr[DTVCodeRate::kDBStrCnt] =
    192221{
    193222     "none", ///< kFECNone
     223         "1/4",  ///< kFEC_1_4
     224         "1/3",  ///< kFEC_1_3
     225         "2/5",  ///< kFEC_2_5
    194226     "1/2",  ///< kFEC_1_2
     227         "3/5",  ///< kFEC_3_5
    195228     "2/3",  ///< kFEC_2_3
    196229     "3/4",  ///< kFEC_3_4
    197230     "4/5",  ///< kFEC_4_5
     
    199232     "6/7",  ///< kFEC_6_7
    200233     "7/8",  ///< kFEC_7_8
    201234     "8/9",  ///< kFEC_8_9
    202      "auto"  ///< kFECAuto
     235         "9/10",  ///< kFEC_9_10
     236     "auto",  ///< kFECAuto
    203237};
    204238
    205239const DTVParamHelperStruct DTVModulation::confTable[] =
  • libs/libmythtv/dtvmultiplex.h

     
    1515
    1616// MythTV headers
    1717#include "dtvconfparserhelpers.h"
     18#include "dvbtypes.h"
    1819
    1920class DTVMultiplex
    2021{
  • libs/libmythtv/scanwizardhelpers.h

     
    536536        addSelection("6/7");
    537537        addSelection("7/8");
    538538        addSelection("8/9");
     539#ifdef DVB_API_MULTIPROTO
     540        addSelection("1/4");
     541        addSelection("1/3");
     542        addSelection("2/5");
     543        addSelection("3/5");
     544        addSelection("9/10");
     545#endif
    539546    }
    540547};
    541548
  • libs/libmythtv/dvbchannel.h

     
    100100    int  GetChanID(void) const;
    101101
    102102    void CheckOptions(DTVMultiplex &t) const;
     103#ifdef DVB_API_MULTIPROTO
     104    bool ReadTunerCapabilities(const DTVMultiplex &t);
     105#endif
    103106    bool CheckModulation(DTVModulation modulation) const;
    104107    bool CheckCodeRate(DTVCodeRate rate) const;
    105108
     
    117120    QString           frontend_name;
    118121    DTVTunerType      card_type;
    119122    uint64_t          capabilities;
    120     uint64_t          ext_modulations;
     123        uint64_t          delivery;
    121124    uint64_t          frequency_minimum;
    122125    uint64_t          frequency_maximum;
    123126    uint              symbol_rate_minimum;
  • libs/libmythtv/dvbtypes.h

     
    3939#    define VSB_16        (fe_modulation)(QAM_AUTO+2)
    4040#endif
    4141
    42 #ifdef FE_GET_EXTENDED_INFO
    43   #define dvb_fe_params dvb_frontend_parameters_new
    44 #else
    45   #define dvb_fe_params dvb_frontend_parameters
     42#if (DVB_API_VERSION >= 3 && DVB_API_VERSION_MINOR >= 3)
     43#    define DVB_API_MULTIPROTO
    4644#endif
    4745
    4846class QString;
  • libs/libmythtv/dvbchannel.cpp

     
    1 /*
     1/*   
    22 *  Class DVBChannel
    33 *
    44 * Copyright (C) Kenneth Aafloy 2003
     
    5050
    5151static void drain_dvb_events(int fd);
    5252static bool wait_for_backend(int fd, int timeout_ms);
    53 static struct dvb_fe_params dtvmultiplex_to_dvbparams(
     53static struct dvb_frontend_parameters dtvmultiplex_to_dvbparams(
    5454    DTVTunerType, const DTVMultiplex&);
    5555static DTVMultiplex dvbparams_to_dtvmultiplex(
    56     DTVTunerType, const dvb_fe_params&);
    57 
     56    DTVTunerType, const dvb_frontend_parameters&);
     57#ifdef DVB_API_MULTIPROTO
     58static DTVMultiplex dvbparams_to_dtvmultiplex(const dvbfe_params&);
     59#endif
    5860#define LOC QString("DVBChan(%1:%2): ").arg(GetCardID()).arg(cardnum)
    5961#define LOC_WARN QString("DVBChan(%1:%2) Warning: ") \
    6062                 .arg(GetCardID()).arg(cardnum)
    6163#define LOC_ERR QString("DVBChan(%1:%2) Error: ").arg(GetCardID()).arg(cardnum)
    6264
    6365/** \class DVBChannel
    64  *  \brief Provides interface to the tuning hardware when using DVB drivers
     66 *  \brief Provides interface to the tuning hardware when drivers
    6567 *
    6668 *  \bug Only supports single input cards.
    6769 */
     
    168170        frontend_name       = master->frontend_name;
    169171        card_type           = master->card_type;
    170172        capabilities        = master->capabilities;
    171         ext_modulations     = master->ext_modulations;
     173        delivery            = master->delivery;
    172174        frequency_minimum   = master->frequency_minimum;
    173175        frequency_maximum   = master->frequency_maximum;
    174176        symbol_rate_minimum = master->symbol_rate_minimum;
     
    198200        return false;
    199201    }
    200202
     203    VERBOSE(VB_RECORD, LOC + QString("Using DVB card %1, with frontend '%2'.")
     204            .arg(cardnum).arg(frontend_name));
     205           
     206#ifdef DVB_API_MULTIPROTO
     207    if (ioctl(fd_frontend, DVBFE_GET_DELSYS, &delivery) < 0)
     208    {
     209        VERBOSE(VB_IMPORTANT, LOC_ERR +
     210                "Failed to get frontend delivery." + ENO);
     211
     212        close(fd_frontend);
     213        fd_frontend = -1;
     214        return false;
     215    }
     216    if (DVBFE_DELSYS_DVBS2 == (delivery & DVBFE_DELSYS_DVBS2)){
     217        card_type = DTVTunerType::kTunerTypeDVB_S2;
     218    } else if (DVBFE_DELSYS_DVBS == (delivery & DVBFE_DELSYS_DVBS)){
     219        card_type = DTVTunerType::kTunerTypeQPSK;
     220    } else {
     221        VERBOSE(VB_IMPORTANT, LOC_ERR +
     222                "Tuner does not support DVB-S/DVB-S2." + ENO);
     223        close(fd_frontend);
     224        fd_frontend = -1;
     225        return false;
     226    }
     227#else
    201228    dvb_frontend_info info;
    202229    bzero(&info, sizeof(info));
    203230    if (ioctl(fd_frontend, FE_GET_INFO, &info) < 0)
     
    209236        fd_frontend = -1;
    210237        return false;
    211238    }
    212 
    213 #ifdef FE_GET_EXTENDED_INFO
    214     if (info.caps & FE_HAS_EXTENDED_INFO)
    215     {
    216         bool ok = true;
    217         dvb_fe_caps_extended extinfo;
    218         bzero(&extinfo, sizeof(extinfo));
    219         if (ioctl(fd_frontend, FE_GET_EXTENDED_INFO, &extinfo) < 0)
    220         {
    221             VERBOSE(VB_IMPORTANT, LOC_ERR +
    222                     "Failed to get frontend extended information." + ENO);
    223 
    224             ok = false;
    225         }
    226 
    227         if (ok && (extinfo.modulations & MOD_8PSK))
    228         {
    229             if (ioctl(fd_frontend, FE_SET_STANDARD, FE_DVB_S2) < 0)
    230             {
    231                 VERBOSE(VB_IMPORTANT, LOC_ERR +
    232                         "Failed to set frontend standard to DVB-S2." + ENO);
    233 
    234                 ok = false;
    235             }
    236             else if (ioctl(fd_frontend, FE_GET_INFO, &info) < 0)
    237             {
    238                 VERBOSE(VB_IMPORTANT, LOC_ERR +
    239                         "Failed to get frontend information." + ENO);
    240 
    241                 ok = false;
    242             }
    243         }
    244 
    245         if (!ok)
    246         {
    247             close(fd_frontend);
    248             fd_frontend = -1;
    249             return false;
    250         }
    251 
    252         ext_modulations   = extinfo.modulations;
    253     }
    254 #endif
    255 
     239    card_type           = info.type;
     240    capabilities        = info.caps;   
    256241    frontend_name       = info.name;
    257     card_type           = info.type;
    258     capabilities        = info.caps;
    259242    frequency_minimum   = info.frequency_min;
    260243    frequency_maximum   = info.frequency_max;
    261244    symbol_rate_minimum = info.symbol_rate_min;
    262245    symbol_rate_maximum = info.symbol_rate_max;
     246#endif
    263247
    264     VERBOSE(VB_RECORD, LOC + QString("Using DVB card %1, with frontend '%2'.")
    265             .arg(cardnum).arg(frontend_name));
    266 
    267248    // Turn on the power to the LNB
    268249    if (card_type == DTVTunerType::kTunerTypeQPSK ||
    269250        card_type == DTVTunerType::kTunerTypeDVB_S2)
     
    312293    if (!tuning.FillFromDB(card_type, mplexid))
    313294        return false;
    314295
     296#ifdef DVB_API_MULTIPROTO
     297    if (!ReadTunerCapabilities(tuning)){
     298      VERBOSE(VB_GENERAL, LOC_WARN +
     299                "Unable to read tuner capabilities.");
     300    }
     301#endif
    315302    CheckOptions(tuning);
    316303
    317304    return Tune(tuning, inputname);
     
    402389    SetDTVInfo(atsc_major, atsc_minor, netid, tsid, mpeg_prog_num);
    403390
    404391    // Try to fix any problems with the multiplex
     392#ifdef DVB_API_MULTIPROTO
     393    if (!ReadTunerCapabilities(tuning)){
     394      VERBOSE(VB_GENERAL, LOC_WARN +
     395                "Unable to read tuner capabilities.");
     396    }
     397#endif
    405398    CheckOptions(tuning);
    406399
    407400    if (!Tune(tuning, inputid))
     
    463456 */
    464457void DVBChannel::CheckOptions(DTVMultiplex &tuning) const
    465458{
     459
    466460    if ((tuning.inversion == DTVInversion::kInversionAuto) &&
    467461        !(capabilities & FE_CAN_INVERSION_AUTO))
    468462    {
     
    593587{
    594588    const DTVModulation m = modulation;
    595589    const uint64_t      c = capabilities;
    596 
    597 #ifdef FE_GET_EXTENDED_INFO
    598     if ((c & FE_HAS_EXTENDED_INFO)            &&
    599         (DTVModulation::kModulation8PSK == m) &&
    600         (ext_modulations & DTVModulation::kModulation8PSK))
    601     {
    602         return true;
    603     }
    604 #endif // FE_GET_EXTENDED_INFO
    605 
     590   
    606591    return
    607592        ((DTVModulation::kModulationQPSK    == m) && (c & FE_CAN_QPSK))     ||
    608593        ((DTVModulation::kModulationQAM16   == m) && (c & FE_CAN_QAM_16))   ||
     
    669654                      bool same_input)
    670655{
    671656    QMutexLocker lock(&tune_lock);
    672 
    673657    if (master)
    674658    {
    675659        VERBOSE(VB_CHANNEL, LOC + "tuning on slave channel");
     
    678662    }
    679663
    680664    bool reset = (force_reset || first_tune);
    681     struct dvb_fe_params params = dtvmultiplex_to_dvbparams(card_type, tuning);
     665    struct dvb_frontend_parameters params = dtvmultiplex_to_dvbparams(card_type, tuning);
    682666
    683     bool is_dvbs = (DTVTunerType::kTunerTypeQPSK   == card_type ||
    684                     DTVTunerType::kTunerTypeDVB_S2 == card_type);
    685 
     667    bool is_dvbs = (DTVTunerType::kTunerTypeQPSK == card_type || DTVTunerType::kTunerTypeDVB_S2 == card_type);
     668   
    686669    bool has_diseqc = (diseqc_tree != NULL);
    687670    if (is_dvbs && !has_diseqc)
    688671    {
     
    701684
    702685        return false;
    703686    }
    704 
    705687    // Remove any events in queue before tuning.
    706688    drain_dvb_events(fd_frontend);
    707689
     
    711693        // configure for new input
    712694        if (!same_input)
    713695            diseqc_settings.Load(inputid);
    714 
    715696        // execute diseqc commands
    716697        if (!diseqc_tree->Execute(diseqc_settings, tuning))
    717698        {
     
    719700                    "Failed to setup DiSEqC devices");
    720701            return false;
    721702        }
    722 
    723703        // retrieve actual intermediate frequency
    724704        DiSEqCDevLNB *lnb = diseqc_tree->FindLNB(diseqc_settings);
    725705        if (!lnb)
     
    752732    // DVB-S is in kHz, other DVB is in Hz
    753733    int     freq_mult = (is_dvbs) ? 1 : 1000;
    754734    QString suffix    = (is_dvbs) ? "kHz" : "Hz";
    755 
     735       
    756736    if (reset || !prev_tuning.IsEqual(card_type, tuning, 500 * freq_mult))
    757737    {
    758738        VERBOSE(VB_CHANNEL, LOC + QString("Tune(): Tuning to %1%2")
    759739                .arg(params.frequency).arg(suffix));
    760740
    761 #ifdef FE_GET_EXTENDED_INFO
    762         if (card_type == DTVTunerType::kTunerTypeDVB_S2)
    763         {
    764             if (ioctl(fd_frontend, FE_SET_FRONTEND2, &params) < 0)
    765             {
    766                 VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
    767                         "Setting Frontend(2) tuning parameters failed." + ENO);
    768                 return false;
    769             }
     741#ifdef DVB_API_MULTIPROTO
     742    if (card_type == DTVTunerType::kTunerTypeQPSK || card_type == DTVTunerType::kTunerTypeDVB_S2){
     743      struct dvbfe_params fe_params;
     744      struct dvbfe_params fe_cur_params;
     745   
     746      if (ioctl(fd_frontend, DVBFE_GET_PARAMS, &fe_cur_params) < 0)
     747      {
     748        VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
     749        "Getting frontend tuning parameters failed." + ENO);
     750        return false;
     751      }
     752     
     753      fe_params.frequency               = params.frequency;
     754      fe_params.inversion               = INVERSION_AUTO;
     755      if (tuning.modulation == DTVModulation::kModulation8PSK){
     756        fe_params.delsys.dvbs2.symbol_rate = tuning.symbolrate;
     757        fe_params.delsys.dvbs2.fec         = DVBFE_FEC_AUTO;
     758        fe_params.delsys.dvbs2.modulation  = DVBFE_MOD_8PSK;
     759        fe_params.delivery                 = DVBFE_DELSYS_DVBS2;
     760      } else{
     761        fe_params.delsys.dvbs.symbol_rate  = tuning.symbolrate;
     762        fe_params.delsys.dvbs.fec          = DVBFE_FEC_AUTO;
     763        fe_params.delsys.dvbs.modulation  = DVBFE_MOD_QPSK;
     764        fe_params.delivery                 = DVBFE_DELSYS_DVBS;
     765      }
     766     
     767      if (fe_cur_params.delivery != fe_params.delivery){
     768        if (ioctl(fd_frontend, DVBFE_SET_DELSYS, &fe_params.delivery) < 0){
     769            VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
     770              "Setting Frontend delivery failed." + ENO);
     771            return false;
    770772        }
    771         else
    772 #endif // FE_GET_EXTENDED_INFO
    773         {
     773      }
     774     
     775      if (ioctl(fd_frontend, DVBFE_SET_PARAMS, &fe_params) < 0){
     776        VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
     777              "Setting Frontend tuning parameters failed." + ENO);
     778        return false;
     779      }
     780     
     781    }
     782    else
     783#endif
    774784            if (ioctl(fd_frontend, FE_SET_FRONTEND, &params) < 0)
    775785            {
    776786                VERBOSE(VB_IMPORTANT, LOC_ERR + "Tune(): " +
    777787                        "Setting Frontend tuning parameters failed." + ENO);
    778788                return false;
    779789            }
    780         }
    781 
    782790        // Extra delay to add for broken DVB drivers
    783791        if (tuning_delay)
    784792            usleep(tuning_delay * 1000);
     
    831839        return false;
    832840    }
    833841
    834     dvb_fe_params params;
     842    dvb_frontend_parameters params;
    835843    return ioctl(fd_frontend, FE_GET_FRONTEND, &params) >= 0;
    836844}
    837845
     
    845853bool DVBChannel::ProbeTuningParams(DTVMultiplex &tuning) const
    846854{
    847855    QMutexLocker locker(&hw_lock);
     856    uint    mplex;
     857    QString sistandard;
    848858
    849859    if (fd_frontend < 0)
    850860    {
     
    864874        return false;
    865875    }
    866876
    867     dvb_fe_params params;
    868     if (ioctl(fd_frontend, FE_GET_FRONTEND, &params) < 0)
     877#ifdef DVB_API_MULTIPROTO
     878    if (card_type == DTVTunerType::kTunerTypeQPSK || card_type == DTVTunerType::kTunerTypeDVB_S2){
     879      struct dvbfe_params params;
     880      if (ioctl(fd_frontend, DVBFE_GET_PARAMS, &params) < 0){
     881        VERBOSE(VB_IMPORTANT, LOC_ERR +
     882                "Getting Frontend (multiproto) tuning parameters failed." + ENO);
     883
     884        return false;
     885      }
     886      mplex      = tuning.mplex;
     887      sistandard = QDeepCopy<QString>(tuning.sistandard);
     888      tuning     = dvbparams_to_dtvmultiplex(params);
     889    } 
     890    else
     891#endif
    869892    {
     893      struct dvb_frontend_parameters params;
     894      if (ioctl(fd_frontend, FE_GET_FRONTEND, &params) < 0){
    870895        VERBOSE(VB_IMPORTANT, LOC_ERR +
    871896                "Getting Frontend tuning parameters failed." + ENO);
    872897
    873898        return false;
     899      }
     900      mplex      = tuning.mplex;
     901      sistandard = QDeepCopy<QString>(tuning.sistandard);
     902      tuning     = dvbparams_to_dtvmultiplex(card_type, params);
    874903    }
    875 
    876     uint    mplex      = tuning.mplex;
    877     QString sistandard = QDeepCopy<QString>(tuning.sistandard);
    878 
    879     tuning = dvbparams_to_dtvmultiplex(card_type, params);
    880 
    881904    tuning.mplex       = mplex;
    882905    tuning.sistandard  = sistandard;
    883906
     
    10691092    if (ioctl(fd, FE_READ_STATUS, &status) < 0)
    10701093    {
    10711094        VERBOSE(VB_IMPORTANT, QString("dvbchannel.cpp:wait_for_backend: "
    1072                                       "Failed to get status, error: %1")
     1095                                      "Failed to , error: %1")
    10731096                .arg(strerror(errno)));
    10741097        return false;
    10751098    }
     
    10791102    return true;
    10801103}
    10811104
    1082 static struct dvb_fe_params dtvmultiplex_to_dvbparams(
     1105static struct dvb_frontend_parameters dtvmultiplex_to_dvbparams(
    10831106    DTVTunerType tuner_type, const DTVMultiplex &tuning)
    10841107{
    1085     dvb_fe_params params;
     1108    dvb_frontend_parameters params;
    10861109    bzero(&params, sizeof(params));
    10871110
    10881111    params.frequency = tuning.frequency;
    10891112    params.inversion = (fe_spectral_inversion_t) (int) tuning.inversion;
    10901113
    1091     if (DTVTunerType::kTunerTypeQPSK == tuner_type)
     1114    if (DTVTunerType::kTunerTypeQPSK == tuner_type || tuner_type == DTVTunerType::kTunerTypeDVB_S2)
    10921115    {
    10931116        params.u.qpsk.symbol_rate = tuning.symbolrate;
    10941117        params.u.qpsk.fec_inner   = (fe_code_rate_t) (int) tuning.fec;
    10951118    }
    10961119
    1097     if (DTVTunerType::kTunerTypeDVB_S2 == tuner_type)
    1098     {
    1099 #ifdef FE_GET_EXTENDED_INFO
    1100         params.u.qpsk2.symbol_rate = tuning.symbolrate;
    1101         params.u.qpsk2.fec_inner   = (fe_code_rate_t) (int) tuning.fec;
    1102         params.u.qpsk2.modulation  = (fe_modulation_t) (int) tuning.modulation;
    1103 #else // if !FE_GET_EXTENDED_INFO
    1104         VERBOSE(VB_IMPORTANT, "DVBChan Error, MythTV was compiled without "
    1105                 "DVB-S2 headers being present so DVB-S2 tuning will fail.");
    1106 #endif // !FE_GET_EXTENDED_INFO
    1107     }
    1108 
    11091120    if (DTVTunerType::kTunerTypeQAM  == tuner_type)
    11101121    {
    11111122        params.u.qam.symbol_rate  = tuning.symbolrate;
     
    11431154}
    11441155
    11451156static DTVMultiplex dvbparams_to_dtvmultiplex(
    1146     DTVTunerType tuner_type, const dvb_fe_params &params)
     1157    DTVTunerType tuner_type, const dvb_frontend_parameters &params)
    11471158{
    11481159    DTVMultiplex tuning;
    11491160
    11501161    tuning.frequency = params.frequency;
    11511162    tuning.inversion = params.inversion;
    11521163
    1153     if ((DTVTunerType::kTunerTypeQPSK   == tuner_type) ||
    1154         (DTVTunerType::kTunerTypeDVB_S2 == tuner_type))
     1164    if (DTVTunerType::kTunerTypeQPSK   == tuner_type)
    11551165    {
    11561166        tuning.symbolrate     = params.u.qpsk.symbol_rate;
    11571167        tuning.fec            = params.u.qpsk.fec_inner;
     
    11841194
    11851195    return tuning;
    11861196}
     1197
     1198#ifdef DVB_API_MULTIPROTO
     1199
     1200static DTVMultiplex dvbparams_to_dtvmultiplex(const dvbfe_params &params){
     1201   
     1202    DTVMultiplex tuning;
     1203
     1204    tuning.frequency = params.frequency;
     1205    tuning.inversion = params.inversion;
     1206   
     1207    switch(params.delivery){
     1208      case DVBFE_DELSYS_DVBS:
     1209      {
     1210        tuning.symbolrate     = params.delsys.dvbs.symbol_rate;
     1211        tuning.fec            = params.delsys.dvbs.fec;
     1212      } 
     1213        break;
     1214      case DVBFE_DELSYS_DVBS2:
     1215      {
     1216        tuning.symbolrate     = params.delsys.dvbs2.symbol_rate;
     1217        tuning.fec            = params.delsys.dvbs2.fec;
     1218      }
     1219        break; 
     1220    }
     1221    return tuning;
     1222}
     1223
     1224bool DVBChannel::ReadTunerCapabilities(const DTVMultiplex &tuning){
     1225
     1226    enum dvbfe_delsys d;
     1227    switch(tuning.modulation){
     1228      case DTVModulation::kModulation8PSK:
     1229        d = DVBFE_DELSYS_DVBS2;
     1230        break;
     1231      case DTVModulation::kModulationQPSK:
     1232        d = DVBFE_DELSYS_DVBS;
     1233        break;
     1234      default:
     1235        VERBOSE(VB_IMPORTANT, LOC_ERR +
     1236          "Failed to determine frontend delivery.");
     1237        return false;
     1238        break;
     1239    }
     1240   
     1241    struct dvbfe_params params;
     1242    if (ioctl(fd_frontend, DVBFE_GET_PARAMS, &params) < 0) {
     1243      if (ioctl(fd_frontend, DVBFE_SET_DELSYS, &d) < 0){
     1244          VERBOSE(VB_IMPORTANT, LOC_ERR +
     1245        "Failed to set frontend delivery." + ENO);
     1246        return false;
     1247      }
     1248      if (ioctl(fd_frontend, DVBFE_GET_PARAMS, &params) < 0) {
     1249          VERBOSE(VB_IMPORTANT, LOC_ERR +
     1250                QString("Failed to get frontend parameters for DVB-S/S2 frontend (%1)  .").arg(fd_frontend) + ENO);
     1251        return false;
     1252      }
     1253    }
     1254    if (params.delivery != d){
     1255      if (ioctl(fd_frontend, DVBFE_SET_DELSYS, &d) < 0){
     1256        VERBOSE(VB_IMPORTANT, LOC_ERR +
     1257                "Failed to set frontend delivery." + ENO);
     1258        return false;
     1259      }
     1260    }
     1261
     1262    struct dvbfe_info info;
     1263    if (ioctl(fd_frontend, DVBFE_GET_INFO, &info) < 0){
     1264        VERBOSE(VB_IMPORTANT, LOC_ERR +
     1265                "Failed to get frontend information for DVB-S frontend." + ENO);
     1266      return false;
     1267    }
     1268   
     1269    capabilities        = FEC_NONE;
     1270   
     1271    dvbfe_modulation m;
     1272    m = info.delsys.dvbs.modulation;
     1273    if (m & DVBFE_MOD_QPSK)    { capabilities |= FE_CAN_QPSK; }
     1274    if (m & DVBFE_MOD_QAM16)   { capabilities |= FE_CAN_QAM_16; }
     1275    if (m & DVBFE_MOD_QAM32)   { capabilities |= FE_CAN_QAM_32; }
     1276    if (m & DVBFE_MOD_QAM64)   { capabilities |= FE_CAN_QAM_64; }
     1277    if (m & DVBFE_MOD_QAM128)  { capabilities |= FE_CAN_QAM_128; }
     1278    if (m & DVBFE_MOD_QAM256)  { capabilities |= FE_CAN_QAM_256; }
     1279    if (m & DVBFE_MOD_QAMAUTO) { capabilities |= FE_CAN_QAM_AUTO; }
     1280   
     1281    dvbfe_fec f;
     1282    f = info.delsys.dvbs.fec;
     1283    if (f & DVBFE_FEC_1_2)  { capabilities |= FE_CAN_FEC_1_2; }
     1284    if (f & DVBFE_FEC_2_3)  { capabilities |= FE_CAN_FEC_2_3; }
     1285    if (f & DVBFE_FEC_3_4)  { capabilities |= FE_CAN_FEC_3_4; }
     1286    if (f & DVBFE_FEC_4_5)  { capabilities |= FE_CAN_FEC_4_5; }
     1287    if (f & DVBFE_FEC_5_6)  { capabilities |= FE_CAN_FEC_5_6; }
     1288    if (f & DVBFE_FEC_6_7)  { capabilities |= FE_CAN_FEC_6_7; }
     1289    if (f & DVBFE_FEC_7_8)  { capabilities |= FE_CAN_FEC_7_8; }
     1290    if (f & DVBFE_FEC_8_9)  { capabilities |= FE_CAN_FEC_8_9; }
     1291    if (f & DVBFE_FEC_AUTO) { capabilities |= FE_CAN_FEC_AUTO;}
     1292   
     1293    fe_spectral_inversion_t i;
     1294    i = info.inversion;
     1295    if ((i & INVERSION_AUTO) || i == 0) { capabilities |= FE_CAN_INVERSION_AUTO; }
     1296   
     1297    frontend_name       = info.name;
     1298    frequency_minimum   = info.frequency_min;
     1299    frequency_maximum   = info.frequency_max;
     1300    symbol_rate_minimum = info.symbol_rate_min;
     1301    symbol_rate_maximum = info.symbol_rate_max;
     1302   
     1303    return true;
     1304}
     1305#endif
  • libs/libmythtv/transporteditor.cpp

     
    3838#include "cardutil.h"
    3939#include "mythcontext.h"
    4040#include "mythdbcon.h"
     41#include "dvbtypes.h"
    4142
    4243#define LOC QString("DTVMux: ")
    4344#define LOC_ERR QString("DTVMux, Error: ")
     
    505506    if (CardUtil::QPSK == nType)
    506507    {
    507508        // no modulation options
    508         setVisible(false);
     509        //setVisible(false);
     510                addSelection("QPSK",   "qpsk");
     511                addSelection("8PSK",   "8psk");
    509512    }
    510513    else if ((CardUtil::QAM == nType) || (CardUtil::OFDM == nType))
    511514    {
     
    582585        addSelection("6/7");
    583586        addSelection("7/8");
    584587        addSelection("8/9");
     588#ifdef DVB_API_MULTIPROTO
     589        addSelection("1/4");
     590        addSelection("1/3");
     591        addSelection("2/5");
     592        addSelection("3/5");
     593        addSelection("9/10");
     594#endif
    585595    };
    586596};
    587597
     
    710720        left->addChild(new DTVStandard(id, true, false));
    711721        left->addChild(new Frequency(id, true));
    712722        left->addChild(new DVBSymbolRate(id));
     723                left->addChild(new Modulation(id, nType));
    713724
    714725        right = new VerticalConfigurationGroup(false, true, false, false);
    715726        right->addChild(new DVBInversion(id));
  • libs/libmythtv/dtvmultiplex.cpp

     
    180180
    181181    if (ok)
    182182        frequency = _frequency.toInt(&ok);
    183 
     183               
    184184    return ok;
    185185}
    186186