Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] apps/scan



Hello,

since I'm using both DVB-T and DVB-C now I had some trouble with the
"scan" tool in apps tree:
It's currently hardcoded to adapter0...


I just copied some stuff from szap so that you can choose at runtime
(with "-a") which card should be scanned.
I also got the selection for frontend (-f) and demux (-d) although I do
not think this makes much sense...

I hope this useful for someone else or maybe Holger will even add this
to the cvs :-)



(diff is against current cvs)
_____________

--- scan.c.orig Fri Nov 22 20:09:58 2002
+++ scan.c      Fri Nov 22 21:22:01 2002
@@ -951,10 +951,46 @@
        }
 }
 
+static const char *usage = "\nusage: %s [-a adapter_num] [-f
frontend_id] [-d demux_id]\n\n";
+static char FRONTEND_DEV [80];
+static char DEMUX_DEV [80];
+
 
 int main (int argc, char **argv)
 {
-       scan_network
("/dev/dvb/adapter0/frontend0","/dev/dvb/adapter0/demux0");
+
+       int adapter = 0, frontend = 0, demux = 0;
+       int opt;
+
+
+
+        while ((opt = getopt(argc, argv, ":a:f:d:")) != -1) {
+                switch (opt) {
+                case 'a':
+                        adapter = strtoul(optarg, NULL, 0);
+                        break;
+                case 'f':
+                        frontend = strtoul(optarg, NULL, 0);
+                        break;
+                case 'd':
+                        demux = strtoul(optarg, NULL, 0);
+                        break;
+                default:
+                        fprintf (stderr, usage, argv[0]);
+                        return -1;
+                };
+        }
+
+
+        snprintf (FRONTEND_DEV, sizeof(FRONTEND_DEV),
+                  "/dev/dvb/adapter%i/frontend%i", adapter, frontend);
+
+        snprintf (DEMUX_DEV, sizeof(DEMUX_DEV),
+                  "/dev/dvb/adapter%i/demux%i", adapter, demux);
+
+        printf ("using '%s' and '%s'\n", FRONTEND_DEV, DEMUX_DEV);
+
+       scan_network (FRONTEND_DEV, DEMUX_DEV); 
        dump_lists ();
 
        return 0;



_________


Regards,
  Christian



-- 
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe linux-dvb" as subject.



Home | Main Index | Thread Index