[linux-dvb] [PATCH] Uniquely identify unknown services

David Engel gigem at comcast.net
Thu Aug 18 18:25:31 CEST 2005


On Wed, Aug 17, 2005 at 10:38:52PM -0400, Michael Krufky wrote:
> I think that's a cool idea, but I don't think everybody is going to want 
> that enabled by default.  Could you make a command line argument that 
> would enable this behavior, and leave it disabled by default?

Sure.  Here it is.

David
-- 
David Engel
gigem at comcast.net

-------------- next part --------------
Index: util/scan/scan.c
===================================================================
RCS file: /cvs/linuxtv/dvb-apps/util/scan/scan.c,v
retrieving revision 1.17
diff -u -u -r1.17 scan.c
--- util/scan/scan.c	10 May 2005 21:26:12 -0000	1.17
+++ util/scan/scan.c	18 Aug 2005 16:24:45 -0000
@@ -65,6 +65,7 @@
 static int serv_select = 7;
 static int vdr_version = 2;
 static struct lnb_types_st lnb_type;
+static int unique_anon_services;
 
 static enum fe_spectral_inversion spectral_inversion = INVERSION_AUTO;
 
@@ -1905,6 +1906,7 @@
 	struct service *s;
 	int n = 0, i;
 	char sn[20];
+        int anon_services = 0;
 
 	list_for_each(p1, &scanned_transponders) {
 		t = list_entry(p1, struct transponder, list);
@@ -1925,8 +1927,14 @@
 
 			if (!s->service_name) {
 				/* not in SDT */
-				snprintf(sn, sizeof(sn), "[%04x]", s->service_id);
+				if (unique_anon_services)
+					snprintf(sn, sizeof(sn), "[%03x-%04x]",
+						 anon_services, s->service_id);
+				else
+					snprintf(sn, sizeof(sn), "[%04x]", 
+						 s->service_id);
 				s->service_name = strdup(sn);
+				anon_services++;
 			}
 			/* ':' is field separator in szap and vdr service lists */
 			for (i = 0; s->service_name[i]; i++) {
@@ -2055,7 +2063,8 @@
 	"	-u      UK DVB-T Freeview channel numbering for VDR\n\n"
 	"	-P do not use ATSC PSIP tables for scanning\n"
 	"	    (but only PAT and PMT) (applies for ATSC only)\n"
-	"	-A N	check for ATSC 1=Terrestrial [default], 2=Cable or 3=both\n";
+	"	-A N	check for ATSC 1=Terrestrial [default], 2=Cable or 3=both\n"
+	"	-U	Uniquely name unknown services\n";
 
 void
 bad_usage(char *pname, int problem)
@@ -2103,7 +2112,7 @@
 
 	/* start with default lnb type */
 	lnb_type = *lnb_enum(0);
-	while ((opt = getopt(argc, argv, "5cnpa:f:d:s:o:x:e:t:i:l:vquPA:")) != -1) {
+	while ((opt = getopt(argc, argv, "5cnpa:f:d:s:o:x:e:t:i:l:vquPA:U")) != -1) {
 		switch (opt) {
 		case 'a':
 			adapter = strtoul(optarg, NULL, 0);
@@ -2178,6 +2187,9 @@
 			}
 
 			break;
+		case 'U':
+			unique_anon_services = 1;
+			break;
 		default:
 			bad_usage(argv[0], 0);
 			return -1;


More information about the linux-dvb mailing list