From 4adf0153cbc675daea90ccc0f7f1935eb6b2aa23 Mon Sep 17 00:00:00 2001
From: Bob Igo <bob@stormlogic.com>
Date: Thu, 19 Feb 2009 16:31:04 -0500
Subject: Merged some twk_tuners.pl fixes from local KnoppMyth patches repo.

---
 abs/core-testing/tweaker/bin/twk_tuners.pl | 91 ++++++++++++++++--------------
 1 file changed, 48 insertions(+), 43 deletions(-)

diff --git a/abs/core-testing/tweaker/bin/twk_tuners.pl b/abs/core-testing/tweaker/bin/twk_tuners.pl
index 0b2b88c..f928ea7 100755
--- a/abs/core-testing/tweaker/bin/twk_tuners.pl
+++ b/abs/core-testing/tweaker/bin/twk_tuners.pl
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# Copyright 2008-2009 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv.
+# Copyright 2008 Robert ("Bob") Igo of StormLogic, LLC and mythic.tv.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -31,8 +31,8 @@ my @capture_card_patterns = (
     # ATSC-only devices
     [ "pcHDTV hd-2000", [".*0400.*109e.*036e.*r11.*7063.*2000.*"],
       ["DVB", ["ATSC"]]],
-    [ "BBTI Air2PC v2", [".*0280.*13d0.*2103.*r02.*13d0.*2103.*"], # ??? dupe 1; mihanson
-      ["DVB", ["ATSC"]]],
+#    [ "BBTI Air2PC v2", [".*0280.*13d0.*2103.*r02.*13d0.*2103.*"], # ??? dupe 1; mihanson
+#      ["DVB", ["ATSC"]]],
     
     # DVB-T devices
     [ "DViCO FusionHDTV DVB-T Lite", [".*0400.*109e.*036e.*r11.*18ac.*db10.*"],
@@ -60,8 +60,8 @@ my @capture_card_patterns = (
     # DVB-S devices
     [ "VisionPlus 1020A", [".*0480.*109e.*0878.*1822.*0001.*"],
       ["DVB", ["DVB-S"]]],
-    [ "Technisat Skystar2", [".*0280.*13d0.*2103.*r01.*13d0.*2103.*"], # ??? dupe 1; nbdwt73, neutron68
-      ["DVB", ["DVB-S"]]],
+#    [ "Technisat Skystar2", [".*0280.*13d0.*2103.*r01.*13d0.*2103.*"], # ??? dupe 1; nbdwt73, neutron68
+#      ["DVB", ["DVB-S"]]],
     [ "Twinhan 102g", [".*0400.*109e.*036e.*r11.*1822.*0001.*"], # ??? dupe 2; neutron68
       # secondary device "0480" "109e" "0878" -r11 "1822" "0001"
       ["DVB", ["DVB-S"]]],
@@ -342,53 +342,58 @@ sub implement_option {
 	$logger->debug("Processing local devices...");
 	for my $pci_device (@lspci) {
 	    $logger->debug("DEVICE: $pci_device");
+	    my $match=0;
 
 	    for my $pci_device_data (@capture_card_patterns) {
 		$logger->debug("\tIs there a @$pci_device_data[0] at this location?");
+
 		for my $patterns (@$pci_device_data[1]) {
 		    for my $pattern (@$patterns) {
-			my $match=0;
-			$logger->debug("\t\tPATTERN: $pattern");
-			$match += ($pci_device =~ m/$pattern/i);
 			if ($match) {
-			    $global_device_count++; # 1-indexed
-						    
-			    $logger->debug("\t\tfound one!");
-			    # Each device has a device type (e.g. MPEG, DVB, V4L) that it supports, and a
-			    # list of sub_types (e.g. PAL, NTSC, DVB-S, DVB-T, DVB-C, ATSC, QAM).
-			    # The device type is used to configure the capturecard table and the cardinput table.
-			    # The sub_types are used to populate the videosource table.
-			    # The device type and "best" sub_type are used to set the 'sourceid' field of the cardinput table.
-
-			    for my $typeblock (@$pci_device_data[2]) {
-				my $pci_device_type = @$typeblock[0];
-				$logger->debug("\t\tDEVICE TYPE: $pci_device_type"); # e.g. "DVB", "MPEG", etc.
-				$cardtypes{$pci_device_type}++;
-				my $sourceid = -1;
-				for my $sub_types (@$typeblock[1]) {
-				    for my $sub_type (@$sub_types) {
-					$logger->debug("\t\tSUB-TYPE: $sub_type\n"); # e.g. "DVB-S", "QAM", etc.
-					# ensure that the videosource table has an entry for each sub_type
-					# that this device supports; use the "best" one for the device by
-					# default
-
-					#
-					# POPULATE videosource table
-					#
-					$sourceid = max(verify_or_make_videosource_SQL($sub_type), $sourceid);
+			    next;
+			} else {
+			    $logger->debug("\t\tPATTERN: $pattern");
+			    $match += ($pci_device =~ m/$pattern/i);
+			    if ($match) {
+				$global_device_count++; # 1-indexed
+				
+				$logger->debug("\t\tfound one!");
+				# Each device has a device type (e.g. MPEG, DVB, V4L) that it supports, and a
+				# list of sub_types (e.g. PAL, NTSC, DVB-S, DVB-T, DVB-C, ATSC, QAM).
+				# The device type is used to configure the capturecard table and the cardinput table.
+				# The sub_types are used to populate the videosource table.
+				# The device type and "best" sub_type are used to set the 'sourceid' field of the cardinput table.
+
+				for my $typeblock (@$pci_device_data[2]) {
+				    my $pci_device_type = @$typeblock[0];
+				    $logger->debug("\t\tDEVICE TYPE: $pci_device_type"); # e.g. "DVB", "MPEG", etc.
+				    $cardtypes{$pci_device_type}++;
+				    my $sourceid = -1;
+				    for my $sub_types (@$typeblock[1]) {
+					for my $sub_type (@$sub_types) {
+					    $logger->debug("\t\tSUB-TYPE: $sub_type\n"); # e.g. "DVB-S", "QAM", etc.
+					    # ensure that the videosource table has an entry for each sub_type
+					    # that this device supports; use the "best" one for the device by
+					    # default
+
+					    #
+					    # POPULATE videosource table
+					    #
+					    $sourceid = max(verify_or_make_videosource_SQL($sub_type), $sourceid);
+					}
 				    }
-				}
-				$logger->debug("\t\t\"BEST\" SOURCE ID: $sourceid\n");
+				    $logger->debug("\t\t\"BEST\" SOURCE ID: $sourceid\n");
 
-				#
-				# POPULATE capturecard table
-				#
-				my $defaultinput = make_capturecard_SQL($global_device_count, $cardtypes{$pci_device_type}-1, $pci_device_type, -1);
+				    #
+				    # POPULATE capturecard table
+				    #
+				    my $defaultinput = make_capturecard_SQL($global_device_count, $cardtypes{$pci_device_type}-1, $pci_device_type, -1);
 
-				#
-				# POPULATE cardinput table
-				#
-				make_cardinput_SQL($global_device_count, $sourceid, $defaultinput, 0);
+				    #
+				    # POPULATE cardinput table
+				    #
+				    make_cardinput_SQL($global_device_count, $sourceid, $defaultinput, 0);
+				}
 			    }
 			}
 		    }
-- 
cgit v0.12