Mailing List archive

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

[linux-dvb] [PATCH] Improve behaviour of scan app when setting frontend params



I have attached two small patches to the scan application, the first (scan-check-fe.diff) adds a check to report an error if there was a problem setting the frontend parameters.

The second patch (scan-fallback.diff) queries the frontend capabilities before trying to use "INVERSION_AUTO". I agree that this might not be the best place to do this, but it works for me.

It looks like a good place to add the software auto-inversion might be in the generic dvb-frontend code, thereby allowing it to be used by any tuner which doesn't have the hardware suport feature. I'll take a look when I get some more time.

Jon
--- scan.c	Sat Jun  7 12:53:37 2003
+++ new/scan.c-check-fe	Sat Jun  7 21:58:44 2003
@@ -1181,7 +1181,11 @@
 			p.frequency -= LOF_LO;
 	}
 
-	ioctl(frontend_fd, FE_SET_FRONTEND, &p);
+	if (ioctl(frontend_fd, FE_SET_FRONTEND, &p) < 0)
+	  {
+	    MSG("ERROR: Setting frontend parameters failed");
+	    return -1;
+	  }
 
 	for (i=0; i<3; i++) {
 		fe_status_t s;
--- new/scan.c-check-fe	Sat Jun  7 21:58:44 2003
+++ new/scan.c-fallback	Sat Jun  7 21:58:44 2003
@@ -1152,6 +1152,7 @@
 static
 int __tune_to_transponder (int frontend_fd, struct transponder *t)
 {
+	struct dvb_frontend_info fe_info;
 	struct dvb_frontend_parameters p;
 	int i;
 
@@ -1179,6 +1180,16 @@
 			p.frequency -= LOF_HI;
 		else
 			p.frequency -= LOF_LO;
+	}
+
+	/* Verify requested parameters are within frontend capabilities */
+	ioctl(frontend_fd, FE_GET_INFO, &fe_info);
+
+	if ((p.inversion == INVERSION_AUTO ) && 
+	    !(fe_info.caps & FE_CAN_INVERSION_AUTO))
+	{
+	    MSG("Frontend can not do requested INVERSION_AUTO, trying INVERSION_OFF instead");
+	    p.inversion = INVERSION_OFF;
 	}
 
 	if (ioctl(frontend_fd, FE_SET_FRONTEND, &p) < 0)

Home | Main Index | Thread Index