aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-12-31 14:35:06 -0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-12-31 14:35:06 -0200
commitd5d1e38a2f281f518956671988c0900feeb9c549 (patch)
tree8a65f71b0db9f7f46a17c39d1528c33b10d84848
parenta710e1bb7c6803a9347d3899b9129d887221985f (diff)
libdvbv5: fix handling of satellite number
The logic that enforces satellite number to be a valid value is wrong: instead of using a bitmask, it was using a modulo. Also, we don't need to enforce it at dvb-scan/dvb-zap, as the library does that for us. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--lib/libdvbv5/dvb-sat.c4
-rw-r--r--utils/dvb/dvbv5-scan.c2
-rw-r--r--utils/dvb/dvbv5-zap.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
index 5d06dfa3..ef63ec96 100644
--- a/lib/libdvbv5/dvb-sat.c
+++ b/lib/libdvbv5/dvb-sat.c
@@ -437,7 +437,7 @@ static int dvbsat_diseqc_write_to_port_group(struct dvb_v5_fe_parms_priv *parms,
cmd->data0 |= high_band;
cmd->data0 |= pol_v ? 0 : 2;
/* Instead of using position/option, use a number from 0 to 3 */
- cmd->data0 |= (sat_number % 0x3) << 2;
+ cmd->data0 |= (sat_number & 0x3) << 2;
return dvb_fe_diseqc_cmd(&parms->p, cmd->len, cmd->msg);
}
@@ -463,7 +463,7 @@ static int dvbsat_scr_odu_channel_change(struct dvb_v5_fe_parms_priv *parms,
cmd->data1 = t & 0xff;
/* Fill the satelite number - highest bit is for pos A/pos B */
- cmd->data0 |= (sat_number % 0x7) << 5;
+ cmd->data0 |= (sat_number & 0x7) << 5;
pos_b = (sat_number & 0x8) ? 1 : 0;
/* Fill the LNB number */
diff --git a/utils/dvb/dvbv5-scan.c b/utils/dvb/dvbv5-scan.c
index 0d7e5769..57bed4cf 100644
--- a/utils/dvb/dvbv5-scan.c
+++ b/utils/dvb/dvbv5-scan.c
@@ -547,7 +547,7 @@ int main(int argc, char **argv)
if (lnb >= 0)
parms->lnb = dvb_sat_get_lnb(lnb);
if (args.sat_number >= 0)
- parms->sat_number = args.sat_number % 3;
+ parms->sat_number = args.sat_number;
parms->diseqc_wait = args.diseqc_wait;
parms->freq_bpf = args.freq_bpf;
parms->lna = args.lna;
diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c
index 13c3ee06..3050799f 100644
--- a/utils/dvb/dvbv5-zap.c
+++ b/utils/dvb/dvbv5-zap.c
@@ -931,7 +931,7 @@ int main(int argc, char **argv)
if (lnb >= 0)
parms->lnb = dvb_sat_get_lnb(lnb);
if (args.sat_number > 0)
- parms->sat_number = args.sat_number % 3;
+ parms->sat_number = args.sat_number;
parms->diseqc_wait = args.diseqc_wait;
parms->freq_bpf = args.freq_bpf;
parms->lna = args.lna;

Privacy Policy