On Wed, Mar 06, 2013 at 12:11:45AM +0000, Adam Sampson wrote:
> [scan] assumes that transponders can be uniquely identified by
> frequency -- which is a reasonable assumption for DVB-T and DVB-C, but
> not for DVB-S.
> I've attached a patch that makes it check the polarisation, [...]

Does anyone have any thoughts on this -- or is there a separate bug
tracker for dvb-apps I should file the patch in?

Thanks,

-- 
Adam Sampson <a...@offog.org>                         <http://offog.org/>
# HG changeset patch
# User Adam Sampson <a...@offog.org>
# Date 1362526729 0
# Node ID 7eddf860ec93c7170155cdc95c1356e7d9dd5cd2
# Parent  f3a70b206f0f809b53e2de7d77578d15b7d831cb
scan: distinguish transponders with different polarisations

On DVB-S, it's possible to have two transponders with the same
frequency, provided they've got different polarisations -- e.g. Eutelsat
28A has 12560 H and V transponders. However, scan's find_transponder
previously assumed that two transponders were the same if they had the
same frequency.

This patch makes find_transponder check that the polarisations are also
the same, in the DVB-S case, and renames is_same_transponder to
is_same_frequency to make it clearer what it's actually checking.

diff -r f3a70b206f0f -r 7eddf860ec93 util/scan/scan.c
--- a/util/scan/scan.c  Sun Mar 03 12:51:40 2013 +0530
+++ b/util/scan/scan.c  Tue Mar 05 23:38:49 2013 +0000
@@ -206,7 +206,7 @@
        return tp;
 }
 
-static int is_same_transponder(uint32_t f1, uint32_t f2)
+static int is_same_frequency(uint32_t f1, uint32_t f2)
 {
        uint32_t diff;
        if (f1 == f2)
@@ -214,13 +214,13 @@
        diff = (f1 > f2) ? (f1 - f2) : (f2 - f1);
        //FIXME: use symbolrate etc. to estimate bandwidth
        if (diff < 2000) {
-               debug("f1 = %u is same TP as f2 = %u\n", f1, f2);
+               debug("f1 = %u is same frequency as f2 = %u\n", f1, f2);
                return 1;
        }
        return 0;
 }
 
-static struct transponder *find_transponder(uint32_t frequency)
+static struct transponder *find_transponder(uint32_t frequency, enum 
polarisation pol)
 {
        struct list_head *pos;
        struct transponder *tp;
@@ -229,12 +229,14 @@
                tp = list_entry(pos, struct transponder, list);
                if (current_tp_only)
                        return tp;
-               if (is_same_transponder(tp->param.frequency, frequency))
+               if (is_same_frequency(tp->param.frequency, frequency)
+                   && (tp->type != FE_QPSK || tp->polarisation == pol))
                        return tp;
        }
        list_for_each(pos, &new_transponders) {
                tp = list_entry(pos, struct transponder, list);
-               if (is_same_transponder(tp->param.frequency, frequency))
+               if (is_same_frequency(tp->param.frequency, frequency)
+                   && (tp->type != FE_QPSK || tp->polarisation == pol))
                        return tp;
        }
        return NULL;
@@ -1280,7 +1282,7 @@
 
                if (tn.type == fe_info.type) {
                        /* only add if develivery_descriptor matches FE type */
-                       t = find_transponder(tn.param.frequency);
+                       t = find_transponder(tn.param.frequency, 
tn.polarisation);
                        if (!t)
                                t = alloc_transponder(tn.param.frequency);
                        copy_transponder(t, &tn);
@@ -2012,7 +2014,7 @@
                        /* check if the alternate freqeuncy is really new to us 
*/
                        freq = t->other_f[t->n_other_f - 1];
                        t->n_other_f--;
-                       if (find_transponder(freq))
+                       if (find_transponder(freq, t->polarisation))
                                goto next;
 
                        /* remember tuning to the old frequency failed */

Reply via email to