Re: [PATCH] wscan: improved frontend autodetection

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

 



Hi,

Hans Werner wrote:
Currently wscan will not autodetect frontends which which have frontend != 0,
i.e. it only detects /dev/dvb/adapterN/frontend0 where N=0-3.

Since multiple frontends per adapter are supported in 2.6.28, this means the correct
frontend may not be found. For example with the HVR4000, DVB-T is always at frontend1.

The attached patch fixes this, searching for frontend 0-3 for each adapter 0-3.

Signed-off-by: Hans Werner <hwerner4@xxxxxx>
Good idea. :)
But while testing your patch it seems that it doesn't work as expected. Here some example:

w_scan version 20081106
Info: using DVB adapter auto detection.
  Found DVB-C frontend. Using adapter /dev/dvb/adapter0/frontend0
  Found DVB-C frontend. Using adapter /dev/dvb/adapter1/frontend0
  Found DVB-C frontend. Using adapter /dev/dvb/adapter2/frontend0
Info: unable to open frontend /dev/dvb/adapter3/frontend1'
Info: unable to open frontend /dev/dvb/adapter3/frontend2'
Info: unable to open frontend /dev/dvb/adapter3/frontend3'
-_-_-_-_ Getting frontend capabilities-_-_-_-_

I'm using three dvb-c frontends.
The detection doesnt stop anymore with your patch if a matching frontend was found, because it doesnt leave the outer loop.
Normally this search has to stop at /dev/dvb/adapter0/frontend0.
That means we have to change your patch a little. I also increased the number of adapters to 8, since i use more than 4.

Can you please test the attached patch and give some feedback? If it works fine for you, i would apply to w_scan.

-Winfried

PS: What is actually the maximum number of adapters and frontends per adapter? Can anybody give some hint?


--- w_scan-20080815/scan.c	2008-09-09 19:21:36.698571084 +0200
+++ w_scan-20081106/scan.c	2008-11-06 17:28:19.720159563 +0100
@@ -77,7 +77,7 @@
 	.type = -1
 };
 
-uint version = 20080815;
+uint version = 20081106;
 int verbosity = 2;
 
 #define ATSC_VSB	0x01
@@ -2579,7 +2579,7 @@
 {
 	char frontend_devname [80];
 	int adapter = 999, frontend = 0, demux = 0;
-	int opt, i;
+	int opt, i, j;
 	int frontend_fd;
 	int fe_open_mode;
 	int frontend_type = FE_OFDM;
@@ -2715,19 +2715,19 @@
 	if ( adapter == 999 ) {
 		info("Info: using DVB adapter auto detection.\n");
 		fe_open_mode = O_RDWR | O_NONBLOCK;
-		for (i=0; i < 4; i++) {
-		  snprintf (frontend_devname, sizeof(frontend_devname),  		"/dev/dvb/adapter%i/frontend0", i);
-		  if ((frontend_fd = open (frontend_devname, fe_open_mode)) < 0) {
-		  	info("Info: unable to open frontend %s'\n", frontend_devname);
+		for (i=0; i < 8; i++) {
+		  for (j=0; j < 4; j++) {
+		    snprintf (frontend_devname, sizeof(frontend_devname), "/dev/dvb/adapter%i/frontend%i", i, j);
+		    if ((frontend_fd = open (frontend_devname, fe_open_mode)) < 0) {
 			continue;
 			}
-		/* determine FE type and caps */
-		if (ioctl(frontend_fd, FE_GET_INFO, &fe_info) == -1) {
+		    /* determine FE type and caps */
+		    if (ioctl(frontend_fd, FE_GET_INFO, &fe_info) == -1) {
 			info("   ERROR: unable to determine frontend type\n");
 			close (frontend_fd);
 			continue;
-			}		  
-		if (fe_info.type==frontend_type) {
+			}
+		    if (fe_info.type == frontend_type) {
 			if (fe_info.type == FE_OFDM) 
 			  info("   Found DVB-T frontend. Using adapter %s\n",frontend_devname);
                         else if (fe_info.type == FE_ATSC)
@@ -2736,9 +2736,14 @@
 			  info("   Found DVB-C frontend. Using adapter %s\n",frontend_devname);                     
 			close (frontend_fd);
 			adapter=i;
+			frontend=j;
+			i=999;
 			break;
-			} 		
+			}
+                     else
+                        info("   Wrong type, ignoring frontend %s\n",frontend_devname);
 
+		  }
 		}
 	}
 	snprintf (frontend_devname, sizeof(frontend_devname),
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux