When DVB-S2 tunning is requested, the tuner may report both DVB-S and DVB-S2 frequencies. There's a logic that tries to discover if the channel is either S or S2, but such logic is incomplete, causing problems. Fix it, doing a complete check for DVB-S compatible parameters. Reported-by: Stefan Seyfried <stefan.seyfried@xxxxxxxxxxxxxx> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> --- lib/libdvbv5/dvb-scan.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c index 5c8aca96df33..5bbeec1fa4fc 100644 --- a/lib/libdvbv5/dvb-scan.c +++ b/lib/libdvbv5/dvb-scan.c @@ -1118,9 +1118,33 @@ static void add_update_nit_dvbs(struct dvb_table_nit *nit, dvbs_dvbc_dvbs_freq_inner[d->fec]); dvb_store_entry_prop(new, DTV_ROLLOFF, dvbs_rolloff[d->roll_off]); - if (d->roll_off != 0) - dvb_store_entry_prop(new, DTV_DELIVERY_SYSTEM, - SYS_DVBS2); + + /* + * Check if the returned parameters are really DVB-S or not + * + * DVB-S supports only 0.35 roll-off, with QPSK and + * Red-Solomon FEC 1/2, 2/3, 3/4, 5/6, 7/8. If anythign else is + * reported, then it is DVB-S2. + */ + + if ((d->roll_off != 0 && d->roll_off != ROLLOFF_35) || + (d->modulation_system != 0 && d->modulation_system != QPSK)) { + dvb_store_entry_prop(new, DTV_DELIVERY_SYSTEM, SYS_DVBS2); + return; + } + + switch (d->fec) { + case FEC_NONE: + case FEC_AUTO: + case FEC_1_2: + case FEC_2_3: + case FEC_3_4: + case FEC_5_6: + case FEC_7_8: + return; + default: + dvb_store_entry_prop(new, DTV_DELIVERY_SYSTEM, SYS_DVBS2); + } } static void add_update_nit_isdbs(struct dvb_table_nit *nit, -- 2.33.1