summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/tweaker/bin
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core-testing/tweaker/bin')
-rwxr-xr-xabs/core-testing/tweaker/bin/twk_tuners.pl101
1 files changed, 16 insertions, 85 deletions
diff --git a/abs/core-testing/tweaker/bin/twk_tuners.pl b/abs/core-testing/tweaker/bin/twk_tuners.pl
index ff62b5e..22c6a23 100755
--- a/abs/core-testing/tweaker/bin/twk_tuners.pl
+++ b/abs/core-testing/tweaker/bin/twk_tuners.pl
@@ -105,11 +105,8 @@ my @capture_card_patterns = (
# [ "bt878-based frame grabbers", [".*0400.*109e.*036e.*", ".*0480.*109e.*0878.*"],
# ["V4L", ["NTSC"]]],
- );
-
-# USB patterns
+ # USB patterns
-my @usb_capture_patterns = (
[ "Dvico Dual Digital 4 rev2", [".* 0fe9:db98 .*"],
["DVB", ["DVB-T"]]],
);
@@ -153,11 +150,8 @@ sub implement_option {
if (connect_to_db("DBI:mysql:$dbconnectionstring")) {
my $logger = get_logger('tweaker.script');
- # Get a list of all PCI devices for later processing
- my @lspci = split('\n', execute_shell_command("lspci -mn"));
-
- # Get a list of all USB devices for later processing
- my @lsusb = split('\n', execute_shell_command("lsusb"));
+ # Get a list of all PCI and USB devices for later processing
+ my @device_list = split('\n', execute_shell_command("lspci -mn ; lsusb"));
# Iterate through the list of known tuner cards, then the list of known network tuners.
# For each known tuner, configure a safe default for it if it's found. Set up
@@ -346,22 +340,22 @@ sub implement_option {
# Configure each supported tuner/capture device detected on the system.
- # built-in, PCI, or PCI Express
- $logger->debug("Processing built-in, PCI, or PCI Express devices...");
- for my $pci_device (@lspci) {
- $logger->debug("DEVICE: $pci_device");
+ # built-in, PCI, PCI Express, or USB
+ $logger->debug("Processing built-in, PCI, PCI Express or USB devices...");
+ for my $a_device (@device_list) {
+ $logger->debug("DEVICE: $a_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 $device_data (@capture_card_patterns) {
+ $logger->debug("\tIs there a @$device_data[0] at this location?");
- for my $patterns (@$pci_device_data[1]) {
+ for my $patterns (@$device_data[1]) {
for my $pattern (@$patterns) {
if ($match) {
next;
} else {
$logger->debug("\t\tPATTERN: $pattern");
- $match += ($pci_device =~ m/$pattern/i);
+ $match += ($a_device =~ m/$pattern/i);
if ($match) {
$global_device_count++; # 1-indexed
@@ -372,10 +366,10 @@ sub implement_option {
# 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}++;
+ for my $typeblock (@$device_data[2]) {
+ my $device_type = @$typeblock[0];
+ $logger->debug("\t\tDEVICE TYPE: $device_type"); # e.g. "DVB", "MPEG", etc.
+ $cardtypes{$device_type}++;
my $sourceid = -1;
for my $sub_types (@$typeblock[1]) {
for my $sub_type (@$sub_types) {
@@ -395,7 +389,7 @@ sub implement_option {
#
# POPULATE capturecard table
#
- my $defaultinput = make_capturecard_SQL($global_device_count, $cardtypes{$pci_device_type}-1, $pci_device_type, -1);
+ my $defaultinput = make_capturecard_SQL($global_device_count, $cardtypes{$device_type}-1, $device_type, -1);
#
# POPULATE cardinput table
@@ -465,69 +459,6 @@ sub implement_option {
close(SHELL2);
} # else: don't scan the internet!
- # USB devices
- $logger->debug("Processing USB devices...");
- for my $usb_device (@lsusb) {
- $logger->debug("DEVICE: $usb_device");
- my $match=0;
-
- for my $usb_device_data (@usb_capture_patterns) {
- $logger->debug("\tIs there a @$usb_device_data[0] at this location?");
-
- for my $patterns (@$usb_device_data[1]) {
- for my $pattern (@$patterns) {
- if ($match) {
- next;
- } else {
- $logger->debug("\t\tPATTERN: $pattern");
- $match += ($usb_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 (@$usb_device_data[2]) {
- my $usb_device_type = @$typeblock[0];
- $logger->debug("\t\tDEVICE TYPE: $usb_device_type"); # e.g. "DVB", "MPEG", etc.
- $cardtypes{$usb_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");
-
- #
- # POPULATE capturecard table
- #
- my $defaultinput = make_capturecard_SQL($global_device_count, $cardtypes{$usb_device_type}-1, $usb_device_type, -1);
-
- #
- # POPULATE cardinput table
- #
- make_cardinput_SQL($global_device_count, $sourceid, $defaultinput, 0);
- }
- }
- }
- }
- }
- }
- }
-
# Filesystem Tweaks for tuners
# This only works with the Nova-T-500 card, but it doesn't hurt any other cards
execute_shell_command("echo \"#switch on onboard amplifier on Nova-T-500 card\" > /etc/modprobe.d/dvb-usb-dib0700");