Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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