diff mbox

[w_scan] Add Brazil support on w_scan

Message ID 4D909B59.9040809@redhat.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Mauro Carvalho Chehab March 28, 2011, 2:29 p.m. UTC
None
diff mbox

Patch

diff -r 1bd9736b45fe w_scan-20110206/countries.c
--- a/w_scan-20110206/countries.c	Tue Mar 22 23:19:49 2011 -0300
+++ b/w_scan-20110206/countries.c	Mon Mar 28 11:11:28 2011 -0300
@@ -31,7 +31,7 @@ 
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <linux/dvb/frontend.h>
 
 #ifdef VDRVERSNUM
@@ -136,6 +136,20 @@ 
                                 }
                         break;
                 
+		case	BR:	// Brazil
+                        switch(*dvb) {    
+                                case FE_QAM:
+                                        *frontend_type = FE_QAM;
+                                        info("DVB cable\n");
+                                        break;
+                                default:
+                                        *frontend_type = FE_OFDM;
+                                        info("ISDB-T (SBTVD)\n");
+                                        break;               
+                                }
+                        break;
+
+
                 case    US:     //      UNITED STATES
                 case    CA:     //      CANADA
                         *frontend_type = FE_ATSC;
@@ -245,6 +259,18 @@ 
                                 info("QAM US/CA\n");    
                                 }
                         break;
+		case	BR:
+                        switch(*dvb) {    
+                                case FE_QAM:
+					*channellist = DVBC_BR;
+                                        info("Brazil, cable\n");
+                                        break;
+                                default:
+					*channellist = ISDBT_6MHZ;
+                                        info("Brazil, terrestrial\n");
+                                        break;               
+                                }
+                        break;
                 //******************************************************************//    
                 default:
                         info("Country identifier %s not defined. Using default freq lists.\n", country);
@@ -278,6 +304,23 @@ 
                         case 14 ... 69: return  389000000;
                         default:        return  SKIP_CHANNEL;
                         }
+        case ISDBT_6MHZ: // ISDB-T, 6 MHz central frequencies
+                switch (channel) {
+			// Channels 7-13 are reserved but aren't used yet
+                        case 14 ... 69: return  389000000 + 142857;
+                        default:        return  SKIP_CHANNEL;
+                        }
+	case DVBC_BR: //BRAZIL - same range as ATSC IRC
+                switch (channel) {
+                        case 02 ... 04:   return   45000000;
+                        case 05 ... 06:   return   49000000;
+                        case 07 ... 13:   return  135000000;
+                        case 14 ... 22:   return   39000000;
+                        case 23 ... 94:   return   81000000;
+                        case 95 ... 99:   return -477000000;
+                        case 100 ... 133: return   51000000;
+                        default:          return SKIP_CHANNEL; 
+                        }
         case DVBT_AU: //AUSTRALIA, 7MHz step list
                 switch (channel) {
                         case 05 ... 12: return  142500000;
@@ -321,6 +364,8 @@ 
  */
 int freq_step(int channel, int channellist) {
 switch (channellist) {
+        case ISDBT_6MHZ:
+        case DVBC_BR:
         case ATSC_QAM:
         case ATSC_VSB: return  6000000; // atsc, 6MHz step
         case DVBT_AU:  return  7000000; // dvb-t australia, 7MHz step
diff -r 1bd9736b45fe w_scan-20110206/countries.h
--- a/w_scan-20110206/countries.h	Tue Mar 22 23:19:49 2011 -0300
+++ b/w_scan-20110206/countries.h	Mon Mar 28 11:11:28 2011 -0300
@@ -43,6 +43,8 @@ 
         DVBC_QAM                = 7,
         DVBC_FI                 = 8,
         DVBC_FR                 = 9,
+	DVBC_BR			= 10,
+	ISDBT_6MHZ		= 11,
         USERLIST                = 999
 };
 
diff -r 1bd9736b45fe w_scan-20110206/scan.c
--- a/w_scan-20110206/scan.c	Tue Mar 22 23:19:49 2011 -0300
+++ b/w_scan-20110206/scan.c	Mon Mar 28 11:11:28 2011 -0300
@@ -1914,6 +1914,7 @@ 
 		case 14:		return 5483000;
 		case 15:		return 6956000;
 		case 16:		return 6956500;
+		case 17:		return 5217000;		// Used in Brazil DVB-C @ 6MHz Bandwidth
 		default:		return 0;
 		}
 }
@@ -1985,6 +1986,10 @@ 
 		dvbc_symbolrate_min=dvbc_symbolrate_max=0;
 		break;
 	case FE_QAM:
+		// 6MHz DVB-C uses lower symbol rates
+		if (freq_step(channel, this_channellist) == 6000000) {
+			dvbc_symbolrate_min=dvbc_symbolrate_max=17;
+		}
 		break;
 	case FE_QPSK:
 		// channel means here: transponder,
@@ -2555,7 +2560,7 @@ 
 	"			enables scan of symbolrates\n"
 	"			6111, 6250, 6790, 6811, 5900,\n"
 	"			5000, 3450, 4000, 6950, 7000,\n"
-	"			6952, 6956, 6956.5\n"
+	"			6952, 6956, 6956.5, 5.217\n"
 	"		2 = extended QAM scan (enable QAM128)\n"
 	"			recommended for Nethterlands and Finland\n"
 	"		NOTE: extended scan will be *slow*\n"
@@ -2577,6 +2582,7 @@ 
 	"			14 = 5.4830 MSymbol/s\n"
 	"			15 = 6.9560 MSymbol/s\n"
 	"			16 = 6.9565 MSymbol/s\n"
+	"			17 = 5.2170 MSymbol/s\n"
 	"		NOTE: for experienced users only!!\n"
 	".................DVB-S/S2................\n"
 	"	-l <LNB type>\n"
@@ -2657,7 +2663,7 @@ 
 		case 'e': //extended scan flags
 			ext = strtoul(optarg, NULL, 0);
 			if (ext & 0x01)
-				dvbc_symbolrate_max = 16;
+				dvbc_symbolrate_max = 17;
 			if (ext & 0x02) {
 				modulation_max = 2;
 				modulation_flags |= MOD_OVERRIDE_MAX;