fix case of polarisation default tip
authorDarron Broad <darron@kewl.org>
Sat, 20 Oct 2012 05:30:19 +0100
changeset 263 fdb21df41398
parent 262 49c93c0b1b61
fix case of polarisation
dvbcompat.cxx
dvbcompat.h
io.cxx
lnb.cxx
--- a/dvbcompat.cxx	Mon Oct 01 01:38:42 2012 +0100
+++ b/dvbcompat.cxx	Sat Oct 20 05:30:19 2012 +0100
@@ -255,16 +255,16 @@
 
 /* polarisation to cstring */
 const char *
-dvbcompat::polarisation2cstr(unsigned int polarisation)
+dvbcompat::polarisation2cstr(unsigned int polarisation, bool upperCase)
 {
-	switch (polarisation)
-	{
-		case 0: return "h";
-		case 1: return "v";
-		case 2: return "l";
-		case 3: return "r";
-		default:break;
+	switch (polarisation) {
+	case 0: return ((upperCase) ? ("H") : ("h"));
+	case 1: return ((upperCase) ? ("V") : ("v"));
+	case 2: return ((upperCase) ? ("L") : ("l"));
+	case 3: return ((upperCase) ? ("R") : ("r"));
+	default:break;
 	}
+
 	return "?";
 }
 
--- a/dvbcompat.h	Mon Oct 01 01:38:42 2012 +0100
+++ b/dvbcompat.h	Sat Oct 20 05:30:19 2012 +0100
@@ -28,7 +28,7 @@
 	fe_sec_voltage_t polarisation2voltaget(char);
 	const char *voltaget2cstr(fe_sec_voltage_t);
 	unsigned int polarisation2uint(char);
-	const char *polarisation2cstr(unsigned int);
+	const char *polarisation2cstr(unsigned int, bool = false);
 
 	fe_modulation_t modulation2modulationt(unsigned int);
 	const char *modulationt2cstr(fe_modulation_t);
--- a/io.cxx	Mon Oct 01 01:38:42 2012 +0100
+++ b/io.cxx	Sat Oct 20 05:30:19 2012 +0100
@@ -245,7 +245,7 @@
 {
 	cout	<< sat->name << " "
 		<< (double)tp->frequency/1000.0 << " "
-		<< dvbcompat::polarisation2cstr(tp->polarisation) << " "
+		<< dvbcompat::polarisation2cstr(tp->polarisation, true) << " "
 		<< dvbcompat::delsyst2cstr(tp->delsys) << " "
 		<< dvbcompat::modulationt2cstr(tp->modulation) << " "
 		<< tp->symbol_rate/1000 << " "
--- a/lnb.cxx	Mon Oct 01 01:38:42 2012 +0100
+++ b/lnb.cxx	Sat Oct 20 05:30:19 2012 +0100
@@ -441,20 +441,24 @@
 	cout.flush();
 		
 	fcntl(O_NONBLOCK, false);
-	if (command != "")
-	{
+	if (command != "") {
 		stringstream cmd;
 		cmd << command << " /dev/dvb/adapter" << phy_adapter << "/dvr0";
 		cout << "Exec '" << cmd.str() << "'\n";
 		cout.flush();
 		err = system(cmd.str().c_str());
-	}
-	else
-	{
+		if (err) {
+			/* Do nothing */
+		}
+	} else {
 		struct dvb_frontend_event ev;
 		cout << "Press CTRL-C to exit.\n";
 		cout.flush();
-		while (1)
+		while (1) {
 			err = ioctl(fefd, FE_GET_EVENT, &ev);
+			if (err) {
+				/* Do nothing */
+			}
+		}
 	}
 }