~ [ 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-2.6.0)


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

~ [ 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