summaryrefslogtreecommitdiff
path: root/v4l/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/scripts')
-rwxr-xr-xv4l/scripts/gentree.pl93
-rwxr-xr-xv4l/scripts/hghead.pl41
-rwxr-xr-xv4l/scripts/insmod.sh305
-rwxr-xr-xv4l/scripts/make_kconfig.pl393
-rwxr-xr-xv4l/scripts/make_makefile.pl36
-rwxr-xr-xv4l/scripts/make_myconfig.pl58
-rwxr-xr-xv4l/scripts/make_noconfig.pl63
-rwxr-xr-xv4l/scripts/makelinks.sh10
-rwxr-xr-xv4l/scripts/prep_commit_msg.pl73
-rwxr-xr-xv4l/scripts/rmmod.pl194
-rwxr-xr-xv4l/scripts/strip-trailing-whitespaces.sh57
-rwxr-xr-xv4l/scripts/tuner.pl11
12 files changed, 835 insertions, 499 deletions
diff --git a/v4l/scripts/gentree.pl b/v4l/scripts/gentree.pl
index 0ae296b93..e58d410c2 100755
--- a/v4l/scripts/gentree.pl
+++ b/v4l/scripts/gentree.pl
@@ -2,12 +2,10 @@
use strict;
use File::Find;
use Fcntl ':mode';
-use Cwd;
my $VER = shift;
my $SRC = shift;
my $DESTDIR = shift;
-my $cwd;
my $extra;
@@ -70,9 +68,9 @@ sub filter_source ($$) {
if ($line =~ m/^#include \"compat.h\"/) {
next;
}
- if ($line =~ m/[\$]Id:/) {
- next;
- }
+# if ($line =~ m/[\$]Id:/) {
+# next;
+# }
if ($line =~ /^#ifdef MM_KERNEL/) {
chomp($line);
$state{$level} = "if";
@@ -81,8 +79,20 @@ sub filter_source ($$) {
$level++;
next;
}
- if ($line =~ /^\s*#if 0\s.*[Kk][Ee][Ee][Pp].*/) {
- print OUT "#if 0\n";
+ if ($line =~ /^#ifdef _COMPAT_H/) {
+ chomp($line);
+ $state{$level} = "if";
+ $if{$level} = 0;
+ print STDERR "/* BP #if MM_KERNEL state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ $level++;
+ next;
+ }
+ if ($line =~ m|^\s*\#if\s+0\s*\/[\*]\s*[Kk][Ee].[Pp]\s*[\*]\/(.*)|) {
+ if ($1 eq ";") {
+ print OUT "#if 0\n";
+ } else {
+ print OUT "#if 0$1\n";
+ }
chomp($line);
$state{$level} = "ifother";
$if{$level} = 0;
@@ -90,6 +100,30 @@ sub filter_source ($$) {
$level++;
next;
}
+ if ($line =~ /^#ifdef\sSTV0297_CS2/) {
+ chomp($line);
+ $state{$level} = "if";
+ $if{$level} = 0;
+ print STDERR "/* BP #if 0 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ $level++;
+ next;
+ }
+ if ($line =~ /^#ifndef\sBROKEN_XAWTV/) {
+ chomp($line);
+ $state{$level} = "if";
+ $if{$level} = 1;
+ print STDERR "/* BP #if 0 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ $level++;
+ next;
+ }
+ if ($line =~ /^#ifndef\sSTV0297_CS2/) {
+ chomp($line);
+ $state{$level} = "if";
+ $if{$level} = 1;
+ print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ $level++;
+ next;
+ }
if ($line =~ /^#if 0/) {
chomp($line);
$state{$level} = "if";
@@ -98,8 +132,8 @@ sub filter_source ($$) {
$level++;
next;
}
- if ($line =~ /^#if 1\s.*[Kk][Ee][Ee][Pp].*/) {
- print OUT "#if 1\n";
+ if ($line =~ m|^\s*\#if\s+1\s*\/[\*]\s*[Kk][Ee].[Pp]\s*[\*]\/(.*)|) {
+ print OUT "#if 1$1\n";
$state{$level} = "ifother";
$if{$level} = 1;
print STDERR "/* BP #if 1 (keep) state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
@@ -122,6 +156,14 @@ sub filter_source ($$) {
$level++;
next;
}
+ if ($line =~ /^#if.*CONFIG_XC3028/) {
+ chomp($line);
+ $state{$level} = "if";
+ $if{$level} = 0;
+ print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ $level++;
+ next;
+ }
if ($line =~ /^#if.*I2C_CLASS_TV_ANALOG/) {
chomp($line);
$state{$level} = "if";
@@ -138,7 +180,15 @@ sub filter_source ($$) {
$level++;
next;
}
- if ($line =~ /^#if.*I2C_CLASS_TV_DIGITAL/) {
+ if ($line =~ /^#ifndef.\s*I2C_PEC/) {
+ chomp($line);
+ $state{$level} = "if";
+ $if{$level} = 0;
+ print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
+ $level++;
+ next;
+ }
+ if ($line =~ /^#ifdef.\s*I2C_PEC/) {
chomp($line);
$state{$level} = "if";
$if{$level} = 1;
@@ -146,14 +196,14 @@ sub filter_source ($$) {
$level++;
next;
}
- if ($line =~ /^#if.*CONFIG_XC3028/) {
+ if ($line =~ /^#if.*I2C_CLASS_TV_DIGITAL/) {
chomp($line);
$state{$level} = "if";
- $if{$level} = 0;
- print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level$
+ $if{$level} = 1;
+ print STDERR "/* BP #if 1 state=$state{$level} if=$if{$level} level=$level ($line) */\n" if $DEBUG;
$level++;
next;
- }
+ }
if ($line =~ /^#if.*BTTV_VERSION_CODE/) {
chomp($line);
$line =~ s@^#if\s*@@;
@@ -280,9 +330,7 @@ sub parse_dir {
return;
}
- my $mode = (lstat("$cwd/$file"))[2];
-
-# printf "Permissions of %s/%s are %04o (dir=%s\n", $cwd,$file, $mode, cwd;
+ my $mode = (lstat("$file"))[2];
if ($mode & S_IFDIR) {
return;
@@ -291,14 +339,14 @@ sub parse_dir {
$srcdir =~ s/(.)/\[$1\]/g;
my $f2 = $file;
- $f2 =~ s,^$srcdir,$cwd/$DESTDIR/,;
+ $f2 =~ s,^$srcdir,$DESTDIR/,;
print "from $file to $f2\n";
my $tmp = "/tmp/src.$$";
if ($file =~ m/.*\.[ch]$/) {
- filter_source("$cwd/$file","$tmp");
+ filter_source("$file","$tmp");
} else {
- system("cp $cwd/$file $tmp");
+ system("cp $file $tmp");
}
my $dir = $f2;
@@ -315,12 +363,11 @@ sub parse_dir {
my $patchtmploc = "/tmp/temp.patch";
-printf STDERR <<EOF,$VER,$CODE;
+printf <<EOF,$VER,$CODE;
kernel is %s (0x%x)
EOF
-print STDERR "finding files at $SRC\n";
+print "finding files at $SRC\n";
-$cwd=cwd;
find(\&parse_dir, $SRC);
diff --git a/v4l/scripts/hghead.pl b/v4l/scripts/hghead.pl
index ddaef0767..fdc9720c6 100755
--- a/v4l/scripts/hghead.pl
+++ b/v4l/scripts/hghead.pl
@@ -8,10 +8,11 @@ use Date::Parse;
my $in = shift;
my $line;
my $subject;
-my $from=0;
my $sub_ok=0;
my $init=0;
my $num=0;
+my $hgimport=0;
+my $mmimport=0;
my $maint_ok=0;
my $noblank=1;
my $maintainer_name=$ENV{CHANGE_LOG_NAME};
@@ -33,6 +34,10 @@ while ($line = <IN>) {
if ($line =~ m/^\-\-\- .*/) {
last;
}
+ if ($line =~ m/^\-\-\-\-.*/) {
+ $body="";
+ next;
+ }
if ($line =~ m/^\-\-\-.*/) {
last;
}
@@ -62,7 +67,11 @@ while ($line = <IN>) {
$from= "From: $fromname\n";
next;
}
- print "Bad: author line have a wrong syntax\n";
+ if ($line =~ m/^From:\sakpm\@osdl.org/) {
+ $mmimport=1;
+ next;
+ }
+ print "Bad: author line have a wrong syntax: $line\n";
die;
}
@@ -87,6 +96,21 @@ while ($line = <IN>) {
$signed="$signed$line";
next;
}
+ if ( ($line =~ m/^\# HG changeset patch/) ||
+ ($line =~ m/^has been added to the -mm tree. Its filename is/) ) {
+ $sub_ok=0;
+ $init=0;
+ $num=0;
+ $maint_ok=0;
+ $noblank=1;
+ $from="";
+ $body="";
+ $subject="";
+ $hgimport=1;
+ next;
+ }
+
+
if ($line =~ m/^Acked-by:.*/) {
$signed="$signed$line";
next;
@@ -96,7 +120,7 @@ while ($line = <IN>) {
if ($line =~ m/Changeset:\s*(.*)\n/) {
$num=$1;
}
- print "# $line";
+# print "# $line";
next;
}
@@ -105,12 +129,19 @@ while ($line = <IN>) {
$line="\n";
}
+ if ($line =~ m/^#/) {
+ next;
+ }
if ($sub_ok == 0) {
$sub_ok=1;
substr( $subject, 0, 1 ) = uc (substr ($subject, 0, 1));
if ($subject =~ m|V4L\/DVB\s*(.+)|) {
$subject=$1;
}
+ if ($hgimport) {
+ $subject=$line;
+ next;
+ }
if ($line =~ m/^\n/) {
next;
}
@@ -143,8 +174,8 @@ if (!$signed =~ m/$from/) {
die;
}
-$body=~s/\n+$//;
-$body=~s/^\n+$//;
+$body=~s/[\n\s]+$//;
+$body=~s/^[\n\s]+//;
# First from is used by hg to recognize commiter name
print "#Committer: $maintainer_name <$maintainer_email>\n";
diff --git a/v4l/scripts/insmod.sh b/v4l/scripts/insmod.sh
deleted file mode 100755
index 6efab6a82..000000000
--- a/v4l/scripts/insmod.sh
+++ /dev/null
@@ -1,305 +0,0 @@
-#!/bin/sh
-# insmod modules from current directory without having to install them first
-
-sync
-
-case "$1" in
- load)
- echo "Inserting V4L/DVB modules into kernel"
- modprobe i2c-core
- modprobe crc32
- modprobe firmware_class
- # make sure input stuff is there for IR remote controls
- modprobe evdev
- # video4linux
- insmod ./compat_ioctl32.ko
- insmod ./videodev.ko
- insmod ./v4l1-compat.ko
- insmod ./v4l2-common.ko
- insmod ./video-buf.ko
- insmod ./ir-common.ko
- insmod ./ir-kbd-i2c.ko
- insmod ./tuner.ko
- insmod ./tda9887.ko
- insmod ./tvaudio.ko
- insmod ./tveeprom.ko
- insmod ./tvmixer.ko
- insmod ./cs53l32a.ko
- insmod ./wm8775.ko
- insmod ./cx25840.ko
- insmod ./saa7115.ko
- insmod ./btcx-risc.ko
- insmod ./saa7127.ko
- insmod ./msp3400.ko
- insmod ./tvp5150.ko
- insmod ./tda7432.ko
- insmod ./tda9840.ko
- insmod ./tda9875.ko
- insmod ./tea6415c.ko
- insmod ./tea6420.ko
- # DVB core
- insmod ./dvb-core.ko # dvb_net_debug=1
- # for hybrid cx88 and saa7134 cards
- insmod ./video-buf-dvb.ko
- # frontend drivers
- insmod ./dvb-pll.ko
- insmod ./ves1x93.ko
- insmod ./sp8870.ko
- insmod ./cx22700.ko
- insmod ./stv0299.ko
- insmod ./ves1820.ko
- insmod ./tda1004x.ko
- insmod ./tda10021.ko
- insmod ./dib3000-common.ko
- insmod ./dib3000mb.ko
- insmod ./dib3000mc.ko
- insmod ./l64781.ko
- insmod ./tda8083.ko
- insmod ./cx24110.ko
- insmod ./cx24123.ko
- insmod ./cx22702.ko
- insmod ./mt312.ko
- insmod ./mt352.ko
- insmod ./stv0297.ko
- insmod ./nxt200x.ko
- insmod ./lgdt330x.ko
- insmod ./nxt6000.ko
- insmod ./bcm3510.ko
- insmod ./s5h1420.ko
- insmod ./sp887x.ko
- insmod ./or51211.ko
- insmod ./or51132.ko
- insmod ./zl10353.ko
- insmod ./ttusbdecfe.ko
-
- # saa7146 based siemens/technotrend/hauppauge cards
- insmod ./saa7146.ko
- insmod ./saa7146_vv.ko
- insmod ./ttpci-eeprom.ko
- insmod ./dvb-ttpci.ko
- insmod ./budget-core.ko
- insmod ./budget.ko
- insmod ./budget-ci.ko
- insmod ./budget-av.ko
- insmod ./mxb.ko
- insmod ./hexium_gemini.ko
- insmod ./hexium_orion.ko
- # technotrend/hauppauge USB things
- insmod ./dvb-ttusb-budget.ko
- insmod ./ttusb_dec.ko
-
- # technisat skystar2
- insmod ./stv0297_cs2.ko
- insmod ./b2c2-flexcop.ko
- insmod ./b2c2-flexcop-usb.ko
- insmod ./b2c2-flexcop-pci.ko
- # terratec CinergyT2
- insmod ./cinergyT2.ko
-
- insmod ./dvb-usb.ko
- insmod ./dvb-usb-vp7045.ko
- insmod ./dvb-usb-dtt200u.ko
-
- insmod ./dvb-usb-dibusb-common.ko
- insmod ./dvb-usb-dibusb-mb.ko
- insmod ./dvb-usb-dibusb-mc.ko
- insmod ./dvb-usb-a800.ko
- insmod ./dvb-usb-nova-t-usb2.ko
- insmod ./dvb-usb-umt-010.ko
- insmod ./dvb-usb-digitv.ko
- insmod ./dvb-usb-cxusb.ko
- # bt8xx
- insmod ./bt832.ko
- insmod ./bttv.ko
- insmod ./bt878.ko
- insmod ./dst.ko
- insmod ./dst_ca.ko
- insmod ./dvb-bt8xx.ko
- insmod ./saa6588.ko
- # conexant cx2388x
- insmod ./cx88xx.ko
- insmod ./cx8800.ko
- insmod ./cx8802.ko
- insmod ./cx88-vp3054-i2c.ko
- insmod ./cx88-dvb.ko
- insmod ./cx88-blackbird.ko
- insmod ./cx88-alsa.ko
- # phillips saa713x
- insmod ./saa7134.ko
- insmod ./saa7134-alsa.ko
-# insmod ./saa7134-oss.ko
- insmod ./saa7134-dvb.ko
- insmod ./saa7134-empress.ko
- insmod ./saa6752hs.ko
-
- insmod ./em28xx.ko
- insmod ./pvrusb2.ko
- insmod ./cpia2.ko
- insmod ./vivi.ko
-
- echo
- ;;
- debug)
- echo "Inserting V4L/DVB modules (debug) into kernel"
- modprobe i2c-core
- modprobe crc32
- modprobe firmware_class
- modprobe evdev
- insmod ./compat_ioctl32.ko
- insmod ./videodev.ko
- insmod ./v4l1-compat.ko
- insmod ./v4l2-common.ko
- insmod ./video-buf.ko
- insmod ./ir-common.ko
- insmod ./ir-kbd-i2c.ko
- insmod ./tuner.ko tuner_debug=1
- insmod ./tda9887.ko
- insmod ./tvaudio.ko
- insmod ./tveeprom.ko
- insmod ./tvmixer.ko
- insmod ./cs53l32a.ko
- insmod ./wm8775.ko
- insmod ./cx25840.ko
- insmod ./saa7115.ko
- insmod ./btcx-risc.ko
- insmod ./saa7127.ko
- insmod ./msp3400.ko
- insmod ./tvp5150.ko
- insmod ./tda7432.ko
- insmod ./tda9840.ko
- insmod ./tda9875.ko
- insmod ./tea6415c.ko
- insmod ./tea6420.ko
- insmod ./dvb-core.ko cam_debug=1
- insmod ./video-buf-dvb.ko
- insmod ./dvb-pll.ko
- insmod ./ves1x93.ko
- insmod ./sp8870.ko
- insmod ./cx22700.ko
- insmod ./stv0299.ko
- insmod ./ves1820.ko
- insmod ./tda1004x.ko
- insmod ./tda10021.ko
- insmod ./dib3000-common.ko
- insmod ./dib3000mb.ko
- insmod ./dib3000mc.ko
- insmod ./l64781.ko
- insmod ./stv0297.ko
- insmod ./tda8083.ko
- insmod ./cx24110.ko
- insmod ./cx24123.ko
- insmod ./mt312.ko
- insmod ./mt352.ko
- insmod ./cx22702.ko
- insmod ./nxt200x.ko
- insmod ./lgdt330x.ko
- insmod ./nxt6000.ko
- insmod ./bcm3510.ko
- insmod ./s5h1420.ko
- insmod ./sp887x.ko
- insmod ./or51211.ko
- insmod ./or51132.ko
- insmod ./zl10353.ko
- insmod ./ttusbdecfe.ko
- insmod ./saa7146.ko
- insmod ./saa7146_vv.ko
- insmod ./ttpci-eeprom.ko
- insmod ./dvb-ttpci.ko debug=247
- insmod ./budget-core.ko
- insmod ./budget.ko
- insmod ./budget-ci.ko
- insmod ./budget-av.ko
- insmod ./mxb.ko
- insmod ./hexium_gemini.ko
- insmod ./hexium_orion.ko
- insmod ./dvb-ttusb-budget.ko
- insmod ./stv0297_cs2.ko
- insmod ./b2c2-flexcop.ko debug=0x01
- insmod ./b2c2-flexcop-usb.ko debug=0x01
- insmod ./b2c2-flexcop-pci.ko debug=0x01
- insmod ./ttusb_dec.ko
- insmod ./cinergyT2.ko
-
- insmod ./dvb-usb.ko debug=0x33
- insmod ./dvb-usb-vp7045.ko debug=0x03
- insmod ./dvb-usb-dtt200u.ko debug=0x03
-
- insmod ./dvb-usb-dibusb-common.ko debug=0x03
- insmod ./dvb-usb-dibusb-mb.ko
- insmod ./dvb-usb-dibusb-mc.ko
- insmod ./dvb-usb-a800.ko
- insmod ./dvb-usb-nova-t-usb2.ko
- insmod ./dvb-usb-umt-010.ko
- insmod ./dvb-usb-digitv.ko
- insmod ./dvb-usb-cxusb.ko
-
- insmod ./bt832.ko
- insmod ./bttv.ko
- insmod ./bt878.ko
- insmod ./dst.ko
- insmod ./dst_ca.ko
- insmod ./dvb-bt8xx.ko
- insmod ./saa6588.ko
-
- insmod ./cx88xx.ko
- insmod ./cx8800.ko
- insmod ./cx8802.ko
- insmod ./cx88-vp3054-i2c.ko
- insmod ./cx88-dvb.ko
- insmod ./cx88-blackbird.ko
- insmod ./cx88-alsa.ko
-
- insmod ./saa7134.ko
- insmod ./saa7134-alsa.ko
- insmod ./saa7134-oss.ko
- insmod ./saa7134-dvb.ko
- insmod ./saa7134-empress.ko
- insmod ./saa6752hs.ko
-
- insmod ./em28xx.ko
- insmod ./pvrusb2.ko
- insmod ./cpia2.ko
- insmod ./vivi.ko
- echo
- ;;
- unload)
- echo "Removing V4L/DVB modules from kernel"
- rmmod b2c2-flexcop-usb b2c2-flexcop-pci b2c2-flexcop dvb-ttpci budget \
- budget-av budget-ci budget-core ttusb_dec dvb-ttusb-budget \
- ttpci-eeprom dvb-usb-nova-t-usb2.ko dvb-usb-a800.ko \
- dvb-usb-umt-010.ko dvb-usb-dibusb-mc.ko dvb-usb-dibusb-mb.ko\
- dvb-usb-dibusb-common.ko dvb-usb-vp7045.ko \
- dvb-usb-dtt200u.ko dvb-usb-digitv.ko dvb-usb-cxusb.ko \
- dvb-usb.ko
-# video4linux cards
- rmmod cx88-alsa cx88-blackbird cx88-dvb cx88-vp3054-i2c cx8802 cx8800 \
- cx88xx saa7134-oss saa7134-alsa saa7134-empress saa7134-dvb \
- saa7134 dvb-bt8xx dst_ca dst bt878 bttv bt832 mxb \
- hexium_gemini hexium_orion em28xx pvrusb2 cpia2 vivi
-
-# frontends
- rmmod dib3000mb zl10353 dib3000mc dib3000_common nxt200x ves1x93 \
- sp8870 cx22700 stv0299 ves1820 cinergyT2 ttusbdecfe \
- tda1004x l64781 tda8083 cx24110 cx22702 stv0297 \
- tda10021 mt352 mt312 bcm3510 s5h1420 nxt6000 \
- stv0297_cs2 lgdt330x cx24123 sp887x or51211 or51132 \
- dvb-pll
-
-# chips and helpers
- rmmod saa7127 msp3400 tvp5150 tda7432 tda9840 tda9875 tea6415c tea6420 \
- saa6752hs saa6588 btcx-risc tveeprom tvaudio tda9887 tuner \
- ir-kbd-i2c ir-common cx25840 tvmixer cs53l32a wm8775 saa7115 \
- saa7146_vv saa7146 video-buf-dvb video-buf \
- v4l2-common v4l1-compat dvb-core videodev compat_ioctl32
-
- echo
- ;;
- reload)
- $0 unload && $0 load
- ;;
- *)
- echo "Usage$0 {load|unload|debug|reload}"
- exit 1
-esac
-
-sync
diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl
index b1d6f5d53..d5b34b36c 100755
--- a/v4l/scripts/make_kconfig.pl
+++ b/v4l/scripts/make_kconfig.pl
@@ -4,20 +4,156 @@ use FileHandle;
my %depend = ();
my %minver = ();
my %config = ();
+my %intopt = ();
+my %hexopt = ();
+my %tristate = ();
+my %kernopts = ();
+my %depmods = ();
my $version, $level, $sublevel;
+my $kernel=shift;
+my $force_kconfig=shift;
+
+#!/usr/bin/perl
+use FileHandle;
+
+###########################################################
+# Checks config.h and autoconf.h for current kernel defines
+sub process_config ($)
+{
+ my $filename = shift;
+ my $in = new FileHandle;
+
+ open $in,"$kernel/include/$filename" or die "File not found: $kernel/include/$filename";
+ while (<$in>) {
+ if (m|\#include\s+\<(.*)\>|) {
+ process_config ($1);
+ next;
+ }
+ if (m/\#define\s+CONFIG_([^ ]*)_ON_SMP\s+(.*)\n/) {
+ my $key=$1;
+ my $value=$2;
+# printf "defined $key as $value\n";
+ if ( $value == 1 ) {
+ $value='y';
+ }
+ $kernopts{$key}=$value;
+ next;
+ }
+ if (m/\#define\s+CONFIG_([^ ]*)_MODULE\s+(.*)\n/) {
+ my $key=$1;
+ my $value=$2;
+# printf "defined $key as $value\n";
+ if ( $value == 1 ) {
+ $value='m';
+ }
+ $kernopts{$key}=$value;
+ next;
+ }
+ if (m/\#define\s+CONFIG_([^ ]*)\s+(.*)\n/) {
+ my $key=$1;
+ my $value=$2;
+# printf "defined $key as $value\n";
+ if ( $value == 1 ) {
+ $value='y';
+ }
+ $kernopts{$key}=$value;
+ next;
+ }
+ if (m/\#undef\s+CONFIG_([^ ]*)\n/) {
+# printf "undefined $1\n";
+ $kernopts{$1}='n';
+ next;
+ }
+ }
+
+ close $in;
+}
+
+sub add_bool($)
+{
+ my $arg=shift;
+
+ exists $config{$arg} or die "Adding unknown boolean '$arg'";
+ $tristate{$arg}="bool";
+# printf "Boolean:%s\n",$arg;
+
+ $kernopts{$arg}='y';
+}
+
+sub add_tristate($)
+{
+ my $arg=shift;
+
+ exists $config{$arg} or die "Adding unknown tristate '$arg'";
+ $tristate{$arg}="tristate";
+
+ $kernopts{$arg}='m';
+}
+
+sub add_int($)
+{
+ my $arg=shift;
+
+ exists $config{$arg} or die "Adding unknown int '$arg'";
+ $intopt{$arg} = 0;
+}
+
+sub add_hex($)
+{
+ my $arg=shift;
+
+ exists $config{$arg} or die "Adding unknown hex '$arg'";
+ $hexopt{$arg} = 0;
+}
+
+sub set_int_value($$)
+{
+ my $key = shift;
+ my $val = shift;
+
+ exists $intopt{$key} or die "Default for unknown int option '$key'";
+ $intopt{$key} = $val;
+}
+
+sub set_hex_value($$)
+{
+ my $key = shift;
+ my $val = shift;
+
+ exists $hexopt{$key} or die "Default for unknown hex option '$key'";
+ $hexopt{$key} = "0x".$val;
+}
+
sub add_config($)
{
my $arg=shift;
- if ($arg =~ m/^([A-Z0-9_]+)/) {
+ if ($arg =~ m/^(\w+)/) {
+ # Have option default to 'on'
$config{$1} = 1;
+ } else {
+ die "Do not understand config variable '$arg'";
}
}
-sub check_deps($)
+########################################
+# Turn option off, iff it already exists
+sub disable_config($)
{
+ my $key = shift;
+
+ $config{$key} = 0 if (exists $config{$key});
+}
+
+#################################################################
+# Make a list of dependencies and the number of references for it
+sub check_deps($$)
+{
+ my $key=shift;
my $arg=shift;
+
+ $depmods{$key}=$arg;
$arg=$arg." ";
while ($arg ne "") {
@@ -28,32 +164,122 @@ sub check_deps($)
}
$arg =~ s/^[^ ]+ //;
}
+
+ return $ok;
+}
+
+######################################################
+# Checks if all dependencies for the key are satisfied
+sub deps_ok($)
+{
+ my $key=shift;
+ my $arg=$depmods{$key};
+ my $ok=1;
+
+ if ($arg eq "") {
+ return $ok;
+ }
+
+ $arg=$arg." ";
+
+
+# printf "$key: deps are '$arg'\n";
+
+ while ($arg ne "") {
+ if ($arg =~ m/^([A-Z0-9_]+) /) {
+ if ((! exists $kernopts {$1}) || ($kernopts {$1} eq 'n')) {
+ printf "$key: Required kernel opt '$1' is not present\n";
+ $ok=0;
+ }
+ }
+ if ($arg =~ m/^\!([A-Z0-9_]+) /) {
+ if ($kernopts {$1} eq 'y') {
+ printf "$key: Driver is incompatible with '$1'\n";
+ $ok=0;
+ }
+ }
+ $arg =~ s/^[^ ]+ //;
+ }
+
+ return $ok;
}
sub open_kconfig($$) {
my ($dir,$file)=@_;
my $in = new FileHandle;
- my $skip=0;
+ my $disabled=0;
+ my $key;
#print "opening $file\n";
- open $in,"$file";
+ open $in,"$file" or die "File not found: $file";
while (<$in>) {
# if (m;^\s*source[\s\"]+drivers/media/(video|dvb)/Kconfig;) {
# next;
# }
- if (m|^\s*source[\s\"]+([^\n\s\"]+)[\n\s\"]|) {
+
+ # start of a new stanza, reset
+ if (m/^\w/) {
+ $disabled = 0;
+ $default_seen = 0;
+ $key = undef;
+ }
+
+ if (m|^\s*source\s+"([^"]+)"\s*$| ||
+ m|^\s*source\s+(\S+)\s*$|) {
open_kconfig($dir,"$dir/$1");
next;
}
- if (m|^\s+depends on (.*)\n|) {
- check_deps ($1);
+ if (m|^\s+depends on\s+(.*)\n|) {
+ check_deps ($key,$1);
}
- if (m|^\s+select (.*)\n|) {
- check_deps ($1);
+ if (m|^\s+select\s+(.*)\n|) {
+ check_deps ($key,$1);
+ }
+ if (m|^\s+bool(ean)?\s|) {
+ add_bool($key);
+ }
+ if (m|^\s+tristate\s|) {
+ add_tristate($key);
+ }
+ if (m|^\s+int\s|) {
+ add_int($key);
+ }
+ if (m|^\s+hex\s|) {
+ add_hex($key);
+ }
+ # Get default for int options
+ if (m|^\s+default "(\d+)"| && exists $intopt{$key}) {
+ set_int_value($key, $1);
+ }
+ # Get default for hex options
+ if (m|^\s+default "(0x)?([[:xdigit:]]+)"| && exists $hexopt{$key}) {
+ set_hex_value($key, $2);
+ }
+ # Override default for disabled tri/bool options
+ if (m/^\s+default (y|n|m|"yes"|"no")\s+(if .*)?$/ &&
+ exists $tristate{$key} && $disabled) {
+ $default_seen = 1;
+ $_ = "\tdefault n\n";
+ }
+ # check for end of config definition for disabled drivers
+ # we need to make sure we've disabled it, and add a bit
+ # to the help text
+ if (m|^\s*(---)?help(---)?\s*$| && $disabled) {
+ if(exists $tristate{$key} && !$default_seen) {
+ print OUT "\tdefault n\n";
+ }
+ print OUT <<"EOF";
+ depends on VIDEO_KERNEL_VERSION
+ help
+ WARNING! This driver needs at least kernel $minver{$key}! It may not
+ compile or work correctly on your kernel, which is too old.
+
+EOF
+ next;
}
- if (m|^\s*config (.*)\n|) {
- my $key=$1;
+ if (m|^\s*config (\w+)\s*$|) {
+ $key=$1;
add_config ($1);
my $min=$minver { $key };
@@ -65,27 +291,22 @@ sub open_kconfig($$) {
} else {
die "Minimum version for $key not found at versions.txt";
}
- if ( ($version < $minversion) |
- ($level < $minlevel) |
+ if ( ($version < $minversion) ||
+ ($level < $minlevel) ||
($sublevel < $minsublevel) ) {
- $skip=1;
- printf "$key requires version $minversion.$minlevel.$minsublevel\n";
-
- print OUT "# $key disabled due to incorrect version\nconfig $key\n\ttristate\n\tdefault n\n\n";
- next;
+ $disabled=1;
+ disable_config ($key);
+ print "$key requires version $minversion.$minlevel.$minsublevel\n";
+ print OUT "# $key disabled for insufficient kernel version\n";
} else {
-# printf "OK: $key requires version $minversion.$minlevel.$minsublevel\n";
- $skip=0;
+# print "OK: $key requires version $minversion.$minlevel.$minsublevel\n";
+ $disabled=0;
}
}
s/^main(menu\s\"[^\"]+)/\1 - DON'T CHANGE IT!/;
- if (m/^[\w]/) {
- $skip=0;
- }
- if (!$skip) {
- print OUT $_;
- }
+
+ print OUT $_;
}
close $in;
}
@@ -95,7 +316,7 @@ sub parse_versions ()
my $in = new FileHandle;
my $ver;
- open $in,"versions.txt";
+ open $in,"versions.txt" or die "File not found: versions.txt";
while (<$in>) {
if (m/\[([\d.]*)\]/) {
$ver=$1;
@@ -110,9 +331,11 @@ sub parse_versions ()
close $in;
}
+process_config("linux/config.h");
+
parse_versions;
-open IN,".version";
+open IN,".version" or die "File not found: .version";
while (<IN>) {
if (m/KERNELRELEASE\s*[:]*[=]+\s*(\d+)\.(\d+)\.(\d+)/) {
$version=$1;
@@ -124,24 +347,126 @@ close IN;
printf "Preparing to compile for kernel version %d.%d.%d\n",$version,$level,$sublevel;
-open OUT,">Kconfig";
-print OUT "mainmenu \"V4L/DVB menu\"\n";
+open OUT,">Kconfig" or die "Cannot write Kconfig file";
-print OUT "source Kconfig.kern\n";
-open_kconfig ("../linux","../linux/drivers/media/Kconfig");
+print OUT <<"EOF";
+mainmenu "V4L/DVB menu"
+source Kconfig.kern
+config VIDEO_KERNEL_VERSION
+ bool "Enable drivers not supported by this kernel"
+ default n
+ ---help---
+ Normally drivers that require a kernel newer $version.$level.$sublevel,
+ the kernel you are compiling for now, will be disabled.
+
+ Turning this switch on will let you enabled them, but be warned
+ they may not work properly or even compile.
+
+ They may also work fine, and the only reason they are listed as
+ requiring a newer kernel is that no one has tested them with an
+ older one yet.
+
+ If the driver works, please post a report at V4L mailing list:
+ video4linux-list\@redhat.com.
+
+ Unless you know what you are doing, you should answer N.
+
+EOF
+open_kconfig ("../linux","../linux/drivers/media/Kconfig");
close OUT;
while ( my ($key, $value) = each(%config) ) {
delete $depend{$key};
}
-open OUT,">Kconfig.kern";
+open OUT,">Kconfig.kern" or die "Cannot write Kconfig.kern file";
print OUT "config MODULES\n\tboolean\n\tdefault y\n\n";
+add_config('MODULES');
+add_bool('MODULES');
while ( my ($key, $value) = each(%depend) ) {
- print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault m\n\n";
+ if ($kernopts{$key}) {
+ print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault ".
+ $kernopts{$key}."\n\n";
+ } else {
+ print OUT "# $key with $value refs\nconfig $key\n\ttristate\n\tdefault n #not found\n\n";
+ }
}
close OUT;
+# These options should default to off
+disable_config('DVB_AV7110_FIRMWARE');
+disable_config('DVB_CINERGYT2_TUNING');
+
+# Hack for check sound/oss/aci.h header
+
+my $mirodep="$kernel/sound/oss/aci.h";
+if (!open IN, $mirodep) {
+ my $key="RADIO_MIROPCM20";
+print <<"EOF2";
+$key: $mirodep is missing.
+
+***WARNING:*** You do not have the full kernel sources installed.
+This does not prevent you from building the v4l-dvb tree if you have the
+kernel headers, but the full kernel source is required in order to use
+make menuconfig / xconfig / qconfig.
+
+If you are experiencing problems building the v4l-dvb tree, please try
+building against a vanilla kernel before reporting a bug.
+
+Vanilla kernels are available at http://kernel.org.
+On most distros, this will compile a newly downloaded kernel:
+
+cp /boot/config-`uname -r` <your kernel dir>/.config
+cd <your kernel dir>
+make all modules_install install
+
+Please see your distro's web site for instructions to build a new kernel.
+
+EOF2
+ $kernopts{$key}='n';
+}
+close IN;
+
+# Recursively check for broken dependencies
+my $i;
+do {
+ $i=0;
+ while ( my ($key,$value) = each(%kernopts) ) {
+ if ($value ne 'n') {
+ if (!deps_ok($key)) {
+ $kernopts{$key}='n';
+ }
+ $i=$i+1;
+ }
+ }
+} until (!$disable);
+
+# Produce a .config file if it's forced or one doesn't already exist
+if (($force_kconfig eq 1) || !open IN,".config") {
+ open OUT,">.config" or die "Cannot write .config file";
+ while ( my ($key,$value) = each(%tristate) ) {
+ if (!$config{$key}) {
+ print OUT "# CONFIG_$key is not set\n";
+ } elsif ($kernopts{$key}) {
+ if ($kernopts{$key} eq 'n') {
+ print OUT "# CONFIG_$key is not set\n";
+ } else {
+ print OUT "CONFIG_$key=".$kernopts{$key}."\n";
+ }
+ } elsif ($value eq 'tristate') {
+ print OUT "CONFIG_$key=m\n";
+ } else { # must be 'bool'
+ print OUT "CONFIG_$key=y\n";
+ }
+ }
+ while ( my ($key,$value) = each(%intopt) ) {
+ print OUT "CONFIG_$key=$value\n";
+ }
+ while ( my ($key,$value) = each(%hexopt) ) {
+ print OUT "CONFIG_$key=$value\n";
+ }
+ close OUT;
+}
diff --git a/v4l/scripts/make_makefile.pl b/v4l/scripts/make_makefile.pl
index 8371f6a4a..e0a099e9b 100755
--- a/v4l/scripts/make_makefile.pl
+++ b/v4l/scripts/make_makefile.pl
@@ -1,6 +1,7 @@
#!/usr/bin/perl
use FileHandle;
+my $kernel=shift;
my $instdir = ();
sub check_line($$$)
@@ -109,12 +110,13 @@ sub open_makefile($) {
close $in;
}
-open OUT,">Makefile.media";
+open OUT,">Makefile.media.new";
open_makefile ("../linux/drivers/media/Makefile");
# Creating Install rule
-printf OUT "install::\n";
-#printf OUT "\t@strip --strip-debug \$(inst-m)\n\n";
+printf OUT "media-install::\n";
+printf OUT "\t\@echo \"Stripping debug info from files:\"\n";
+printf OUT "\t\@strip --strip-debug \$(inst-m)\n\n";
while ( my ($key, $value) = each(%instdir) ) {
printf OUT "\t\@echo -e \"\\nInstalling \$(KDIR26)/$key files:\"\n";
@@ -127,7 +129,7 @@ while ( my ($key, $value) = each(%instdir) ) {
printf OUT "\t/sbin/depmod -a \${KERNELRELEASE}\n\n";
# Creating Remove rule
-printf OUT "remove rminstall::\n";
+printf OUT "media-rminstall::\n";
printf OUT "\t\@echo -e \"\\nRemoving old \$(DEST) files\\n\"\n";
while ( my ($key, $value) = each(%instdir) ) {
@@ -155,10 +157,30 @@ while ( my ($key, $value) = each(%depend) ) {
}
close OUT;
-if (open OUT,".myconfig") {
+if (open IN,"Makefile.media") {
close IN;
+ my $changed=0;
+ if (open IN,"diff Makefile.media Makefile.media.new|") {
+ while (<IN>) {
+ if ($_ ne "") {
+ $changed=1;
+ }
+ }
+ close IN;
+ if ($changed) {
+ printf("One or more linux Makefiles had changed. Makefile.media rewrited.\n");
+ system ("mv Makefile.media.new Makefile.media");
+ } else {
+ system ("rm Makefile.media.new");
+ }
+ }
} else {
- system "make allmodconfig";
+ printf("Creating Makefile.media.\n");
+ system "mv Makefile.media.new Makefile.media";
}
-
+if (open IN,".myconfig") {
+ close IN;
+} else {
+ system "./scripts/make_kconfig.pl $kernel 1";
+}
diff --git a/v4l/scripts/make_myconfig.pl b/v4l/scripts/make_myconfig.pl
new file mode 100755
index 000000000..0bde6f6c0
--- /dev/null
+++ b/v4l/scripts/make_myconfig.pl
@@ -0,0 +1,58 @@
+#!/usr/bin/perl
+
+# The purpose of this script is to produce a file named '.myconfig', in
+# the same style as the '.config' file. Except .myconfig has disabled
+# options explicitly set to 'n' rather than just omitted. This is to
+# make sure they override any corresponding options that may be turned on
+# in the Kernel's config files.
+# The .myconfig file is what will be included in the v4l-dvb Makefile
+# to control which drivers are built.
+
+my %config = ();
+my %allconfig = ();
+
+open IN,".config";
+while (<IN>) {
+ if (m/\s*(\w+)=\s*(\S*)/) {
+#printf "%s=%s\n",$1,$2;
+ $config { $1 } = $2;
+ }
+}
+close IN;
+
+# Build table of _all_ bool and tristate config variables
+my $key = 0;
+open IN,"Kconfig";
+while (<IN>) {
+ if (/^config\s+(\w+)\s*$/) {
+ $key == 0 or die "Couldn't find type of config '$key'";
+ $key = "CONFIG_$1";
+ } elsif (/^\s+bool(ean)?\s/) {
+ $allconfig{$key} = 'bool';
+ $key = 0;
+ } elsif (/^\s+tristate\s/) {
+ $allconfig{$key} = 'tristate';
+ $key = 0;
+ } elsif (/^\s+(int|hex|string)\s/) {
+ $allconfig{$key} = 'data';
+ $key = 0;
+ }
+}
+close IN;
+
+exists $allconfig{0} and die "Unable to correctly parse Kconfig file";
+
+# Produce output for including in a Makefile
+# Explicitly set bool/tri options that didn't appear in .config to n
+# 'data' options are only output if they appeared in .config
+open OUT,">.myconfig";
+while ( my ($key, $value) = each(%allconfig) ) {
+ if ($value eq 'data') {
+ next unless (exists $config{$key});
+ $value = $config{$key};
+ } else {
+ $value = exists $config{$key} ? $config{$key} : 'n';
+ }
+ printf OUT "%-44s := %s\n",$key,$value;
+}
+close OUT;
diff --git a/v4l/scripts/make_noconfig.pl b/v4l/scripts/make_noconfig.pl
deleted file mode 100755
index a47ca4acf..000000000
--- a/v4l/scripts/make_noconfig.pl
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/perl
-
-my $config = ();
-
-open IN,".config";
-while (<IN>) {
- if (m/\s*([\d\w_]+)[=](.*)\n/) {
-#printf "%s=%s\n",$1,$2;
- $config { $1 } = $2;
- }
-}
-close IN;
-
-open IN,".version";
-while (<IN>) {
- if (m/KERNELRELEASE\s*[:]*[=]+\s*(\d+)\.(\d+)\.(\d+)/) {
- $version=$1;
- $level=$2;
- $sublevel=$3;
- }
-}
-close IN;
-
-open IN,"versions.txt";
-while (<IN>) {
- if (m/\[(\d+)\.(\d+)\.(\d+)\]/) {
- $minversion=$1;
- $minlevel=$2;
- $minsublevel=$3;
- next;
- }
- s/\n//;
-
- if (m/DVB_AV7110_FIRMWARE/) {
- next;
- }
- if (m/DVB_AV7110_FIRMWARE_FILE/) {
- next;
- }
- if (m/^\s*([\w\d_]+)/) {
- if ( ($version < $minversion) |
- ($level < $minlevel) |
- ($sublevel < $minsublevel) ) {
- $config { "CONFIG_$1" } = 'n';
-#print "CONFIG_$1 version is not supported\n";
- next;
- }
- if (!($config { "CONFIG_$1" } ) ) {
-print "CONFIG_$1 is unset\n";
- $config { "CONFIG_$1" } = 'n';
- }
- }
-}
-close IN;
-
-open OUT,">.myconfig";
-while ( my ($key, $value) = each(%config) ) {
- if ($value eq "y") {
- $value="m";
- }
- printf OUT "%-44s := %s\n",$key,$value;
-}
-close OUT;
diff --git a/v4l/scripts/makelinks.sh b/v4l/scripts/makelinks.sh
index a66989771..187145822 100755
--- a/v4l/scripts/makelinks.sh
+++ b/v4l/scripts/makelinks.sh
@@ -5,7 +5,7 @@ if test -z $1 || ! test -d $1 ; then
echo
echo " usage: $0 <path_to_kernel_to_patch>"
echo
- exit
+ exit
fi
echo "patching $1..."
@@ -14,15 +14,15 @@ cd linux
PWD=`pwd`
for x in `find drivers -type d | grep -v CVS` ; do
- mkdir -p -v $1/$x
+ mkdir -p -v $1/$x
done
for x in `find Documentation -type d | grep -v CVS` ; do
- mkdir -p -v $1/$x
+ mkdir -p -v $1/$x
done
for x in `find include -type d | grep -v CVS` ; do
- mkdir -p -v $1/$x
+ mkdir -p -v $1/$x
done
for x in `find Documentation -type f | grep -v CVS | grep -v .cvsignore` ; do
@@ -39,10 +39,12 @@ done
for x in `find include -type d | grep -v CVS` ; do
ln -f -s $PWD/../v4l/compat.h $1/$x/compat.h
+ touch $1/$x/config-compat.h
done
for x in `find drivers/media -type d | grep -v CVS` ; do
ln -f -s $PWD/../v4l/compat.h $1/$x/compat.h
+ touch $1/$x/config-compat.h
done
cd ..
diff --git a/v4l/scripts/prep_commit_msg.pl b/v4l/scripts/prep_commit_msg.pl
index ac958667b..a4594c7f9 100755
--- a/v4l/scripts/prep_commit_msg.pl
+++ b/v4l/scripts/prep_commit_msg.pl
@@ -1,34 +1,59 @@
#!/usr/bin/perl
-$f=shift;
-open IN,"hg diff|diffstat -p1 |";
-my $n=2;
-my $from="";
-my $first="";
-my $changed="";
-$out="";
-while (<IN>) {
- $changed="$changed#$_";
-}
+my $autopatch = shift;
+# Get Hg username from environment
my $user = $ENV{HGUSER};
-if ( $user eq "" ) {
+# Didn't work? Try the .hgrc file
+if ($user eq "") {
+ open IN, "<$ENV{HOME}/.hgrc";
+ while (<IN>) {
+ if(/^\s*username\s*=\s*(\S.*)$/) {
+ $user = $1;
+ last;
+ }
+ }
+ close IN;
+}
+
+# Still no luck? Try some other environment variables
+if ($user eq "") {
my $name = $ENV{CHANGE_LOG_NAME};
my $email = $ENV{CHANGE_LOG_EMAIL_ADDRESS};
+ $user = "$name <$email>" if ($name ne "" || $email ne "");
+}
+
+# Last try to come up with something
+if ($user eq "") {
+ $user = "$ENV{USER} <>";
+}
- $user="$name <$email>";
+print "# Added/removed/changed files:\n";
+system "hg diff | diffstat -p1 -c";
+if (-s $autopatch) {
+ print "#\n# Note, a problem with your patch was detected! These changes were made\n";
+ print "# automatically: $autopatch\n";
+ system "diffstat -p0 -c $autopatch";
+ print "#\n# Please review these changes and see if they belong in your patch or not.\n";
}
+print <<"EOF";
+#
+# For better log display, please keep a blank line after subject, after from,
+# and before signed-off-by.
+# First line should be the subject, without Subject:
+#
+
+
+# Now, patch author (just the main one), on a From: field
+# Please change below if the committer is not the patch author.
+#
+From: $user
+
+# Then a detailed description:
+
-$first= "# Please change below if you are not patch author\n#\nFrom: $user";
-$out= "# At the end Signed-off-by: fields by patch author and committer, at least\n#\nSigned-off-by: $user";
-$from= "From: $user";
-
-printf "#Added/removed/changed files:\n%s#\n" .
- "# For better log display, please keep a blank line after subject, after from\n" .
- "# and before signed-off-by\n" .
- "# First line should be the subject, without Subject:\n#\n\n\n" .
- "# Now, patch author (just the main one), on a From: field\n" .
- "# Please change below if the committer is not the patch author\n#\n%s\n\n" .
- "# Then a detailed description:\n\n\n%s",
- $changed,$from,$out;
+# At the end Signed-off-by: fields by patch author and committer, at least.
+#
+Signed-off-by: $user
+EOF
diff --git a/v4l/scripts/rmmod.pl b/v4l/scripts/rmmod.pl
new file mode 100755
index 000000000..19a0a8c61
--- /dev/null
+++ b/v4l/scripts/rmmod.pl
@@ -0,0 +1,194 @@
+#!/usr/bin/perl
+use strict;
+use File::Find;
+
+my %depend = ();
+my %depend2 = ();
+my %rmlist = ();
+my @nodep;
+my @modlist;
+my @allmodules;
+my %reqmodules;
+my %loaded = ();
+my $i=0;
+
+# Device debug parameters
+# Module name Debug option
+my %debug = ( "tuner" => "tuner_debug=1",
+ "dvb-core" => "cam_debug=1",
+ "dvb-ttpci" => "debug=247",
+ "b2c2-flexcop" => "debug=0x01",
+ "b2c2-flexcop-usb" => "debug=0x01",
+ "b2c2-flexcop-pci" => "debug=0x01",
+ "dvb-usb" => "debug=0x33",
+ "dvb-usb-gp8psk" => "debug=0x03",
+ "dvb-usb-vp7045" => "debug=0x03",
+ "dvb-usb-dtt200u" => "debug=0x03",
+ "dvb-usb-dibusb-common" => "debug=0x03",
+ );
+
+
+sub parse_dir {
+ my $file = $File::Find::name;
+
+ if (!($file =~ /[.]ko$/)) {
+ return;
+ }
+
+ my $module = $file;
+ $module =~ s|^[./]*(.*)[.]ko|\1|;
+
+ open IN, "modinfo $file|grep depends|cut -b 17-|";
+ while (<IN>) {
+ my $deps = $_;
+ $deps =~ s/\n//;
+ $deps =~ s/[,]/ /g;
+ $deps = " $deps ";
+ $depend{$module} = $deps;
+ push @allmodules, $module;
+ $i++;
+ }
+ close IN;
+}
+
+sub parse_loaded {
+ open IN, "/proc/modules";
+ while (<IN>) {
+ m/^([\w\d_-]+)/;
+ $loaded{$1}=1;
+ }
+ close IN;
+}
+
+sub cleandep()
+{
+ my $dep;
+
+ while ( my ($k, $v) = each(%depend) ) {
+ my $arg=$v;
+ my $arg2=" ";
+ while (!($arg =~ m/^\s*$/)) {
+ if ($arg =~ m/^ ([^ ]+) /) {
+ my $val=$1;
+ if (exists($depend{$val})) {
+ $arg2="$arg2 $val ";
+ } else {
+ $reqmodules{$val}=1;
+ }
+ }
+ $arg =~ s/^ [^ ]+//;
+ $arg2 =~ s/\s\s+/ /;
+ }
+ $depend2 { $k } = $arg2;
+ }
+
+}
+
+sub rmdep()
+{
+ my $dep;
+
+ while ($dep=pop @nodep) {
+ while ( my ($k, $v) = each(%depend2) ) {
+ if ($v =~ m/\s($dep)\s/) {
+ $v =~ s/\s${dep}\s/ /;
+ $v =~ s/\s${dep}\s/ /;
+ $v =~ s/\s${dep}\s/ /;
+ $depend2 {$k} = $v;
+ }
+ }
+ }
+}
+
+sub orderdep ()
+{
+ my $old;
+ do {
+ $old=$i;
+ while ( my ($key, $value) = each(%depend2) ) {
+ if ($value =~ m/^\s*$/) {
+ push @nodep, $key;
+ push @modlist, $key;
+ $i=$i-1;
+ delete $depend2 {$key};
+ }
+ }
+ rmdep();
+ } until ($old==$i);
+ while ( my ($key, $value) = each(%depend2) ) {
+ printf "ERROR: bad dependencies - $key ($value)\n";
+ }
+}
+
+sub insmod ($)
+{
+ my $debug=shift;
+
+ while ( my ($key, $value) = each(%reqmodules) ) {
+ printf ("modprobe $key\n");
+ system ("modprobe $key");
+ }
+
+ foreach my $key (@modlist) {
+ if ($debug) {
+ my $dbg=$debug{$key};
+
+ printf "insmod ./$key.ko $dbg\n";
+ system "insmod ./$key.ko $dbg\n";
+ } else {
+ printf "insmod ./$key.ko\n";
+ system "insmod ./$key.ko\n";
+ }
+ }
+}
+
+sub rmmod ()
+{
+ while (my $key=pop @modlist) {
+ my $dep=$key;
+ $dep=~s/[\-]/_/g;
+ if (exists ($loaded{$dep})) {
+ printf "rmmod $dep\n";
+ system "rmmod $dep\n";
+ }
+ }
+}
+
+sub prepare_cmd()
+{
+ find(\&parse_dir, ".");
+ printf "found $i modules\n";
+
+ cleandep();
+ orderdep();
+}
+
+# main
+my $mode=shift;
+if ($mode eq "load") {
+ prepare_cmd;
+ insmod(0);
+} else {
+ if ($mode eq "unload") {
+ prepare_cmd;
+ parse_loaded;
+ rmmod;
+ } else {
+ if ($mode eq "reload") {
+ prepare_cmd;
+ parse_loaded;
+ my @modlist2=@modlist;
+ rmmod;
+ @modlist=@modlist2;
+ insmod(0);
+ } else {
+ if ($mode eq "debug") {
+ prepare_cmd;
+ parse_loaded;
+ insmod(1);
+ } else {
+ printf "Usage: $0 [load|unload|reload]\n";
+ }
+ }
+ }
+}
diff --git a/v4l/scripts/strip-trailing-whitespaces.sh b/v4l/scripts/strip-trailing-whitespaces.sh
index 1a23e436d..a546a0b9f 100755
--- a/v4l/scripts/strip-trailing-whitespaces.sh
+++ b/v4l/scripts/strip-trailing-whitespaces.sh
@@ -1,37 +1,28 @@
#!/bin/sh
+# Strips trailing whitespace. Leading spaces and spaces after tabs are
+# converted to the equivalent sequence of tabs only.
-# tmp dir for my files
-WORK="${TMPDIR-/tmp}/${0##*/}-$$"
-mkdir "$WORK" || exit 1
-trap 'rm -rf "$WORK"' EXIT
+# Use the option "fast" to only check files Hg thinks are new or modified.
+# The option "manifest" will use Hg's manifest command to check all files
+# under Hg revision control.
+# Otherwise, all files under the linux tree are checked, except files in CVS
+# directories and .cvsignore files. This is the historical behavior.
-for file in `find linux -type d | grep -v CVS | grep -v .cvsignore` ; do
- mkdir -p "$WORK/${file}"
-done
-for file in `find linux -type f | grep -v CVS | grep -v .cvsignore` ; do
- tmpfile="$WORK/${file}.$$"
- perl -ne 's/[ \t]+$//;
- s/^\ \ \ \ \ \ \ \ /\t/;
- s/^\ \ \ \ \ \ \ \t/\t/;
- s/^\ \ \ \ \ \ \t/\t/;
- s/^\ \ \ \ \ \t/\t/;
- s/^\ \ \ \t/\t/;
- s/^\ \ \t/\t/;
- s/^\ \t/\t/;
- $m=1;
- while ($m>0) {
- $m=0;
- $m= s/\t\ \ \ \ \ \ \ \ /\t\t/g;
- $m=$m+s/\t\ \ \ \ \ \ \ \t/\t\t/g;
- $m=$m+s/\t\ \ \ \ \ \ \t/\t\t/g;
- $m=$m+s/\t\ \ \ \ \ \t/\t\t/g;
- $m=$m+s/\t\ \ \ \t/\t\t/g;
- $m=$m+s/\t\ \ \t/\t\t/g;
- $m=$m+s/\t\ \t/\t\t/g;
- }
- print' < "${file}" > "${tmpfile}"
- diff -u "${file}" "${tmpfile}" | sed \
- -e "s|^--- ${file}|--- ${file}.orig|" \
- -e "s|^+++ ${tmpfile}|+++ ${file}|"
- rm -f "$tmpfile"
+
+if [ "x$1" = "xfast" ]; then
+ files="hg status -man"
+elif [ "x$1" = "xmanifest" ]; then
+ files="hg manifest | cut '-d ' -f3"
+else
+ files="find linux -name CVS -prune -o -type f -not -name .cvsignore -print"
+fi
+
+for file in `eval $files`; do
+ perl -ne '
+ s/[ \t]+$//;
+ s<^ {8}> <\t>;
+ s<^ {1,7}\t> <\t>;
+ while( s<\t {8}> <\t\t>g || s<\t {1,7}\t> <\t\t>g ) {};
+ print' < "${file}" | \
+ diff -u --label="$file" "$file" --label="$file" -
done
diff --git a/v4l/scripts/tuner.pl b/v4l/scripts/tuner.pl
index fcfa22e26..104c16dae 100755
--- a/v4l/scripts/tuner.pl
+++ b/v4l/scripts/tuner.pl
@@ -8,12 +8,17 @@ my %data;
my $H = shift;
my $C = shift;
+my %blacklist;
open IN, "<$H";
while (<IN>) {
# defines in header file
if (/#define\s+(TUNER_\w+)\s+(\d+)/) {
- $data{$1}->{nr} = $2;
+ my $num=$2;
+ $data{$1}->{nr} = $num;
+ if (/#define\s+TUNER_TDA9887/) {
+ $blacklist{$num}=1;
+ }
next;
}
}
@@ -37,6 +42,10 @@ while (<IN>) {
}
foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
+ if ($blacklist{$data{$item}->{nr}}) {
+ next;
+ }
+
printf("tuner=%d - %s", $data{$item}->{nr}, $data{$item}->{name});
print "\n";
}