~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/get_dvb_firmware

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/get_dvb_firmware (Version linux-6.12-rc7) and /scripts/get_dvb_firmware (Version linux-4.11.12)


  1 #!/usr/bin/env perl                            !!   1 #!/usr/bin/perl
  2 # SPDX-License-Identifier: GPL-2.0-or-later    << 
  3 #     DVB firmware extractor                        2 #     DVB firmware extractor
  4 #                                                   3 #
  5 #     (c) 2004 Andrew de Quincey                    4 #     (c) 2004 Andrew de Quincey
  6 #                                                   5 #
                                                   >>   6 #     This program is free software; you can redistribute it and/or modify
                                                   >>   7 #       it under the terms of the GNU General Public License as published by
                                                   >>   8 #       the Free Software Foundation; either version 2 of the License, or
                                                   >>   9 #       (at your option) any later version.
                                                   >>  10 #
                                                   >>  11 #     This program is distributed in the hope that it will be useful,
                                                   >>  12 #       but WITHOUT ANY WARRANTY; without even the implied warranty of
                                                   >>  13 #       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                                                   >>  14 #
                                                   >>  15 #     GNU General Public License for more details.
                                                   >>  16 #
                                                   >>  17 #     You should have received a copy of the GNU General Public License
                                                   >>  18 #       along with this program; if not, write to the Free Software
                                                   >>  19 #       Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  7                                                    20 
  8 use File::Temp qw/ tempdir /;                      21 use File::Temp qw/ tempdir /;
  9 use IO::Handle;                                    22 use IO::Handle;
 10                                                    23 
 11 @components = ( "sp8870", "sp887x", "tda10045"     24 @components = ( "sp8870", "sp887x", "tda10045", "tda10046",
 12                 "tda10046lifeview", "av7110",      25                 "tda10046lifeview", "av7110", "dec2000t", "dec2540t",
 13                 "dec3000s", "vp7041", "vp7049"     26                 "dec3000s", "vp7041", "vp7049", "dibusb", "nxt2002", "nxt2004",
 14                 "or51211", "or51132_qam", "or5     27                 "or51211", "or51132_qam", "or51132_vsb", "bluebird",
 15                 "opera1", "cx231xx", "cx18", "     28                 "opera1", "cx231xx", "cx18", "cx23885", "pvrusb2", "mpc718",
 16                 "af9015", "ngene", "az6027", "     29                 "af9015", "ngene", "az6027", "lme2510_lg", "lme2510c_s7395",
 17                 "lme2510c_s7395_old", "drxk",      30                 "lme2510c_s7395_old", "drxk", "drxk_terratec_h5",
 18                 "drxk_hauppauge_hvr930c", "tda     31                 "drxk_hauppauge_hvr930c", "tda10071", "it9135", "drxk_pctv",
 19                 "drxk_terratec_htc_stick", "sm     32                 "drxk_terratec_htc_stick", "sms1xxx_hcw", "si2165");
 20                                                    33 
 21 # Check args                                       34 # Check args
 22 syntax() if (scalar(@ARGV) != 1);                  35 syntax() if (scalar(@ARGV) != 1);
 23 $cid = $ARGV[0];                                   36 $cid = $ARGV[0];
 24                                                    37 
 25 # Do it!                                           38 # Do it!
 26 for ($i=0; $i < scalar(@components); $i++) {       39 for ($i=0; $i < scalar(@components); $i++) {
 27     if ($cid eq $components[$i]) {                 40     if ($cid eq $components[$i]) {
 28         $outfile = eval($cid);                     41         $outfile = eval($cid);
 29         die $@ if $@;                              42         die $@ if $@;
 30         print STDERR <<EOF;                        43         print STDERR <<EOF;
 31 Firmware(s) $outfile extracted successfully.       44 Firmware(s) $outfile extracted successfully.
 32 Now copy it(them) to either /usr/lib/hotplug/f     45 Now copy it(them) to either /usr/lib/hotplug/firmware or /lib/firmware
 33 (depending on configuration of firmware hotplu     46 (depending on configuration of firmware hotplug).
 34 EOF                                                47 EOF
 35         exit(0);                                   48         exit(0);
 36     }                                              49     }
 37 }                                                  50 }
 38                                                    51 
 39 # If we get here, it wasn't found                  52 # If we get here, it wasn't found
 40 print STDERR "Unknown component \"$cid\"\n";       53 print STDERR "Unknown component \"$cid\"\n";
 41 syntax();                                          54 syntax();
 42                                                    55 
 43                                                    56 
 44                                                    57 
 45                                                    58 
 46 # --------------------------------------------     59 # ---------------------------------------------------------------
 47 # Firmware-specific extraction subroutines         60 # Firmware-specific extraction subroutines
 48                                                    61 
 49 sub sp8870 {                                       62 sub sp8870 {
 50     my $sourcefile = "tt_Premium_217g.zip";        63     my $sourcefile = "tt_Premium_217g.zip";
 51     my $url = "http://www.softwarepatch.pl/999     64     my $url = "http://www.softwarepatch.pl/9999ccd06a4813cb827dbb0005071c71/$sourcefile";
 52     my $hash = "53970ec17a538945a6d8cb608a7b38     65     my $hash = "53970ec17a538945a6d8cb608a7b3899";
 53     my $outfile = "dvb-fe-sp8870.fw";              66     my $outfile = "dvb-fe-sp8870.fw";
 54     my $tmpdir = tempdir(DIR => "/tmp", CLEANU     67     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
 55                                                    68 
 56     checkstandard();                               69     checkstandard();
 57                                                    70 
 58     wgetfile($sourcefile, $url);                   71     wgetfile($sourcefile, $url);
 59     unzip($sourcefile, $tmpdir);                   72     unzip($sourcefile, $tmpdir);
 60     verify("$tmpdir/software/OEM/HE/App/boot/S     73     verify("$tmpdir/software/OEM/HE/App/boot/SC_MAIN.MC", $hash);
 61     copy("$tmpdir/software/OEM/HE/App/boot/SC_     74     copy("$tmpdir/software/OEM/HE/App/boot/SC_MAIN.MC", $outfile);
 62                                                    75 
 63     $outfile;                                      76     $outfile;
 64 }                                                  77 }
 65                                                    78 
 66 sub sp887x {                                       79 sub sp887x {
 67     my $sourcefile = "Dvbt1.3.57.6.zip";           80     my $sourcefile = "Dvbt1.3.57.6.zip";
 68     my $url = "http://www.avermedia.com/softwa     81     my $url = "http://www.avermedia.com/software/$sourcefile";
 69     my $cabfile = "DVBT Net  Ver1.3.57.6/disk1     82     my $cabfile = "DVBT Net  Ver1.3.57.6/disk1/data1.cab";
 70     my $hash = "237938d53a7f834c05c42b894ca68a     83     my $hash = "237938d53a7f834c05c42b894ca68ac3";
 71     my $outfile = "dvb-fe-sp887x.fw";              84     my $outfile = "dvb-fe-sp887x.fw";
 72     my $tmpdir = tempdir(DIR => "/tmp", CLEANU     85     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
 73                                                    86 
 74     checkstandard();                               87     checkstandard();
 75     checkunshield();                               88     checkunshield();
 76                                                    89 
 77     wgetfile($sourcefile, $url);                   90     wgetfile($sourcefile, $url);
 78     unzip($sourcefile, $tmpdir);                   91     unzip($sourcefile, $tmpdir);
 79     unshield("$tmpdir/$cabfile", $tmpdir);         92     unshield("$tmpdir/$cabfile", $tmpdir);
 80     verify("$tmpdir/ZEnglish/sc_main.mc", $has     93     verify("$tmpdir/ZEnglish/sc_main.mc", $hash);
 81     copy("$tmpdir/ZEnglish/sc_main.mc", $outfi     94     copy("$tmpdir/ZEnglish/sc_main.mc", $outfile);
 82                                                    95 
 83     $outfile;                                      96     $outfile;
 84 }                                                  97 }
 85                                                    98 
 86 sub tda10045 {                                     99 sub tda10045 {
 87     my $sourcefile = "tt_budget_217g.zip";        100     my $sourcefile = "tt_budget_217g.zip";
 88     my $url = "http://www.technotrend.de/new/2    101     my $url = "http://www.technotrend.de/new/217g/$sourcefile";
 89     my $hash = "2105fd5bf37842fbcdfa4bfd58f359    102     my $hash = "2105fd5bf37842fbcdfa4bfd58f3594a";
 90     my $outfile = "dvb-fe-tda10045.fw";           103     my $outfile = "dvb-fe-tda10045.fw";
 91     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    104     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
 92                                                   105 
 93     checkstandard();                              106     checkstandard();
 94                                                   107 
 95     wgetfile($sourcefile, $url);                  108     wgetfile($sourcefile, $url);
 96     unzip($sourcefile, $tmpdir);                  109     unzip($sourcefile, $tmpdir);
 97     extract("$tmpdir/software/OEM/PCI/App/ttlc    110     extract("$tmpdir/software/OEM/PCI/App/ttlcdacc.dll", 0x37ef9, 30555, "$tmpdir/fwtmp");
 98     verify("$tmpdir/fwtmp", $hash);               111     verify("$tmpdir/fwtmp", $hash);
 99     copy("$tmpdir/fwtmp", $outfile);              112     copy("$tmpdir/fwtmp", $outfile);
100                                                   113 
101     $outfile;                                     114     $outfile;
102 }                                                 115 }
103                                                   116 
104 sub tda10046 {                                    117 sub tda10046 {
105         my $sourcefile = "TT_PCI_2.19h_28_11_2    118         my $sourcefile = "TT_PCI_2.19h_28_11_2006.zip";
106         my $url = "http://technotrend.com.ua/d    119         my $url = "http://technotrend.com.ua/download/software/219/$sourcefile";
107         my $hash = "6a7e1e2f2644b162ff05023675    120         my $hash = "6a7e1e2f2644b162ff0502367553c72d";
108         my $outfile = "dvb-fe-tda10046.fw";       121         my $outfile = "dvb-fe-tda10046.fw";
109         my $tmpdir = tempdir(DIR => "/tmp", CL    122         my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
110                                                   123 
111         checkstandard();                          124         checkstandard();
112                                                   125 
113         wgetfile($sourcefile, $url);              126         wgetfile($sourcefile, $url);
114         unzip($sourcefile, $tmpdir);              127         unzip($sourcefile, $tmpdir);
115         extract("$tmpdir/TT_PCI_2.19h_28_11_20    128         extract("$tmpdir/TT_PCI_2.19h_28_11_2006/software/OEM/PCI/App/ttlcdacc.dll", 0x65389, 24478, "$tmpdir/fwtmp");
116         verify("$tmpdir/fwtmp", $hash);           129         verify("$tmpdir/fwtmp", $hash);
117         copy("$tmpdir/fwtmp", $outfile);          130         copy("$tmpdir/fwtmp", $outfile);
118                                                   131 
119         $outfile;                                 132         $outfile;
120 }                                                 133 }
121                                                   134 
122 sub tda10046lifeview {                            135 sub tda10046lifeview {
123     my $sourcefile = "7%5Cdrv_2.11.02.zip";       136     my $sourcefile = "7%5Cdrv_2.11.02.zip";
124     my $url = "http://www.lifeview.hk/dbimages    137     my $url = "http://www.lifeview.hk/dbimages/document/$sourcefile";
125     my $hash = "1ea24dee4eea8fe971686981f34fd2    138     my $hash = "1ea24dee4eea8fe971686981f34fd2e0";
126     my $outfile = "dvb-fe-tda10046.fw";           139     my $outfile = "dvb-fe-tda10046.fw";
127     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    140     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
128                                                   141 
129     checkstandard();                              142     checkstandard();
130                                                   143 
131     wgetfile($sourcefile, $url);                  144     wgetfile($sourcefile, $url);
132     unzip($sourcefile, $tmpdir);                  145     unzip($sourcefile, $tmpdir);
133     extract("$tmpdir/LVHybrid.sys", 0x8b088, 2    146     extract("$tmpdir/LVHybrid.sys", 0x8b088, 24602, "$tmpdir/fwtmp");
134     verify("$tmpdir/fwtmp", $hash);               147     verify("$tmpdir/fwtmp", $hash);
135     copy("$tmpdir/fwtmp", $outfile);              148     copy("$tmpdir/fwtmp", $outfile);
136                                                   149 
137     $outfile;                                     150     $outfile;
138 }                                                 151 }
139                                                   152 
140 sub av7110 {                                      153 sub av7110 {
141     my $sourcefile = "dvb-ttpci-01.fw-261d";      154     my $sourcefile = "dvb-ttpci-01.fw-261d";
142     my $url = "https://linuxtv.org/downloads/f    155     my $url = "https://linuxtv.org/downloads/firmware/$sourcefile";
143     my $hash = "603431b6259715a8e88f376a53b64e    156     my $hash = "603431b6259715a8e88f376a53b64e2f";
144     my $outfile = "dvb-ttpci-01.fw";              157     my $outfile = "dvb-ttpci-01.fw";
145                                                   158 
146     checkstandard();                              159     checkstandard();
147                                                   160 
148     wgetfile($sourcefile, $url);                  161     wgetfile($sourcefile, $url);
149     verify($sourcefile, $hash);                   162     verify($sourcefile, $hash);
150     copy($sourcefile, $outfile);                  163     copy($sourcefile, $outfile);
151                                                   164 
152     $outfile;                                     165     $outfile;
153 }                                                 166 }
154                                                   167 
155 sub dec2000t {                                    168 sub dec2000t {
156     my $sourcefile = "dec217g.exe";               169     my $sourcefile = "dec217g.exe";
157     my $url = "http://hauppauge.lightpath.net/    170     my $url = "http://hauppauge.lightpath.net/de/$sourcefile";
158     my $hash = "bd86f458cee4a8f0a8ce2d20c66215    171     my $hash = "bd86f458cee4a8f0a8ce2d20c66215a9";
159     my $outfile = "dvb-ttusb-dec-2000t.fw";       172     my $outfile = "dvb-ttusb-dec-2000t.fw";
160     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    173     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
161                                                   174 
162     checkstandard();                              175     checkstandard();
163                                                   176 
164     wgetfile($sourcefile, $url);                  177     wgetfile($sourcefile, $url);
165     unzip($sourcefile, $tmpdir);                  178     unzip($sourcefile, $tmpdir);
166     verify("$tmpdir/software/OEM/STB/App/Boot/    179     verify("$tmpdir/software/OEM/STB/App/Boot/STB_PC_T.bin", $hash);
167     copy("$tmpdir/software/OEM/STB/App/Boot/ST    180     copy("$tmpdir/software/OEM/STB/App/Boot/STB_PC_T.bin", $outfile);
168                                                   181 
169     $outfile;                                     182     $outfile;
170 }                                                 183 }
171                                                   184 
172 sub dec2540t {                                    185 sub dec2540t {
173     my $sourcefile = "dec217g.exe";               186     my $sourcefile = "dec217g.exe";
174     my $url = "http://hauppauge.lightpath.net/    187     my $url = "http://hauppauge.lightpath.net/de/$sourcefile";
175     my $hash = "53e58f4f5b5c2930beee74a7681fed    188     my $hash = "53e58f4f5b5c2930beee74a7681fed92";
176     my $outfile = "dvb-ttusb-dec-2540t.fw";       189     my $outfile = "dvb-ttusb-dec-2540t.fw";
177     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    190     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
178                                                   191 
179     checkstandard();                              192     checkstandard();
180                                                   193 
181     wgetfile($sourcefile, $url);                  194     wgetfile($sourcefile, $url);
182     unzip($sourcefile, $tmpdir);                  195     unzip($sourcefile, $tmpdir);
183     verify("$tmpdir/software/OEM/STB/App/Boot/    196     verify("$tmpdir/software/OEM/STB/App/Boot/STB_PC_X.bin", $hash);
184     copy("$tmpdir/software/OEM/STB/App/Boot/ST    197     copy("$tmpdir/software/OEM/STB/App/Boot/STB_PC_X.bin", $outfile);
185                                                   198 
186     $outfile;                                     199     $outfile;
187 }                                                 200 }
188                                                   201 
189 sub dec3000s {                                    202 sub dec3000s {
190     my $sourcefile = "dec217g.exe";               203     my $sourcefile = "dec217g.exe";
191     my $url = "http://hauppauge.lightpath.net/    204     my $url = "http://hauppauge.lightpath.net/de/$sourcefile";
192     my $hash = "b013ececea83f4d6d8d2a29ac7c1b4    205     my $hash = "b013ececea83f4d6d8d2a29ac7c1b448";
193     my $outfile = "dvb-ttusb-dec-3000s.fw";       206     my $outfile = "dvb-ttusb-dec-3000s.fw";
194     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    207     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
195                                                   208 
196     checkstandard();                              209     checkstandard();
197                                                   210 
198     wgetfile($sourcefile, $url);                  211     wgetfile($sourcefile, $url);
199     unzip($sourcefile, $tmpdir);                  212     unzip($sourcefile, $tmpdir);
200     verify("$tmpdir/software/OEM/STB/App/Boot/    213     verify("$tmpdir/software/OEM/STB/App/Boot/STB_PC_S.bin", $hash);
201     copy("$tmpdir/software/OEM/STB/App/Boot/ST    214     copy("$tmpdir/software/OEM/STB/App/Boot/STB_PC_S.bin", $outfile);
202                                                   215 
203     $outfile;                                     216     $outfile;
204 }                                                 217 }
205 sub opera1{                                       218 sub opera1{
206         my $tmpdir = tempdir(DIR => "/tmp", CL    219         my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 0);
207                                                   220 
208         checkstandard();                          221         checkstandard();
209         my $fwfile1="dvb-usb-opera1-fpga-01.fw    222         my $fwfile1="dvb-usb-opera1-fpga-01.fw";
210         my $fwfile2="dvb-usb-opera-01.fw";        223         my $fwfile2="dvb-usb-opera-01.fw";
211         extract("2830SCap2.sys", 0x62e8, 55024    224         extract("2830SCap2.sys", 0x62e8, 55024, "$tmpdir/opera1-fpga.fw");
212         extract("2830SLoad2.sys",0x3178,0x3685    225         extract("2830SLoad2.sys",0x3178,0x3685-0x3178,"$tmpdir/fw1part1");
213         extract("2830SLoad2.sys",0x0980,0x3150    226         extract("2830SLoad2.sys",0x0980,0x3150-0x0980,"$tmpdir/fw1part2");
214         delzero("$tmpdir/fw1part1","$tmpdir/fw    227         delzero("$tmpdir/fw1part1","$tmpdir/fw1part1-1");
215         delzero("$tmpdir/fw1part2","$tmpdir/fw    228         delzero("$tmpdir/fw1part2","$tmpdir/fw1part2-1");
216         verify("$tmpdir/fw1part1-1","5e0909858    229         verify("$tmpdir/fw1part1-1","5e0909858fdf0b5b09ad48b9fe622e70");
217         verify("$tmpdir/fw1part2-1","d6e146f32    230         verify("$tmpdir/fw1part2-1","d6e146f321427e931df2c6fcadac37a1");
218         verify("$tmpdir/opera1-fpga.fw","0f813    231         verify("$tmpdir/opera1-fpga.fw","0f8133f5e9051f5f3c1928f7e5a1b07d");
219                                                   232 
220         my $RES1="\x01\x92\x7f\x00\x01\x00";      233         my $RES1="\x01\x92\x7f\x00\x01\x00";
221         my $RES0="\x01\x92\x7f\x00\x00\x00";      234         my $RES0="\x01\x92\x7f\x00\x00\x00";
222         my $DAT1="\x01\x00\xe6\x00\x01\x00";      235         my $DAT1="\x01\x00\xe6\x00\x01\x00";
223         my $DAT0="\x01\x00\xe6\x00\x00\x00";      236         my $DAT0="\x01\x00\xe6\x00\x00\x00";
224         open FW,">$tmpdir/opera.fw";              237         open FW,">$tmpdir/opera.fw";
225         print FW "$RES1";                         238         print FW "$RES1";
226         print FW "$DAT1";                         239         print FW "$DAT1";
227         print FW "$RES1";                         240         print FW "$RES1";
228         print FW "$DAT1";                         241         print FW "$DAT1";
229         appendfile(FW,"$tmpdir/fw1part1-1");      242         appendfile(FW,"$tmpdir/fw1part1-1");
230         print FW "$RES0";                         243         print FW "$RES0";
231         print FW "$DAT0";                         244         print FW "$DAT0";
232         print FW "$RES1";                         245         print FW "$RES1";
233         print FW "$DAT1";                         246         print FW "$DAT1";
234         appendfile(FW,"$tmpdir/fw1part2-1");      247         appendfile(FW,"$tmpdir/fw1part2-1");
235         print FW "$RES1";                         248         print FW "$RES1";
236         print FW "$DAT1";                         249         print FW "$DAT1";
237         print FW "$RES0";                         250         print FW "$RES0";
238         print FW "$DAT0";                         251         print FW "$DAT0";
239         copy ("$tmpdir/opera1-fpga.fw",$fwfile    252         copy ("$tmpdir/opera1-fpga.fw",$fwfile1);
240         copy ("$tmpdir/opera.fw",$fwfile2);       253         copy ("$tmpdir/opera.fw",$fwfile2);
241                                                   254 
242         $fwfile1.",".$fwfile2;                    255         $fwfile1.",".$fwfile2;
243 }                                                 256 }
244                                                   257 
245 sub vp7041 {                                      258 sub vp7041 {
246     my $sourcefile = "2.422.zip";                 259     my $sourcefile = "2.422.zip";
247     my $url = "http://www.twinhan.com/files/dr    260     my $url = "http://www.twinhan.com/files/driver/USB-Ter/$sourcefile";
248     my $hash = "e88c9372d1f66609a3e7b072c53fbc    261     my $hash = "e88c9372d1f66609a3e7b072c53fbcfe";
249     my $outfile = "dvb-vp7041-2.422.fw";          262     my $outfile = "dvb-vp7041-2.422.fw";
250     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    263     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
251                                                   264 
252     checkstandard();                              265     checkstandard();
253                                                   266 
254     wgetfile($sourcefile, $url);                  267     wgetfile($sourcefile, $url);
255     unzip($sourcefile, $tmpdir);                  268     unzip($sourcefile, $tmpdir);
256     extract("$tmpdir/VisionDTV/Drivers/Win2K&X    269     extract("$tmpdir/VisionDTV/Drivers/Win2K&XP/UDTTload.sys", 12503, 3036, "$tmpdir/fwtmp1");
257     extract("$tmpdir/VisionDTV/Drivers/Win2K&X    270     extract("$tmpdir/VisionDTV/Drivers/Win2K&XP/UDTTload.sys", 2207, 10274, "$tmpdir/fwtmp2");
258                                                   271 
259     my $CMD = "\000\001\000\222\177\000";         272     my $CMD = "\000\001\000\222\177\000";
260     my $PAD = "\000\000\000\000\000\000\000\00    273     my $PAD = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000";
261     my ($FW);                                     274     my ($FW);
262     open $FW, ">$tmpdir/fwtmp3";                  275     open $FW, ">$tmpdir/fwtmp3";
263     print $FW "$CMD\001$PAD";                     276     print $FW "$CMD\001$PAD";
264     print $FW "$CMD\001$PAD";                     277     print $FW "$CMD\001$PAD";
265     appendfile($FW, "$tmpdir/fwtmp1");            278     appendfile($FW, "$tmpdir/fwtmp1");
266     print $FW "$CMD\000$PAD";                     279     print $FW "$CMD\000$PAD";
267     print $FW "$CMD\001$PAD";                     280     print $FW "$CMD\001$PAD";
268     appendfile($FW, "$tmpdir/fwtmp2");            281     appendfile($FW, "$tmpdir/fwtmp2");
269     print $FW "$CMD\001$PAD";                     282     print $FW "$CMD\001$PAD";
270     print $FW "$CMD\000$PAD";                     283     print $FW "$CMD\000$PAD";
271     close($FW);                                   284     close($FW);
272                                                   285 
273     verify("$tmpdir/fwtmp3", $hash);              286     verify("$tmpdir/fwtmp3", $hash);
274     copy("$tmpdir/fwtmp3", $outfile);             287     copy("$tmpdir/fwtmp3", $outfile);
275                                                   288 
276     $outfile;                                     289     $outfile;
277 }                                                 290 }
278                                                   291 
279 sub vp7049 {                                      292 sub vp7049 {
280     my $fwfile = "dvb-usb-vp7049-0.95.fw";        293     my $fwfile = "dvb-usb-vp7049-0.95.fw";
281     my $url = "http://ao2.it/sites/default/fil    294     my $url = "http://ao2.it/sites/default/files/blog/2012/11/06/linux-support-digicom-digitune-s-vp7049-udtt7049/$fwfile";
282     my $hash = "5609fd295168aea88b25ff43a6f79c    295     my $hash = "5609fd295168aea88b25ff43a6f79c36";
283                                                   296 
284     checkstandard();                              297     checkstandard();
285                                                   298 
286     wgetfile($fwfile, $url);                      299     wgetfile($fwfile, $url);
287     verify($fwfile, $hash);                       300     verify($fwfile, $hash);
288                                                   301 
289     $fwfile;                                      302     $fwfile;
290 }                                                 303 }
291                                                   304 
292 sub dibusb {                                      305 sub dibusb {
293         my $url = "https://linuxtv.org/downloa    306         my $url = "https://linuxtv.org/downloads/firmware/dvb-usb-dibusb-5.0.0.11.fw";
294         my $outfile = "dvb-dibusb-5.0.0.11.fw"    307         my $outfile = "dvb-dibusb-5.0.0.11.fw";
295         my $hash = "fa490295a527360ca16dcdf322    308         my $hash = "fa490295a527360ca16dcdf3224ca243";
296                                                   309 
297         checkstandard();                          310         checkstandard();
298                                                   311 
299         wgetfile($outfile, $url);                 312         wgetfile($outfile, $url);
300         verify($outfile,$hash);                   313         verify($outfile,$hash);
301                                                   314 
302         $outfile;                                 315         $outfile;
303 }                                                 316 }
304                                                   317 
305 sub nxt2002 {                                     318 sub nxt2002 {
306     my $sourcefile = "Technisat_DVB-PC_4_4_COM    319     my $sourcefile = "Technisat_DVB-PC_4_4_COMPACT.zip";
307     my $url = "http://www.bbti.us/download/win    320     my $url = "http://www.bbti.us/download/windows/$sourcefile";
308     my $hash = "476befae8c7c1bb9648954060b1eec    321     my $hash = "476befae8c7c1bb9648954060b1eec1f";
309     my $outfile = "dvb-fe-nxt2002.fw";            322     my $outfile = "dvb-fe-nxt2002.fw";
310     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    323     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
311                                                   324 
312     checkstandard();                              325     checkstandard();
313                                                   326 
314     wgetfile($sourcefile, $url);                  327     wgetfile($sourcefile, $url);
315     unzip($sourcefile, $tmpdir);                  328     unzip($sourcefile, $tmpdir);
316     verify("$tmpdir/SkyNET.sys", $hash);          329     verify("$tmpdir/SkyNET.sys", $hash);
317     extract("$tmpdir/SkyNET.sys", 331624, 5908    330     extract("$tmpdir/SkyNET.sys", 331624, 5908, $outfile);
318                                                   331 
319     $outfile;                                     332     $outfile;
320 }                                                 333 }
321                                                   334 
322 sub nxt2004 {                                     335 sub nxt2004 {
323     my $sourcefile = "AVerTVHD_MCE_A180_Drv_v1    336     my $sourcefile = "AVerTVHD_MCE_A180_Drv_v1.2.2.16.zip";
324     my $url = "http://www.avermedia-usa.com/su    337     my $url = "http://www.avermedia-usa.com/support/Drivers/$sourcefile";
325     my $hash = "111cb885b1e009188346d72acfed02    338     my $hash = "111cb885b1e009188346d72acfed024c";
326     my $outfile = "dvb-fe-nxt2004.fw";            339     my $outfile = "dvb-fe-nxt2004.fw";
327     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    340     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
328                                                   341 
329     checkstandard();                              342     checkstandard();
330                                                   343 
331     wgetfile($sourcefile, $url);                  344     wgetfile($sourcefile, $url);
332     unzip($sourcefile, $tmpdir);                  345     unzip($sourcefile, $tmpdir);
333     verify("$tmpdir/3xHybrid.sys", $hash);        346     verify("$tmpdir/3xHybrid.sys", $hash);
334     extract("$tmpdir/3xHybrid.sys", 465304, 95    347     extract("$tmpdir/3xHybrid.sys", 465304, 9584, $outfile);
335                                                   348 
336     $outfile;                                     349     $outfile;
337 }                                                 350 }
338                                                   351 
339 sub or51211 {                                     352 sub or51211 {
340     my $fwfile = "dvb-fe-or51211.fw";             353     my $fwfile = "dvb-fe-or51211.fw";
341     my $url = "https://linuxtv.org/downloads/f    354     my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
342     my $hash = "d830949c771a289505bf9eafc225d4    355     my $hash = "d830949c771a289505bf9eafc225d491";
343                                                   356 
344     checkstandard();                              357     checkstandard();
345                                                   358 
346     wgetfile($fwfile, $url);                      359     wgetfile($fwfile, $url);
347     verify($fwfile, $hash);                       360     verify($fwfile, $hash);
348                                                   361 
349     $fwfile;                                      362     $fwfile;
350 }                                                 363 }
351                                                   364 
352 sub cx231xx {                                     365 sub cx231xx {
353     my $fwfile = "v4l-cx231xx-avcore-01.fw";      366     my $fwfile = "v4l-cx231xx-avcore-01.fw";
354     my $url = "https://linuxtv.org/downloads/f    367     my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
355     my $hash = "7d3bb956dc9df0eafded2b56ba57cc    368     my $hash = "7d3bb956dc9df0eafded2b56ba57cc42";
356                                                   369 
357     checkstandard();                              370     checkstandard();
358                                                   371 
359     wgetfile($fwfile, $url);                      372     wgetfile($fwfile, $url);
360     verify($fwfile, $hash);                       373     verify($fwfile, $hash);
361                                                   374 
362     $fwfile;                                      375     $fwfile;
363 }                                                 376 }
364                                                   377 
365 sub cx18 {                                        378 sub cx18 {
366     my $url = "https://linuxtv.org/downloads/f    379     my $url = "https://linuxtv.org/downloads/firmware/";
367                                                   380 
368     my %files = (                                 381     my %files = (
369         'v4l-cx23418-apu.fw' => '588f081b562f5    382         'v4l-cx23418-apu.fw' => '588f081b562f5c653a3db1ad8f65939a',
370         'v4l-cx23418-cpu.fw' => 'b6c7ed64bc44b    383         'v4l-cx23418-cpu.fw' => 'b6c7ed64bc44b1a6e0840adaeac39d79',
371         'v4l-cx23418-dig.fw' => '95bc688d3e759    384         'v4l-cx23418-dig.fw' => '95bc688d3e7599fd5800161e9971cc55',
372     );                                            385     );
373                                                   386 
374     checkstandard();                              387     checkstandard();
375                                                   388 
376     my $allfiles;                                 389     my $allfiles;
377     foreach my $fwfile (keys %files) {            390     foreach my $fwfile (keys %files) {
378         wgetfile($fwfile, "$url/$fwfile");        391         wgetfile($fwfile, "$url/$fwfile");
379         verify($fwfile, $files{$fwfile});         392         verify($fwfile, $files{$fwfile});
380         $allfiles .= " $fwfile";                  393         $allfiles .= " $fwfile";
381     }                                             394     }
382                                                   395 
383     $allfiles =~ s/^\s//;                         396     $allfiles =~ s/^\s//;
384                                                   397 
385     $allfiles;                                    398     $allfiles;
386 }                                                 399 }
387                                                   400 
388 sub mpc718 {                                      401 sub mpc718 {
389     my $archive = 'Yuan MPC718 TV Tuner Card 2    402     my $archive = 'Yuan MPC718 TV Tuner Card 2.13.10.1016.zip';
390     my $url = "ftp://ftp.work.acer-euro.com/de    403     my $url = "ftp://ftp.work.acer-euro.com/desktop/aspire_idea510/vista/Drivers/$archive";
391     my $fwfile = "dvb-cx18-mpc718-mt352.fw";      404     my $fwfile = "dvb-cx18-mpc718-mt352.fw";
392     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    405     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
393                                                   406 
394     checkstandard();                              407     checkstandard();
395     wgetfile($archive, $url);                     408     wgetfile($archive, $url);
396     unzip($archive, $tmpdir);                     409     unzip($archive, $tmpdir);
397                                                   410 
398     my $sourcefile = "$tmpdir/Yuan MPC718 TV T    411     my $sourcefile = "$tmpdir/Yuan MPC718 TV Tuner Card 2.13.10.1016/mpc718_32bit/yuanrap.sys";
399     my $found = 0;                                412     my $found = 0;
400                                                   413 
401     open IN, '<', $sourcefile or die "Couldn't    414     open IN, '<', $sourcefile or die "Couldn't open $sourcefile to extract $fwfile data\n";
402     binmode IN;                                   415     binmode IN;
403     open OUT, '>', $fwfile;                       416     open OUT, '>', $fwfile;
404     binmode OUT;                                  417     binmode OUT;
405     {                                             418     {
406         # Block scope because we change the li    419         # Block scope because we change the line terminator variable $/
407         my $prevlen = 0;                          420         my $prevlen = 0;
408         my $currlen;                              421         my $currlen;
409                                                   422 
410         # Buried in the data segment are 3 run    423         # Buried in the data segment are 3 runs of almost identical
411         # register-value pairs that end in 0x5    424         # register-value pairs that end in 0x5d 0x01 which is a "TUNER GO"
412         # command for the MT352.                  425         # command for the MT352.
413         # Pull out the middle run (because it'    426         # Pull out the middle run (because it's easy) of register-value
414         # pairs to make the "firmware" file.      427         # pairs to make the "firmware" file.
415                                                   428 
416         local $/ = "\x5d\x01"; # MT352 "TUNER     429         local $/ = "\x5d\x01"; # MT352 "TUNER GO"
417                                                   430 
418         while (<IN>) {                            431         while (<IN>) {
419             $currlen = length($_);                432             $currlen = length($_);
420             if ($prevlen == $currlen && $currl    433             if ($prevlen == $currlen && $currlen <= 64) {
421                 chop; chop; # Get rid of "TUNE    434                 chop; chop; # Get rid of "TUNER GO"
422                 s/^\0\0//;  # get rid of leadi    435                 s/^\0\0//;  # get rid of leading 00 00 if it's there
423                 printf OUT "$_";                  436                 printf OUT "$_";
424                 $found = 1;                       437                 $found = 1;
425                 last;                             438                 last;
426             }                                     439             }
427             $prevlen = $currlen;                  440             $prevlen = $currlen;
428         }                                         441         }
429     }                                             442     }
430     close OUT;                                    443     close OUT;
431     close IN;                                     444     close IN;
432     if (!$found) {                                445     if (!$found) {
433         unlink $fwfile;                           446         unlink $fwfile;
434         die "Couldn't find valid register-valu    447         die "Couldn't find valid register-value sequence in $sourcefile for $fwfile\n";
435     }                                             448     }
436     $fwfile;                                      449     $fwfile;
437 }                                                 450 }
438                                                   451 
439 sub cx23885 {                                     452 sub cx23885 {
440     my $url = "https://linuxtv.org/downloads/f    453     my $url = "https://linuxtv.org/downloads/firmware/";
441                                                   454 
442     my %files = (                                 455     my %files = (
443         'v4l-cx23885-avcore-01.fw' => 'a9f8f5d    456         'v4l-cx23885-avcore-01.fw' => 'a9f8f5d901a7fb42f552e1ee6384f3bb',
444         'v4l-cx23885-enc.fw'       => 'a9f8f5d    457         'v4l-cx23885-enc.fw'       => 'a9f8f5d901a7fb42f552e1ee6384f3bb',
445     );                                            458     );
446                                                   459 
447     checkstandard();                              460     checkstandard();
448                                                   461 
449     my $allfiles;                                 462     my $allfiles;
450     foreach my $fwfile (keys %files) {            463     foreach my $fwfile (keys %files) {
451         wgetfile($fwfile, "$url/$fwfile");        464         wgetfile($fwfile, "$url/$fwfile");
452         verify($fwfile, $files{$fwfile});         465         verify($fwfile, $files{$fwfile});
453         $allfiles .= " $fwfile";                  466         $allfiles .= " $fwfile";
454     }                                             467     }
455                                                   468 
456     $allfiles =~ s/^\s//;                         469     $allfiles =~ s/^\s//;
457                                                   470 
458     $allfiles;                                    471     $allfiles;
459 }                                                 472 }
460                                                   473 
461 sub pvrusb2 {                                     474 sub pvrusb2 {
462     my $url = "https://linuxtv.org/downloads/f    475     my $url = "https://linuxtv.org/downloads/firmware/";
463                                                   476 
464     my %files = (                                 477     my %files = (
465         'v4l-cx25840.fw'           => 'dadb79e    478         'v4l-cx25840.fw'           => 'dadb79e9904fc8af96e8111d9cb59320',
466     );                                            479     );
467                                                   480 
468     checkstandard();                              481     checkstandard();
469                                                   482 
470     my $allfiles;                                 483     my $allfiles;
471     foreach my $fwfile (keys %files) {            484     foreach my $fwfile (keys %files) {
472         wgetfile($fwfile, "$url/$fwfile");        485         wgetfile($fwfile, "$url/$fwfile");
473         verify($fwfile, $files{$fwfile});         486         verify($fwfile, $files{$fwfile});
474         $allfiles .= " $fwfile";                  487         $allfiles .= " $fwfile";
475     }                                             488     }
476                                                   489 
477     $allfiles =~ s/^\s//;                         490     $allfiles =~ s/^\s//;
478                                                   491 
479     $allfiles;                                    492     $allfiles;
480 }                                                 493 }
481                                                   494 
482 sub or51132_qam {                                 495 sub or51132_qam {
483     my $fwfile = "dvb-fe-or51132-qam.fw";         496     my $fwfile = "dvb-fe-or51132-qam.fw";
484     my $url = "https://linuxtv.org/downloads/f    497     my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
485     my $hash = "7702e8938612de46ccadfe9b413cb3    498     my $hash = "7702e8938612de46ccadfe9b413cb3b5";
486                                                   499 
487     checkstandard();                              500     checkstandard();
488                                                   501 
489     wgetfile($fwfile, $url);                      502     wgetfile($fwfile, $url);
490     verify($fwfile, $hash);                       503     verify($fwfile, $hash);
491                                                   504 
492     $fwfile;                                      505     $fwfile;
493 }                                                 506 }
494                                                   507 
495 sub or51132_vsb {                                 508 sub or51132_vsb {
496     my $fwfile = "dvb-fe-or51132-vsb.fw";         509     my $fwfile = "dvb-fe-or51132-vsb.fw";
497     my $url = "https://linuxtv.org/downloads/f    510     my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
498     my $hash = "c16208e02f36fc439a557ad4c61336    511     my $hash = "c16208e02f36fc439a557ad4c613364a";
499                                                   512 
500     checkstandard();                              513     checkstandard();
501                                                   514 
502     wgetfile($fwfile, $url);                      515     wgetfile($fwfile, $url);
503     verify($fwfile, $hash);                       516     verify($fwfile, $hash);
504                                                   517 
505     $fwfile;                                      518     $fwfile;
506 }                                                 519 }
507                                                   520 
508 sub bluebird {                                    521 sub bluebird {
509         my $url = "https://linuxtv.org/downloa    522         my $url = "https://linuxtv.org/download/dvb/firmware/dvb-usb-bluebird-01.fw";
510         my $outfile = "dvb-usb-bluebird-01.fw"    523         my $outfile = "dvb-usb-bluebird-01.fw";
511         my $hash = "658397cb9eba9101af90313026    524         my $hash = "658397cb9eba9101af9031302671f49d";
512                                                   525 
513         checkstandard();                          526         checkstandard();
514                                                   527 
515         wgetfile($outfile, $url);                 528         wgetfile($outfile, $url);
516         verify($outfile,$hash);                   529         verify($outfile,$hash);
517                                                   530 
518         $outfile;                                 531         $outfile;
519 }                                                 532 }
520                                                   533 
521 sub af9015 {                                      534 sub af9015 {
522         my $sourcefile = "download.ashx?file=5    535         my $sourcefile = "download.ashx?file=57";
523         my $url = "http://www.ite.com.tw/EN/Se    536         my $url = "http://www.ite.com.tw/EN/Services/$sourcefile";
524         my $hash = "e3f08935158038d385ad382442    537         my $hash = "e3f08935158038d385ad382442f4bb2d";
525         my $outfile = "dvb-usb-af9015.fw";        538         my $outfile = "dvb-usb-af9015.fw";
526         my $tmpdir = tempdir(DIR => "/tmp", CL    539         my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
527         my $fwoffset = 0x25690;                   540         my $fwoffset = 0x25690;
528         my $fwlength = 18725;                     541         my $fwlength = 18725;
529         my ($chunklength, $buf, $rcount);         542         my ($chunklength, $buf, $rcount);
530                                                   543 
531         checkstandard();                          544         checkstandard();
532                                                   545 
533         wgetfile($sourcefile, $url);              546         wgetfile($sourcefile, $url);
534         unzip($sourcefile, $tmpdir);              547         unzip($sourcefile, $tmpdir);
535         verify("$tmpdir/Driver/Files/AF15BDA.s    548         verify("$tmpdir/Driver/Files/AF15BDA.sys", $hash);
536                                                   549 
537         open INFILE, '<', "$tmpdir/Driver/File    550         open INFILE, '<', "$tmpdir/Driver/Files/AF15BDA.sys";
538         open OUTFILE, '>', $outfile;              551         open OUTFILE, '>', $outfile;
539                                                   552 
540         sysseek(INFILE, $fwoffset, SEEK_SET);     553         sysseek(INFILE, $fwoffset, SEEK_SET);
541         while($fwlength > 0) {                    554         while($fwlength > 0) {
542                 $chunklength = 55;                555                 $chunklength = 55;
543                 $chunklength = $fwlength if ($    556                 $chunklength = $fwlength if ($chunklength > $fwlength);
544                 $rcount = sysread(INFILE, $buf    557                 $rcount = sysread(INFILE, $buf, $chunklength);
545                 die "Ran out of data\n" if ($r    558                 die "Ran out of data\n" if ($rcount != $chunklength);
546                 syswrite(OUTFILE, $buf);          559                 syswrite(OUTFILE, $buf);
547                 sysread(INFILE, $buf, 8);         560                 sysread(INFILE, $buf, 8);
548                 $fwlength -= $rcount + 8;         561                 $fwlength -= $rcount + 8;
549         }                                         562         }
550                                                   563 
551         close OUTFILE;                            564         close OUTFILE;
552         close INFILE;                             565         close INFILE;
553 }                                                 566 }
554                                                   567 
555 sub ngene {                                       568 sub ngene {
556     my $url = "http://www.digitaldevices.de/do    569     my $url = "http://www.digitaldevices.de/download/";
557     my $file1 = "ngene_15.fw";                    570     my $file1 = "ngene_15.fw";
558     my $hash1 = "d798d5a757121174f0dbc5f2833c0    571     my $hash1 = "d798d5a757121174f0dbc5f2833c0c85";
559     my $file2 = "ngene_17.fw";                    572     my $file2 = "ngene_17.fw";
560     my $hash2 = "26b687136e127b8ac24b81e0eeafc    573     my $hash2 = "26b687136e127b8ac24b81e0eeafc20b";
561     my $url2 = "http://l4m-daten.de/downloads/    574     my $url2 = "http://l4m-daten.de/downloads/firmware/dvb-s2/linux/all/";
562     my $file3 = "ngene_18.fw";                    575     my $file3 = "ngene_18.fw";
563     my $hash3 = "ebce3ea769a53e3e0b0197c3b3f12    576     my $hash3 = "ebce3ea769a53e3e0b0197c3b3f127e3";
564                                                   577 
565     checkstandard();                              578     checkstandard();
566                                                   579 
567     wgetfile($file1, $url . $file1);              580     wgetfile($file1, $url . $file1);
568     verify($file1, $hash1);                       581     verify($file1, $hash1);
569                                                   582 
570     wgetfile($file2, $url . $file2);              583     wgetfile($file2, $url . $file2);
571     verify($file2, $hash2);                       584     verify($file2, $hash2);
572                                                   585 
573     wgetfile($file3, $url2 . $file3);             586     wgetfile($file3, $url2 . $file3);
574     verify($file3, $hash3);                       587     verify($file3, $hash3);
575                                                   588 
576     "$file1, $file2, $file3";                     589     "$file1, $file2, $file3";
577 }                                                 590 }
578                                                   591 
579 sub az6027{                                       592 sub az6027{
580     my $firmware = "dvb-usb-az6027-03.fw";        593     my $firmware = "dvb-usb-az6027-03.fw";
581     my $url = "http://linux.terratec.de/files/    594     my $url = "http://linux.terratec.de/files/TERRATEC_S7/$firmware";
582                                                   595 
583     wgetfile($firmware, $url);                    596     wgetfile($firmware, $url);
584                                                   597 
585     $firmware;                                    598     $firmware;
586 }                                                 599 }
587                                                   600 
588 sub lme2510_lg {                                  601 sub lme2510_lg {
589     my $sourcefile = "LMEBDA_DVBS.sys";           602     my $sourcefile = "LMEBDA_DVBS.sys";
590     my $hash = "fc6017ad01e79890a97ec53bea157e    603     my $hash = "fc6017ad01e79890a97ec53bea157ed2";
591     my $outfile = "dvb-usb-lme2510-lg.fw";        604     my $outfile = "dvb-usb-lme2510-lg.fw";
592     my $hasho = "caa065d5fdbd2c09ad57b399bbf55    605     my $hasho = "caa065d5fdbd2c09ad57b399bbf55cad";
593                                                   606 
594     checkstandard();                              607     checkstandard();
595                                                   608 
596     verify($sourcefile, $hash);                   609     verify($sourcefile, $hash);
597     extract($sourcefile, 4168, 3841, $outfile)    610     extract($sourcefile, 4168, 3841, $outfile);
598     verify($outfile, $hasho);                     611     verify($outfile, $hasho);
599     $outfile;                                     612     $outfile;
600 }                                                 613 }
601                                                   614 
602 sub lme2510c_s7395 {                              615 sub lme2510c_s7395 {
603     my $sourcefile = "US2A0D.sys";                616     my $sourcefile = "US2A0D.sys";
604     my $hash = "b0155a8083fb822a3bd47bc360e746    617     my $hash = "b0155a8083fb822a3bd47bc360e74601";
605     my $outfile = "dvb-usb-lme2510c-s7395.fw";    618     my $outfile = "dvb-usb-lme2510c-s7395.fw";
606     my $hasho = "3a3cf1aeebd17b6ddc04cebe131e9    619     my $hasho = "3a3cf1aeebd17b6ddc04cebe131e94cf";
607                                                   620 
608     checkstandard();                              621     checkstandard();
609                                                   622 
610     verify($sourcefile, $hash);                   623     verify($sourcefile, $hash);
611     extract($sourcefile, 37248, 3720, $outfile    624     extract($sourcefile, 37248, 3720, $outfile);
612     verify($outfile, $hasho);                     625     verify($outfile, $hasho);
613     $outfile;                                     626     $outfile;
614 }                                                 627 }
615                                                   628 
616 sub lme2510c_s7395_old {                          629 sub lme2510c_s7395_old {
617     my $sourcefile = "LMEBDA_DVBS7395C.sys";      630     my $sourcefile = "LMEBDA_DVBS7395C.sys";
618     my $hash = "7572ae0eb9cdf91baabd7c0ba9e09b    631     my $hash = "7572ae0eb9cdf91baabd7c0ba9e09b31";
619     my $outfile = "dvb-usb-lme2510c-s7395.fw";    632     my $outfile = "dvb-usb-lme2510c-s7395.fw";
620     my $hasho = "90430c5b435eb5c6f88fd44a9d950    633     my $hasho = "90430c5b435eb5c6f88fd44a9d950674";
621                                                   634 
622     checkstandard();                              635     checkstandard();
623                                                   636 
624     verify($sourcefile, $hash);                   637     verify($sourcefile, $hash);
625     extract($sourcefile, 4208, 3881, $outfile)    638     extract($sourcefile, 4208, 3881, $outfile);
626     verify($outfile, $hasho);                     639     verify($outfile, $hasho);
627     $outfile;                                     640     $outfile;
628 }                                                 641 }
629                                                   642 
630 sub drxk {                                        643 sub drxk {
631     my $url = "http://l4m-daten.de/files/";       644     my $url = "http://l4m-daten.de/files/";
632     my $zipfile = "DDTuner.zip";                  645     my $zipfile = "DDTuner.zip";
633     my $hash = "f5a37b9a20a3534997997c0b1382a3    646     my $hash = "f5a37b9a20a3534997997c0b1382a3e5";
634     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    647     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
635     my $drvfile = "DDTuner.sys";                  648     my $drvfile = "DDTuner.sys";
636     my $fwfile = "drxk_a3.mc";                    649     my $fwfile = "drxk_a3.mc";
637                                                   650 
638     checkstandard();                              651     checkstandard();
639                                                   652 
640     wgetfile($zipfile, $url . $zipfile);          653     wgetfile($zipfile, $url . $zipfile);
641     verify($zipfile, $hash);                      654     verify($zipfile, $hash);
642     unzip($zipfile, $tmpdir);                     655     unzip($zipfile, $tmpdir);
643     extract("$tmpdir/$drvfile", 0x14dd8, 15634    656     extract("$tmpdir/$drvfile", 0x14dd8, 15634, "$fwfile");
644                                                   657 
645     "$fwfile"                                     658     "$fwfile"
646 }                                                 659 }
647                                                   660 
648 sub drxk_hauppauge_hvr930c {                      661 sub drxk_hauppauge_hvr930c {
649     my $url = "http://www.wintvcd.co.uk/driver    662     my $url = "http://www.wintvcd.co.uk/drivers/";
650     my $zipfile = "HVR-9x0_5_10_325_28153_SIGN    663     my $zipfile = "HVR-9x0_5_10_325_28153_SIGNED.zip";
651     my $hash = "83ab82e7e9480ec8bf1ae0155ca63c    664     my $hash = "83ab82e7e9480ec8bf1ae0155ca63c88";
652     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    665     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
653     my $drvfile = "HVR-900/emOEM.sys";            666     my $drvfile = "HVR-900/emOEM.sys";
654     my $fwfile = "dvb-usb-hauppauge-hvr930c-dr    667     my $fwfile = "dvb-usb-hauppauge-hvr930c-drxk.fw";
655                                                   668 
656     checkstandard();                              669     checkstandard();
657                                                   670 
658     wgetfile($zipfile, $url . $zipfile);          671     wgetfile($zipfile, $url . $zipfile);
659     verify($zipfile, $hash);                      672     verify($zipfile, $hash);
660     unzip($zipfile, $tmpdir);                     673     unzip($zipfile, $tmpdir);
661     extract("$tmpdir/$drvfile", 0x117b0, 42692    674     extract("$tmpdir/$drvfile", 0x117b0, 42692, "$fwfile");
662                                                   675 
663     "$fwfile"                                     676     "$fwfile"
664 }                                                 677 }
665                                                   678 
666 sub drxk_terratec_h5 {                            679 sub drxk_terratec_h5 {
667     my $url = "https://linuxtv.org/downloads/f    680     my $url = "https://linuxtv.org/downloads/firmware/";
668     my $hash = "19000dada8e2741162ccc50cc91fa7    681     my $hash = "19000dada8e2741162ccc50cc91fa7f1";
669     my $fwfile = "dvb-usb-terratec-h5-drxk.fw"    682     my $fwfile = "dvb-usb-terratec-h5-drxk.fw";
670                                                   683 
671     checkstandard();                              684     checkstandard();
672                                                   685 
673     wgetfile($fwfile, $url . $fwfile);            686     wgetfile($fwfile, $url . $fwfile);
674     verify($fwfile, $hash);                       687     verify($fwfile, $hash);
675                                                   688 
676     "$fwfile"                                     689     "$fwfile"
677 }                                                 690 }
678                                                   691 
679 sub drxk_terratec_htc_stick {                     692 sub drxk_terratec_htc_stick {
680     my $url = "http://ftp.terratec.de/Receiver    693     my $url = "http://ftp.terratec.de/Receiver/Cinergy_HTC_Stick/Updates/History/";
681     my $zipfile = "Cinergy_HTC_Stick_Drv_5.09.    694     my $zipfile = "Cinergy_HTC_Stick_Drv_5.09.1202.00_XP_Vista_7.exe";
682     my $hash = "6722a2442a05423b781721fbc069ed    695     my $hash = "6722a2442a05423b781721fbc069ed5e";
683     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    696     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 0);
684     my $drvfile = "Cinergy HTC Stick/BDA Drive    697     my $drvfile = "Cinergy HTC Stick/BDA Driver 5.09.1202.00/Windows 32 Bit/emOEM.sys";
685     my $fwfile = "dvb-usb-terratec-htc-stick-d    698     my $fwfile = "dvb-usb-terratec-htc-stick-drxk.fw";
686                                                   699 
687     checkstandard();                              700     checkstandard();
688                                                   701 
689     wgetfile($zipfile, $url . $zipfile);          702     wgetfile($zipfile, $url . $zipfile);
690     verify($zipfile, $hash);                      703     verify($zipfile, $hash);
691     unzip($zipfile, $tmpdir);                     704     unzip($zipfile, $tmpdir);
692     extract("$tmpdir/$drvfile", 0x4e5c0, 42692    705     extract("$tmpdir/$drvfile", 0x4e5c0, 42692, "$fwfile");
693                                                   706 
694     "$fwfile"                                     707     "$fwfile"
695 }                                                 708 }
696                                                   709 
697 sub it9135 {                                      710 sub it9135 {
698         my $url = "http://www.ite.com.tw/uploa    711         my $url = "http://www.ite.com.tw/uploads/firmware/v3.25.0.0/";
699         my $file1 = "dvb-usb-it9135-01.zip";      712         my $file1 = "dvb-usb-it9135-01.zip";
700         my $fwfile1 = "dvb-usb-it9135-01.fw";     713         my $fwfile1 = "dvb-usb-it9135-01.fw";
701         my $hash1 = "02fcf11174eda84745dae7e61    714         my $hash1 = "02fcf11174eda84745dae7e61c5ff9ba";
702         my $file2 = "dvb-usb-it9135-02.zip";      715         my $file2 = "dvb-usb-it9135-02.zip";
703         my $fwfile2 = "dvb-usb-it9135-02.fw";     716         my $fwfile2 = "dvb-usb-it9135-02.fw";
704         my $hash2 = "d5e1437dc24358578e0799947    717         my $hash2 = "d5e1437dc24358578e07999475d4cac9";
705                                                   718 
706         checkstandard();                          719         checkstandard();
707                                                   720 
708         wgetfile($file1, $url . $file1);          721         wgetfile($file1, $url . $file1);
709         unzip($file1, "");                        722         unzip($file1, "");
710         verify("$fwfile1", $hash1);               723         verify("$fwfile1", $hash1);
711                                                   724 
712         wgetfile($file2, $url . $file2);          725         wgetfile($file2, $url . $file2);
713         unzip($file2, "");                        726         unzip($file2, "");
714         verify("$fwfile2", $hash2);               727         verify("$fwfile2", $hash2);
715                                                   728 
716         "$file1 $file2"                           729         "$file1 $file2"
717 }                                                 730 }
718                                                   731 
719 sub tda10071 {                                    732 sub tda10071 {
720     my $sourcefile = "PCTV_460e_reference.zip"    733     my $sourcefile = "PCTV_460e_reference.zip";
721     my $url = "ftp://ftp.pctvsystems.com/TV/dr    734     my $url = "ftp://ftp.pctvsystems.com/TV/driver/PCTV%2070e%2080e%20100e%20320e%20330e%20800e/";
722     my $hash = "4403de903bf2593464c8d74bbc200a    735     my $hash = "4403de903bf2593464c8d74bbc200a57";
723     my $fwfile = "dvb-fe-tda10071.fw";            736     my $fwfile = "dvb-fe-tda10071.fw";
724     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    737     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
725                                                   738 
726     checkstandard();                              739     checkstandard();
727                                                   740 
728     wgetfile($sourcefile, $url . $sourcefile);    741     wgetfile($sourcefile, $url . $sourcefile);
729     verify($sourcefile, $hash);                   742     verify($sourcefile, $hash);
730     unzip($sourcefile, $tmpdir);                  743     unzip($sourcefile, $tmpdir);
731     extract("$tmpdir/PCTV\ 70e\ 80e\ 100e\ 320    744     extract("$tmpdir/PCTV\ 70e\ 80e\ 100e\ 320e\ 330e\ 800e/32\ bit/emOEM.sys", 0x67d38, 40504, $fwfile);
732                                                   745 
733     "$fwfile";                                    746     "$fwfile";
734 }                                                 747 }
735                                                   748 
736 sub drxk_pctv {                                   749 sub drxk_pctv {
737     my $sourcefile = "PCTV_460e_reference.zip"    750     my $sourcefile = "PCTV_460e_reference.zip";
738     my $url = "ftp://ftp.pctvsystems.com/TV/dr    751     my $url = "ftp://ftp.pctvsystems.com/TV/driver/PCTV%2070e%2080e%20100e%20320e%20330e%20800e/";
739     my $hash = "4403de903bf2593464c8d74bbc200a    752     my $hash = "4403de903bf2593464c8d74bbc200a57";
740     my $fwfile = "dvb-demod-drxk-pctv.fw";        753     my $fwfile = "dvb-demod-drxk-pctv.fw";
741     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    754     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
742                                                   755 
743     checkstandard();                              756     checkstandard();
744                                                   757 
745     wgetfile($sourcefile, $url . $sourcefile);    758     wgetfile($sourcefile, $url . $sourcefile);
746     verify($sourcefile, $hash);                   759     verify($sourcefile, $hash);
747     unzip($sourcefile, $tmpdir);                  760     unzip($sourcefile, $tmpdir);
748     extract("$tmpdir/PCTV\ 70e\ 80e\ 100e\ 320    761     extract("$tmpdir/PCTV\ 70e\ 80e\ 100e\ 320e\ 330e\ 800e/32\ bit/emOEM.sys", 0x72b80, 42692, $fwfile);
749                                                   762 
750     "$fwfile";                                    763     "$fwfile";
751 }                                                 764 }
752                                                   765 
753 sub sms1xxx_hcw {                                 766 sub sms1xxx_hcw {
754     my $url = "http://steventoth.net/linux/sms    767     my $url = "http://steventoth.net/linux/sms1xxx/";
755     my %files = (                                 768     my %files = (
756         'sms1xxx-hcw-55xxx-dvbt-01.fw'  => "af    769         'sms1xxx-hcw-55xxx-dvbt-01.fw'  => "afb6f9fb9a71d64392e8564ef9577e5a",
757         'sms1xxx-hcw-55xxx-dvbt-02.fw'  => "b4    770         'sms1xxx-hcw-55xxx-dvbt-02.fw'  => "b44807098ba26e52cbedeadc052ba58f",
758         'sms1xxx-hcw-55xxx-isdbt-02.fw' => "da    771         'sms1xxx-hcw-55xxx-isdbt-02.fw' => "dae934eeea85225acbd63ce6cfe1c9e4",
759     );                                            772     );
760                                                   773 
761     checkstandard();                              774     checkstandard();
762                                                   775 
763     my $allfiles;                                 776     my $allfiles;
764     foreach my $fwfile (keys %files) {            777     foreach my $fwfile (keys %files) {
765         wgetfile($fwfile, "$url/$fwfile");        778         wgetfile($fwfile, "$url/$fwfile");
766         verify($fwfile, $files{$fwfile});         779         verify($fwfile, $files{$fwfile});
767         $allfiles .= " $fwfile";                  780         $allfiles .= " $fwfile";
768     }                                             781     }
769                                                   782 
770     $allfiles =~ s/^\s//;                         783     $allfiles =~ s/^\s//;
771                                                   784 
772     $allfiles;                                    785     $allfiles;
773 }                                                 786 }
774                                                   787 
775 sub si2165 {                                      788 sub si2165 {
776     my $sourcefile = "model_111xxx_122xxx_driv    789     my $sourcefile = "model_111xxx_122xxx_driver_6_0_119_31191_WHQL.zip";
777     my $url = "http://www.hauppauge.de/files/d    790     my $url = "http://www.hauppauge.de/files/drivers/";
778     my $hash = "76633e7c76b0edee47c3ba18ded993    791     my $hash = "76633e7c76b0edee47c3ba18ded99336";
779     my $fwfile = "dvb-demod-si2165.fw";           792     my $fwfile = "dvb-demod-si2165.fw";
780     my $tmpdir = tempdir(DIR => "/tmp", CLEANU    793     my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
781                                                   794 
782     checkstandard();                              795     checkstandard();
783                                                   796 
784     wgetfile($sourcefile, $url . $sourcefile);    797     wgetfile($sourcefile, $url . $sourcefile);
785     verify($sourcefile, $hash);                   798     verify($sourcefile, $hash);
786     unzip($sourcefile, $tmpdir);                  799     unzip($sourcefile, $tmpdir);
787     extract("$tmpdir/Driver10/Hcw10bda.sys", 0    800     extract("$tmpdir/Driver10/Hcw10bda.sys", 0x80788, 0x81E08-0x80788, "$tmpdir/fw1");
788                                                   801 
789     delzero("$tmpdir/fw1","$tmpdir/fw1-1");       802     delzero("$tmpdir/fw1","$tmpdir/fw1-1");
790     #verify("$tmpdir/fw1","5e0909858fdf0b5b09a    803     #verify("$tmpdir/fw1","5e0909858fdf0b5b09ad48b9fe622e70");
791                                                   804 
792     my $CRC="\x0A\xCC";                           805     my $CRC="\x0A\xCC";
793     my $BLOCKS_MAIN="\x27";                       806     my $BLOCKS_MAIN="\x27";
794     open FW,">$fwfile";                           807     open FW,">$fwfile";
795     print FW "\x01\x00"; # just a version id f    808     print FW "\x01\x00"; # just a version id for the driver itself
796     print FW "\x9A"; # fw version                 809     print FW "\x9A"; # fw version
797     print FW "\x00"; # padding                    810     print FW "\x00"; # padding
798     print FW "$BLOCKS_MAIN"; # number of block    811     print FW "$BLOCKS_MAIN"; # number of blocks of main part
799     print FW "\x00"; # padding                    812     print FW "\x00"; # padding
800     print FW "$CRC"; # 16bit crc value of main    813     print FW "$CRC"; # 16bit crc value of main part
801     appendfile(FW,"$tmpdir/fw1");                 814     appendfile(FW,"$tmpdir/fw1");
802                                                   815 
803     "$fwfile";                                    816     "$fwfile";
804 }                                                 817 }
805                                                   818 
806 # --------------------------------------------    819 # ---------------------------------------------------------------
807 # Utilities                                       820 # Utilities
808                                                   821 
809 sub checkstandard {                               822 sub checkstandard {
810     if (system("which unzip > /dev/null 2>&1")    823     if (system("which unzip > /dev/null 2>&1")) {
811         die "This firmware requires the unzip     824         die "This firmware requires the unzip command - see ftp://ftp.info-zip.org/pub/infozip/UnZip.html\n";
812     }                                             825     }
813     if (system("which md5sum > /dev/null 2>&1"    826     if (system("which md5sum > /dev/null 2>&1")) {
814         die "This firmware requires the md5sum    827         die "This firmware requires the md5sum command - see http://www.gnu.org/software/coreutils/\n";
815     }                                             828     }
816     if (system("which wget > /dev/null 2>&1"))    829     if (system("which wget > /dev/null 2>&1")) {
817         die "This firmware requires the wget c    830         die "This firmware requires the wget command - see http://wget.sunsite.dk/\n";
818     }                                             831     }
819 }                                                 832 }
820                                                   833 
821 sub checkunshield {                               834 sub checkunshield {
822     if (system("which unshield > /dev/null 2>&    835     if (system("which unshield > /dev/null 2>&1")) {
823         die "This firmware requires the unshie    836         die "This firmware requires the unshield command - see http://sourceforge.net/projects/synce/\n";
824     }                                             837     }
825 }                                                 838 }
826                                                   839 
827 sub wgetfile {                                    840 sub wgetfile {
828     my ($sourcefile, $url) = @_;                  841     my ($sourcefile, $url) = @_;
829                                                   842 
830     if (! -f $sourcefile) {                       843     if (! -f $sourcefile) {
831         system("wget -O \"$sourcefile\" \"$url    844         system("wget -O \"$sourcefile\" \"$url\"") and die "wget failed - unable to download firmware";
832     }                                             845     }
833 }                                                 846 }
834                                                   847 
835 sub unzip {                                       848 sub unzip {
836     my ($sourcefile, $todir) = @_;                849     my ($sourcefile, $todir) = @_;
837                                                   850 
838     $status = system("unzip -q -o -d \"$todir\    851     $status = system("unzip -q -o -d \"$todir\" \"$sourcefile\" 2>/dev/null" );
839     if ((($status >> 8) > 2) || (($status & 0x    852     if ((($status >> 8) > 2) || (($status & 0xff) != 0)) {
840         die ("unzip failed - unable to extract    853         die ("unzip failed - unable to extract firmware");
841     }                                             854     }
842 }                                                 855 }
843                                                   856 
844 sub unshield {                                    857 sub unshield {
845     my ($sourcefile, $todir) = @_;                858     my ($sourcefile, $todir) = @_;
846                                                   859 
847     system("unshield x -d \"$todir\" \"$source    860     system("unshield x -d \"$todir\" \"$sourcefile\" > /dev/null" ) and die ("unshield failed - unable to extract firmware");
848 }                                                 861 }
849                                                   862 
850 sub verify {                                      863 sub verify {
851     my ($filename, $hash) = @_;                   864     my ($filename, $hash) = @_;
852     my ($testhash);                               865     my ($testhash);
853                                                   866 
854     open(CMD, "md5sum \"$filename\"|");           867     open(CMD, "md5sum \"$filename\"|");
855     $testhash = <CMD>;                            868     $testhash = <CMD>;
856     $testhash =~ /([a-zA-Z0-9]*)/;                869     $testhash =~ /([a-zA-Z0-9]*)/;
857     $testhash = $1;                               870     $testhash = $1;
858     close CMD;                                    871     close CMD;
859     die "Hash of extracted file does not match    872     die "Hash of extracted file does not match!\n" if ($testhash ne $hash);
860 }                                                 873 }
861                                                   874 
862 sub copy {                                        875 sub copy {
863     my ($from, $to) = @_;                         876     my ($from, $to) = @_;
864                                                   877 
865     system("cp -f \"$from\" \"$to\"") and die     878     system("cp -f \"$from\" \"$to\"") and die ("cp failed");
866 }                                                 879 }
867                                                   880 
868 sub extract {                                     881 sub extract {
869     my ($infile, $offset, $length, $outfile) =    882     my ($infile, $offset, $length, $outfile) = @_;
870     my ($chunklength, $buf, $rcount);             883     my ($chunklength, $buf, $rcount);
871                                                   884 
872     open INFILE, "<$infile";                      885     open INFILE, "<$infile";
873     open OUTFILE, ">$outfile";                    886     open OUTFILE, ">$outfile";
874     sysseek(INFILE, $offset, SEEK_SET);           887     sysseek(INFILE, $offset, SEEK_SET);
875     while($length > 0) {                          888     while($length > 0) {
876         # Calc chunk size                         889         # Calc chunk size
877         $chunklength = 2048;                      890         $chunklength = 2048;
878         $chunklength = $length if ($chunklengt    891         $chunklength = $length if ($chunklength > $length);
879                                                   892 
880         $rcount = sysread(INFILE, $buf, $chunk    893         $rcount = sysread(INFILE, $buf, $chunklength);
881         die "Ran out of data\n" if ($rcount !=    894         die "Ran out of data\n" if ($rcount != $chunklength);
882         syswrite(OUTFILE, $buf);                  895         syswrite(OUTFILE, $buf);
883         $length -= $rcount;                       896         $length -= $rcount;
884     }                                             897     }
885     close INFILE;                                 898     close INFILE;
886     close OUTFILE;                                899     close OUTFILE;
887 }                                                 900 }
888                                                   901 
889 sub appendfile {                                  902 sub appendfile {
890     my ($FH, $infile) = @_;                       903     my ($FH, $infile) = @_;
891     my ($buf);                                    904     my ($buf);
892                                                   905 
893     open INFILE, "<$infile";                      906     open INFILE, "<$infile";
894     while(1) {                                    907     while(1) {
895         $rcount = sysread(INFILE, $buf, 2048);    908         $rcount = sysread(INFILE, $buf, 2048);
896         last if ($rcount == 0);                   909         last if ($rcount == 0);
897         print $FH $buf;                           910         print $FH $buf;
898     }                                             911     }
899     close(INFILE);                                912     close(INFILE);
900 }                                                 913 }
901                                                   914 
902 sub delzero{                                      915 sub delzero{
903         my ($infile,$outfile) =@_;                916         my ($infile,$outfile) =@_;
904                                                   917 
905         open INFILE,"<$infile";                   918         open INFILE,"<$infile";
906         open OUTFILE,">$outfile";                 919         open OUTFILE,">$outfile";
907         while (1){                                920         while (1){
908                 $rcount=sysread(INFILE,$buf,22    921                 $rcount=sysread(INFILE,$buf,22);
909                 $len=ord(substr($buf,0,1));       922                 $len=ord(substr($buf,0,1));
910                 print OUTFILE substr($buf,0,1)    923                 print OUTFILE substr($buf,0,1);
911                 print OUTFILE substr($buf,2,$l    924                 print OUTFILE substr($buf,2,$len+3);
912         last if ($rcount<1);                      925         last if ($rcount<1);
913         printf OUTFILE "%c",0;                    926         printf OUTFILE "%c",0;
914 #print $len." ".length($buf)."\n";                927 #print $len." ".length($buf)."\n";
915                                                   928 
916         }                                         929         }
917         close(INFILE);                            930         close(INFILE);
918         close(OUTFILE);                           931         close(OUTFILE);
919 }                                                 932 }
920                                                   933 
921 sub syntax() {                                    934 sub syntax() {
922     print STDERR "syntax: get_dvb_firmware <co    935     print STDERR "syntax: get_dvb_firmware <component>\n";
923     print STDERR "Supported components:\n";       936     print STDERR "Supported components:\n";
924     @components = sort @components;               937     @components = sort @components;
925     for($i=0; $i < scalar(@components); $i++)     938     for($i=0; $i < scalar(@components); $i++) {
926         print STDERR "\t" . $components[$i] .     939         print STDERR "\t" . $components[$i] . "\n";
927     }                                             940     }
928     exit(1);                                      941     exit(1);
929 }                                                 942 }
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php