2017-05-08 00:25:26 +03:00
|
|
|
#!/usr/bin/env perl
|
2005-04-17 02:20:36 +04:00
|
|
|
# DVB firmware extractor
|
|
|
|
#
|
|
|
|
# (c) 2004 Andrew de Quincey
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
#
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
use File::Temp qw/ tempdir /;
|
|
|
|
use IO::Handle;
|
|
|
|
|
2006-02-07 11:49:09 +03:00
|
|
|
@components = ( "sp8870", "sp887x", "tda10045", "tda10046",
|
|
|
|
"tda10046lifeview", "av7110", "dec2000t", "dec2540t",
|
2012-12-11 00:37:16 +04:00
|
|
|
"dec3000s", "vp7041", "vp7049", "dibusb", "nxt2002", "nxt2004",
|
2007-07-05 02:18:34 +04:00
|
|
|
"or51211", "or51132_qam", "or51132_vsb", "bluebird",
|
2009-09-12 16:43:25 +04:00
|
|
|
"opera1", "cx231xx", "cx18", "cx23885", "pvrusb2", "mpc718",
|
2010-09-03 00:29:30 +04:00
|
|
|
"af9015", "ngene", "az6027", "lme2510_lg", "lme2510c_s7395",
|
2011-11-21 13:43:52 +04:00
|
|
|
"lme2510c_s7395_old", "drxk", "drxk_terratec_h5",
|
2014-02-14 01:32:19 +04:00
|
|
|
"drxk_hauppauge_hvr930c", "tda10071", "it9135", "drxk_pctv",
|
2014-07-23 00:12:11 +04:00
|
|
|
"drxk_terratec_htc_stick", "sms1xxx_hcw", "si2165");
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
# Check args
|
|
|
|
syntax() if (scalar(@ARGV) != 1);
|
|
|
|
$cid = $ARGV[0];
|
|
|
|
|
|
|
|
# Do it!
|
|
|
|
for ($i=0; $i < scalar(@components); $i++) {
|
|
|
|
if ($cid eq $components[$i]) {
|
|
|
|
$outfile = eval($cid);
|
|
|
|
die $@ if $@;
|
2006-01-09 20:25:38 +03:00
|
|
|
print STDERR <<EOF;
|
2009-03-23 16:57:15 +03:00
|
|
|
Firmware(s) $outfile extracted successfully.
|
2010-02-05 13:57:58 +03:00
|
|
|
Now copy it(them) to either /usr/lib/hotplug/firmware or /lib/firmware
|
2006-01-09 20:25:38 +03:00
|
|
|
(depending on configuration of firmware hotplug).
|
|
|
|
EOF
|
2005-04-17 02:20:36 +04:00
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# If we get here, it wasn't found
|
|
|
|
print STDERR "Unknown component \"$cid\"\n";
|
|
|
|
syntax();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Firmware-specific extraction subroutines
|
|
|
|
|
|
|
|
sub sp8870 {
|
|
|
|
my $sourcefile = "tt_Premium_217g.zip";
|
2007-06-16 02:14:52 +04:00
|
|
|
my $url = "http://www.softwarepatch.pl/9999ccd06a4813cb827dbb0005071c71/$sourcefile";
|
2005-04-17 02:20:36 +04:00
|
|
|
my $hash = "53970ec17a538945a6d8cb608a7b3899";
|
|
|
|
my $outfile = "dvb-fe-sp8870.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
verify("$tmpdir/software/OEM/HE/App/boot/SC_MAIN.MC", $hash);
|
|
|
|
copy("$tmpdir/software/OEM/HE/App/boot/SC_MAIN.MC", $outfile);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub sp887x {
|
|
|
|
my $sourcefile = "Dvbt1.3.57.6.zip";
|
|
|
|
my $url = "http://www.avermedia.com/software/$sourcefile";
|
|
|
|
my $cabfile = "DVBT Net Ver1.3.57.6/disk1/data1.cab";
|
|
|
|
my $hash = "237938d53a7f834c05c42b894ca68ac3";
|
|
|
|
my $outfile = "dvb-fe-sp887x.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
checkunshield();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
unshield("$tmpdir/$cabfile", $tmpdir);
|
|
|
|
verify("$tmpdir/ZEnglish/sc_main.mc", $hash);
|
|
|
|
copy("$tmpdir/ZEnglish/sc_main.mc", $outfile);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub tda10045 {
|
|
|
|
my $sourcefile = "tt_budget_217g.zip";
|
|
|
|
my $url = "http://www.technotrend.de/new/217g/$sourcefile";
|
|
|
|
my $hash = "2105fd5bf37842fbcdfa4bfd58f3594a";
|
|
|
|
my $outfile = "dvb-fe-tda10045.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
extract("$tmpdir/software/OEM/PCI/App/ttlcdacc.dll", 0x37ef9, 30555, "$tmpdir/fwtmp");
|
|
|
|
verify("$tmpdir/fwtmp", $hash);
|
|
|
|
copy("$tmpdir/fwtmp", $outfile);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub tda10046 {
|
2007-08-16 00:37:16 +04:00
|
|
|
my $sourcefile = "TT_PCI_2.19h_28_11_2006.zip";
|
2012-09-28 23:16:00 +04:00
|
|
|
my $url = "http://technotrend.com.ua/download/software/219/$sourcefile";
|
2007-08-16 00:37:16 +04:00
|
|
|
my $hash = "6a7e1e2f2644b162ff0502367553c72d";
|
|
|
|
my $outfile = "dvb-fe-tda10046.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-08-16 00:37:16 +04:00
|
|
|
checkstandard();
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-08-16 00:37:16 +04:00
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
extract("$tmpdir/TT_PCI_2.19h_28_11_2006/software/OEM/PCI/App/ttlcdacc.dll", 0x65389, 24478, "$tmpdir/fwtmp");
|
|
|
|
verify("$tmpdir/fwtmp", $hash);
|
|
|
|
copy("$tmpdir/fwtmp", $outfile);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-08-16 00:37:16 +04:00
|
|
|
$outfile;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2006-02-07 11:49:09 +03:00
|
|
|
sub tda10046lifeview {
|
2009-04-10 01:29:16 +04:00
|
|
|
my $sourcefile = "7%5Cdrv_2.11.02.zip";
|
|
|
|
my $url = "http://www.lifeview.hk/dbimages/document/$sourcefile";
|
2006-02-07 11:49:09 +03:00
|
|
|
my $hash = "1ea24dee4eea8fe971686981f34fd2e0";
|
|
|
|
my $outfile = "dvb-fe-tda10046.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
extract("$tmpdir/LVHybrid.sys", 0x8b088, 24602, "$tmpdir/fwtmp");
|
|
|
|
verify("$tmpdir/fwtmp", $hash);
|
|
|
|
copy("$tmpdir/fwtmp", $outfile);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
sub av7110 {
|
|
|
|
my $sourcefile = "dvb-ttpci-01.fw-261d";
|
2015-12-04 15:38:59 +03:00
|
|
|
my $url = "https://linuxtv.org/downloads/firmware/$sourcefile";
|
2005-04-17 02:20:36 +04:00
|
|
|
my $hash = "603431b6259715a8e88f376a53b64e2f";
|
|
|
|
my $outfile = "dvb-ttpci-01.fw";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
verify($sourcefile, $hash);
|
|
|
|
copy($sourcefile, $outfile);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub dec2000t {
|
|
|
|
my $sourcefile = "dec217g.exe";
|
|
|
|
my $url = "http://hauppauge.lightpath.net/de/$sourcefile";
|
|
|
|
my $hash = "bd86f458cee4a8f0a8ce2d20c66215a9";
|
|
|
|
my $outfile = "dvb-ttusb-dec-2000t.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
verify("$tmpdir/software/OEM/STB/App/Boot/STB_PC_T.bin", $hash);
|
|
|
|
copy("$tmpdir/software/OEM/STB/App/Boot/STB_PC_T.bin", $outfile);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub dec2540t {
|
|
|
|
my $sourcefile = "dec217g.exe";
|
|
|
|
my $url = "http://hauppauge.lightpath.net/de/$sourcefile";
|
|
|
|
my $hash = "53e58f4f5b5c2930beee74a7681fed92";
|
|
|
|
my $outfile = "dvb-ttusb-dec-2540t.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
verify("$tmpdir/software/OEM/STB/App/Boot/STB_PC_X.bin", $hash);
|
|
|
|
copy("$tmpdir/software/OEM/STB/App/Boot/STB_PC_X.bin", $outfile);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub dec3000s {
|
|
|
|
my $sourcefile = "dec217g.exe";
|
|
|
|
my $url = "http://hauppauge.lightpath.net/de/$sourcefile";
|
|
|
|
my $hash = "b013ececea83f4d6d8d2a29ac7c1b448";
|
|
|
|
my $outfile = "dvb-ttusb-dec-3000s.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
verify("$tmpdir/software/OEM/STB/App/Boot/STB_PC_S.bin", $hash);
|
|
|
|
copy("$tmpdir/software/OEM/STB/App/Boot/STB_PC_S.bin", $outfile);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
2007-07-05 02:18:34 +04:00
|
|
|
sub opera1{
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 0);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
my $fwfile1="dvb-usb-opera1-fpga-01.fw";
|
|
|
|
my $fwfile2="dvb-usb-opera-01.fw";
|
|
|
|
extract("2830SCap2.sys", 0x62e8, 55024, "$tmpdir/opera1-fpga.fw");
|
|
|
|
extract("2830SLoad2.sys",0x3178,0x3685-0x3178,"$tmpdir/fw1part1");
|
|
|
|
extract("2830SLoad2.sys",0x0980,0x3150-0x0980,"$tmpdir/fw1part2");
|
|
|
|
delzero("$tmpdir/fw1part1","$tmpdir/fw1part1-1");
|
|
|
|
delzero("$tmpdir/fw1part2","$tmpdir/fw1part2-1");
|
|
|
|
verify("$tmpdir/fw1part1-1","5e0909858fdf0b5b09ad48b9fe622e70");
|
|
|
|
verify("$tmpdir/fw1part2-1","d6e146f321427e931df2c6fcadac37a1");
|
|
|
|
verify("$tmpdir/opera1-fpga.fw","0f8133f5e9051f5f3c1928f7e5a1b07d");
|
|
|
|
|
|
|
|
my $RES1="\x01\x92\x7f\x00\x01\x00";
|
|
|
|
my $RES0="\x01\x92\x7f\x00\x00\x00";
|
|
|
|
my $DAT1="\x01\x00\xe6\x00\x01\x00";
|
|
|
|
my $DAT0="\x01\x00\xe6\x00\x00\x00";
|
|
|
|
open FW,">$tmpdir/opera.fw";
|
|
|
|
print FW "$RES1";
|
|
|
|
print FW "$DAT1";
|
|
|
|
print FW "$RES1";
|
|
|
|
print FW "$DAT1";
|
|
|
|
appendfile(FW,"$tmpdir/fw1part1-1");
|
|
|
|
print FW "$RES0";
|
|
|
|
print FW "$DAT0";
|
|
|
|
print FW "$RES1";
|
|
|
|
print FW "$DAT1";
|
|
|
|
appendfile(FW,"$tmpdir/fw1part2-1");
|
|
|
|
print FW "$RES1";
|
|
|
|
print FW "$DAT1";
|
|
|
|
print FW "$RES0";
|
|
|
|
print FW "$DAT0";
|
|
|
|
copy ("$tmpdir/opera1-fpga.fw",$fwfile1);
|
|
|
|
copy ("$tmpdir/opera.fw",$fwfile2);
|
|
|
|
|
|
|
|
$fwfile1.",".$fwfile2;
|
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
sub vp7041 {
|
|
|
|
my $sourcefile = "2.422.zip";
|
|
|
|
my $url = "http://www.twinhan.com/files/driver/USB-Ter/$sourcefile";
|
|
|
|
my $hash = "e88c9372d1f66609a3e7b072c53fbcfe";
|
|
|
|
my $outfile = "dvb-vp7041-2.422.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
extract("$tmpdir/VisionDTV/Drivers/Win2K&XP/UDTTload.sys", 12503, 3036, "$tmpdir/fwtmp1");
|
|
|
|
extract("$tmpdir/VisionDTV/Drivers/Win2K&XP/UDTTload.sys", 2207, 10274, "$tmpdir/fwtmp2");
|
|
|
|
|
|
|
|
my $CMD = "\000\001\000\222\177\000";
|
|
|
|
my $PAD = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000";
|
|
|
|
my ($FW);
|
|
|
|
open $FW, ">$tmpdir/fwtmp3";
|
|
|
|
print $FW "$CMD\001$PAD";
|
|
|
|
print $FW "$CMD\001$PAD";
|
|
|
|
appendfile($FW, "$tmpdir/fwtmp1");
|
|
|
|
print $FW "$CMD\000$PAD";
|
|
|
|
print $FW "$CMD\001$PAD";
|
|
|
|
appendfile($FW, "$tmpdir/fwtmp2");
|
|
|
|
print $FW "$CMD\001$PAD";
|
|
|
|
print $FW "$CMD\000$PAD";
|
|
|
|
close($FW);
|
|
|
|
|
|
|
|
verify("$tmpdir/fwtmp3", $hash);
|
|
|
|
copy("$tmpdir/fwtmp3", $outfile);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
2012-12-11 00:37:16 +04:00
|
|
|
sub vp7049 {
|
|
|
|
my $fwfile = "dvb-usb-vp7049-0.95.fw";
|
|
|
|
my $url = "http://ao2.it/sites/default/files/blog/2012/11/06/linux-support-digicom-digitune-s-vp7049-udtt7049/$fwfile";
|
|
|
|
my $hash = "5609fd295168aea88b25ff43a6f79c36";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($fwfile, $url);
|
|
|
|
verify($fwfile, $hash);
|
|
|
|
|
|
|
|
$fwfile;
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
sub dibusb {
|
2015-12-04 15:38:59 +03:00
|
|
|
my $url = "https://linuxtv.org/downloads/firmware/dvb-usb-dibusb-5.0.0.11.fw";
|
2005-04-17 02:20:36 +04:00
|
|
|
my $outfile = "dvb-dibusb-5.0.0.11.fw";
|
|
|
|
my $hash = "fa490295a527360ca16dcdf3224ca243";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($outfile, $url);
|
|
|
|
verify($outfile,$hash);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub nxt2002 {
|
2006-04-23 08:55:38 +04:00
|
|
|
my $sourcefile = "Technisat_DVB-PC_4_4_COMPACT.zip";
|
2005-04-17 02:20:36 +04:00
|
|
|
my $url = "http://www.bbti.us/download/windows/$sourcefile";
|
2006-04-23 08:55:38 +04:00
|
|
|
my $hash = "476befae8c7c1bb9648954060b1eec1f";
|
2005-04-17 02:20:36 +04:00
|
|
|
my $outfile = "dvb-fe-nxt2002.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
2006-01-09 20:25:34 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
2006-04-23 08:55:38 +04:00
|
|
|
verify("$tmpdir/SkyNET.sys", $hash);
|
|
|
|
extract("$tmpdir/SkyNET.sys", 331624, 5908, $outfile);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
2005-11-09 08:35:46 +03:00
|
|
|
sub nxt2004 {
|
|
|
|
my $sourcefile = "AVerTVHD_MCE_A180_Drv_v1.2.2.16.zip";
|
2009-06-11 23:20:23 +04:00
|
|
|
my $url = "http://www.avermedia-usa.com/support/Drivers/$sourcefile";
|
2005-11-09 08:35:46 +03:00
|
|
|
my $hash = "111cb885b1e009188346d72acfed024c";
|
|
|
|
my $outfile = "dvb-fe-nxt2004.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
verify("$tmpdir/3xHybrid.sys", $hash);
|
|
|
|
extract("$tmpdir/3xHybrid.sys", 465304, 9584, $outfile);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
sub or51211 {
|
|
|
|
my $fwfile = "dvb-fe-or51211.fw";
|
2015-12-04 15:38:59 +03:00
|
|
|
my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
|
2005-04-17 02:20:36 +04:00
|
|
|
my $hash = "d830949c771a289505bf9eafc225d491";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($fwfile, $url);
|
|
|
|
verify($fwfile, $hash);
|
|
|
|
|
|
|
|
$fwfile;
|
|
|
|
}
|
|
|
|
|
2009-03-19 18:10:00 +03:00
|
|
|
sub cx231xx {
|
|
|
|
my $fwfile = "v4l-cx231xx-avcore-01.fw";
|
2015-12-04 15:38:59 +03:00
|
|
|
my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
|
2009-03-19 18:10:00 +03:00
|
|
|
my $hash = "7d3bb956dc9df0eafded2b56ba57cc42";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($fwfile, $url);
|
|
|
|
verify($fwfile, $hash);
|
|
|
|
|
|
|
|
$fwfile;
|
|
|
|
}
|
|
|
|
|
2009-03-23 16:57:15 +03:00
|
|
|
sub cx18 {
|
2015-12-04 15:38:59 +03:00
|
|
|
my $url = "https://linuxtv.org/downloads/firmware/";
|
2009-03-23 16:57:15 +03:00
|
|
|
|
|
|
|
my %files = (
|
|
|
|
'v4l-cx23418-apu.fw' => '588f081b562f5c653a3db1ad8f65939a',
|
|
|
|
'v4l-cx23418-cpu.fw' => 'b6c7ed64bc44b1a6e0840adaeac39d79',
|
|
|
|
'v4l-cx23418-dig.fw' => '95bc688d3e7599fd5800161e9971cc55',
|
|
|
|
);
|
|
|
|
|
|
|
|
checkstandard();
|
2009-03-23 17:46:19 +03:00
|
|
|
|
|
|
|
my $allfiles;
|
|
|
|
foreach my $fwfile (keys %files) {
|
|
|
|
wgetfile($fwfile, "$url/$fwfile");
|
|
|
|
verify($fwfile, $files{$fwfile});
|
|
|
|
$allfiles .= " $fwfile";
|
|
|
|
}
|
|
|
|
|
|
|
|
$allfiles =~ s/^\s//;
|
|
|
|
|
|
|
|
$allfiles;
|
|
|
|
}
|
|
|
|
|
2009-07-03 18:33:17 +04:00
|
|
|
sub mpc718 {
|
|
|
|
my $archive = 'Yuan MPC718 TV Tuner Card 2.13.10.1016.zip';
|
|
|
|
my $url = "ftp://ftp.work.acer-euro.com/desktop/aspire_idea510/vista/Drivers/$archive";
|
|
|
|
my $fwfile = "dvb-cx18-mpc718-mt352.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
wgetfile($archive, $url);
|
|
|
|
unzip($archive, $tmpdir);
|
|
|
|
|
|
|
|
my $sourcefile = "$tmpdir/Yuan MPC718 TV Tuner Card 2.13.10.1016/mpc718_32bit/yuanrap.sys";
|
|
|
|
my $found = 0;
|
|
|
|
|
|
|
|
open IN, '<', $sourcefile or die "Couldn't open $sourcefile to extract $fwfile data\n";
|
|
|
|
binmode IN;
|
|
|
|
open OUT, '>', $fwfile;
|
|
|
|
binmode OUT;
|
|
|
|
{
|
|
|
|
# Block scope because we change the line terminator variable $/
|
|
|
|
my $prevlen = 0;
|
|
|
|
my $currlen;
|
|
|
|
|
|
|
|
# Buried in the data segment are 3 runs of almost identical
|
|
|
|
# register-value pairs that end in 0x5d 0x01 which is a "TUNER GO"
|
|
|
|
# command for the MT352.
|
|
|
|
# Pull out the middle run (because it's easy) of register-value
|
|
|
|
# pairs to make the "firmware" file.
|
|
|
|
|
|
|
|
local $/ = "\x5d\x01"; # MT352 "TUNER GO"
|
|
|
|
|
|
|
|
while (<IN>) {
|
|
|
|
$currlen = length($_);
|
2009-07-05 23:22:45 +04:00
|
|
|
if ($prevlen == $currlen && $currlen <= 64) {
|
2009-07-03 18:33:17 +04:00
|
|
|
chop; chop; # Get rid of "TUNER GO"
|
|
|
|
s/^\0\0//; # get rid of leading 00 00 if it's there
|
|
|
|
printf OUT "$_";
|
|
|
|
$found = 1;
|
|
|
|
last;
|
|
|
|
}
|
2009-07-05 23:22:45 +04:00
|
|
|
$prevlen = $currlen;
|
2009-07-03 18:33:17 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
close OUT;
|
|
|
|
close IN;
|
|
|
|
if (!$found) {
|
|
|
|
unlink $fwfile;
|
|
|
|
die "Couldn't find valid register-value sequence in $sourcefile for $fwfile\n";
|
|
|
|
}
|
|
|
|
$fwfile;
|
|
|
|
}
|
|
|
|
|
2009-03-23 17:46:19 +03:00
|
|
|
sub cx23885 {
|
2015-12-04 15:38:59 +03:00
|
|
|
my $url = "https://linuxtv.org/downloads/firmware/";
|
2009-03-23 17:46:19 +03:00
|
|
|
|
|
|
|
my %files = (
|
|
|
|
'v4l-cx23885-avcore-01.fw' => 'a9f8f5d901a7fb42f552e1ee6384f3bb',
|
|
|
|
'v4l-cx23885-enc.fw' => 'a9f8f5d901a7fb42f552e1ee6384f3bb',
|
2009-03-23 18:35:03 +03:00
|
|
|
);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
my $allfiles;
|
|
|
|
foreach my $fwfile (keys %files) {
|
|
|
|
wgetfile($fwfile, "$url/$fwfile");
|
|
|
|
verify($fwfile, $files{$fwfile});
|
|
|
|
$allfiles .= " $fwfile";
|
|
|
|
}
|
|
|
|
|
|
|
|
$allfiles =~ s/^\s//;
|
|
|
|
|
|
|
|
$allfiles;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub pvrusb2 {
|
2015-12-04 15:38:59 +03:00
|
|
|
my $url = "https://linuxtv.org/downloads/firmware/";
|
2009-03-23 18:35:03 +03:00
|
|
|
|
|
|
|
my %files = (
|
2009-03-23 17:46:19 +03:00
|
|
|
'v4l-cx25840.fw' => 'dadb79e9904fc8af96e8111d9cb59320',
|
|
|
|
);
|
|
|
|
|
|
|
|
checkstandard();
|
2009-03-23 16:57:15 +03:00
|
|
|
|
|
|
|
my $allfiles;
|
|
|
|
foreach my $fwfile (keys %files) {
|
|
|
|
wgetfile($fwfile, "$url/$fwfile");
|
|
|
|
verify($fwfile, $files{$fwfile});
|
|
|
|
$allfiles .= " $fwfile";
|
|
|
|
}
|
|
|
|
|
|
|
|
$allfiles =~ s/^\s//;
|
|
|
|
|
|
|
|
$allfiles;
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
sub or51132_qam {
|
|
|
|
my $fwfile = "dvb-fe-or51132-qam.fw";
|
2015-12-04 15:38:59 +03:00
|
|
|
my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
|
2005-04-17 02:20:36 +04:00
|
|
|
my $hash = "7702e8938612de46ccadfe9b413cb3b5";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($fwfile, $url);
|
|
|
|
verify($fwfile, $hash);
|
|
|
|
|
|
|
|
$fwfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub or51132_vsb {
|
|
|
|
my $fwfile = "dvb-fe-or51132-vsb.fw";
|
2015-12-04 15:38:59 +03:00
|
|
|
my $url = "https://linuxtv.org/downloads/firmware/$fwfile";
|
2005-04-17 02:20:36 +04:00
|
|
|
my $hash = "c16208e02f36fc439a557ad4c613364a";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($fwfile, $url);
|
|
|
|
verify($fwfile, $hash);
|
|
|
|
|
|
|
|
$fwfile;
|
|
|
|
}
|
|
|
|
|
2006-01-09 20:32:42 +03:00
|
|
|
sub bluebird {
|
2015-12-04 15:38:59 +03:00
|
|
|
my $url = "https://linuxtv.org/download/dvb/firmware/dvb-usb-bluebird-01.fw";
|
2006-01-09 20:32:42 +03:00
|
|
|
my $outfile = "dvb-usb-bluebird-01.fw";
|
|
|
|
my $hash = "658397cb9eba9101af9031302671f49d";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($outfile, $url);
|
|
|
|
verify($outfile,$hash);
|
|
|
|
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
2009-09-12 16:43:25 +04:00
|
|
|
sub af9015 {
|
|
|
|
my $sourcefile = "download.ashx?file=57";
|
|
|
|
my $url = "http://www.ite.com.tw/EN/Services/$sourcefile";
|
2010-05-14 22:24:28 +04:00
|
|
|
my $hash = "e3f08935158038d385ad382442f4bb2d";
|
2009-09-12 16:43:25 +04:00
|
|
|
my $outfile = "dvb-usb-af9015.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
2010-05-14 22:24:28 +04:00
|
|
|
my $fwoffset = 0x25690;
|
|
|
|
my $fwlength = 18725;
|
2009-09-12 16:43:25 +04:00
|
|
|
my ($chunklength, $buf, $rcount);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
verify("$tmpdir/Driver/Files/AF15BDA.sys", $hash);
|
|
|
|
|
|
|
|
open INFILE, '<', "$tmpdir/Driver/Files/AF15BDA.sys";
|
|
|
|
open OUTFILE, '>', $outfile;
|
|
|
|
|
|
|
|
sysseek(INFILE, $fwoffset, SEEK_SET);
|
|
|
|
while($fwlength > 0) {
|
|
|
|
$chunklength = 55;
|
|
|
|
$chunklength = $fwlength if ($chunklength > $fwlength);
|
|
|
|
$rcount = sysread(INFILE, $buf, $chunklength);
|
|
|
|
die "Ran out of data\n" if ($rcount != $chunklength);
|
|
|
|
syswrite(OUTFILE, $buf);
|
|
|
|
sysread(INFILE, $buf, 8);
|
|
|
|
$fwlength -= $rcount + 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
close OUTFILE;
|
|
|
|
close INFILE;
|
|
|
|
}
|
|
|
|
|
2010-02-05 13:52:44 +03:00
|
|
|
sub ngene {
|
|
|
|
my $url = "http://www.digitaldevices.de/download/";
|
|
|
|
my $file1 = "ngene_15.fw";
|
|
|
|
my $hash1 = "d798d5a757121174f0dbc5f2833c0c85";
|
|
|
|
my $file2 = "ngene_17.fw";
|
|
|
|
my $hash2 = "26b687136e127b8ac24b81e0eeafc20b";
|
2011-01-10 12:36:19 +03:00
|
|
|
my $url2 = "http://l4m-daten.de/downloads/firmware/dvb-s2/linux/all/";
|
|
|
|
my $file3 = "ngene_18.fw";
|
|
|
|
my $hash3 = "ebce3ea769a53e3e0b0197c3b3f127e3";
|
2010-02-05 13:52:44 +03:00
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($file1, $url . $file1);
|
|
|
|
verify($file1, $hash1);
|
|
|
|
|
|
|
|
wgetfile($file2, $url . $file2);
|
|
|
|
verify($file2, $hash2);
|
|
|
|
|
2011-01-10 12:36:19 +03:00
|
|
|
wgetfile($file3, $url2 . $file3);
|
|
|
|
verify($file3, $hash3);
|
|
|
|
|
|
|
|
"$file1, $file2, $file3";
|
2010-02-05 13:52:44 +03:00
|
|
|
}
|
|
|
|
|
2010-07-06 14:23:33 +04:00
|
|
|
sub az6027{
|
|
|
|
my $firmware = "dvb-usb-az6027-03.fw";
|
2011-10-09 13:43:50 +04:00
|
|
|
my $url = "http://linux.terratec.de/files/TERRATEC_S7/$firmware";
|
2010-07-06 14:23:33 +04:00
|
|
|
|
2011-10-09 13:43:50 +04:00
|
|
|
wgetfile($firmware, $url);
|
2010-07-06 14:23:33 +04:00
|
|
|
|
|
|
|
$firmware;
|
|
|
|
}
|
2010-09-03 00:29:30 +04:00
|
|
|
|
|
|
|
sub lme2510_lg {
|
|
|
|
my $sourcefile = "LMEBDA_DVBS.sys";
|
|
|
|
my $hash = "fc6017ad01e79890a97ec53bea157ed2";
|
|
|
|
my $outfile = "dvb-usb-lme2510-lg.fw";
|
|
|
|
my $hasho = "caa065d5fdbd2c09ad57b399bbf55cad";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
verify($sourcefile, $hash);
|
|
|
|
extract($sourcefile, 4168, 3841, $outfile);
|
|
|
|
verify($outfile, $hasho);
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub lme2510c_s7395 {
|
|
|
|
my $sourcefile = "US2A0D.sys";
|
|
|
|
my $hash = "b0155a8083fb822a3bd47bc360e74601";
|
|
|
|
my $outfile = "dvb-usb-lme2510c-s7395.fw";
|
|
|
|
my $hasho = "3a3cf1aeebd17b6ddc04cebe131e94cf";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
verify($sourcefile, $hash);
|
|
|
|
extract($sourcefile, 37248, 3720, $outfile);
|
|
|
|
verify($outfile, $hasho);
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub lme2510c_s7395_old {
|
|
|
|
my $sourcefile = "LMEBDA_DVBS7395C.sys";
|
|
|
|
my $hash = "7572ae0eb9cdf91baabd7c0ba9e09b31";
|
|
|
|
my $outfile = "dvb-usb-lme2510c-s7395.fw";
|
|
|
|
my $hasho = "90430c5b435eb5c6f88fd44a9d950674";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
verify($sourcefile, $hash);
|
|
|
|
extract($sourcefile, 4208, 3881, $outfile);
|
|
|
|
verify($outfile, $hasho);
|
|
|
|
$outfile;
|
|
|
|
}
|
|
|
|
|
2011-07-03 20:53:50 +04:00
|
|
|
sub drxk {
|
|
|
|
my $url = "http://l4m-daten.de/files/";
|
|
|
|
my $zipfile = "DDTuner.zip";
|
|
|
|
my $hash = "f5a37b9a20a3534997997c0b1382a3e5";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
my $drvfile = "DDTuner.sys";
|
|
|
|
my $fwfile = "drxk_a3.mc";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($zipfile, $url . $zipfile);
|
|
|
|
verify($zipfile, $hash);
|
|
|
|
unzip($zipfile, $tmpdir);
|
|
|
|
extract("$tmpdir/$drvfile", 0x14dd8, 15634, "$fwfile");
|
|
|
|
|
|
|
|
"$fwfile"
|
|
|
|
}
|
|
|
|
|
2011-11-21 13:43:52 +04:00
|
|
|
sub drxk_hauppauge_hvr930c {
|
|
|
|
my $url = "http://www.wintvcd.co.uk/drivers/";
|
|
|
|
my $zipfile = "HVR-9x0_5_10_325_28153_SIGNED.zip";
|
|
|
|
my $hash = "83ab82e7e9480ec8bf1ae0155ca63c88";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
my $drvfile = "HVR-900/emOEM.sys";
|
|
|
|
my $fwfile = "dvb-usb-hauppauge-hvr930c-drxk.fw";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($zipfile, $url . $zipfile);
|
|
|
|
verify($zipfile, $hash);
|
|
|
|
unzip($zipfile, $tmpdir);
|
|
|
|
extract("$tmpdir/$drvfile", 0x117b0, 42692, "$fwfile");
|
|
|
|
|
|
|
|
"$fwfile"
|
|
|
|
}
|
|
|
|
|
2011-07-11 21:33:51 +04:00
|
|
|
sub drxk_terratec_h5 {
|
2015-12-04 15:38:59 +03:00
|
|
|
my $url = "https://linuxtv.org/downloads/firmware/";
|
2011-07-11 21:33:51 +04:00
|
|
|
my $hash = "19000dada8e2741162ccc50cc91fa7f1";
|
|
|
|
my $fwfile = "dvb-usb-terratec-h5-drxk.fw";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($fwfile, $url . $fwfile);
|
|
|
|
verify($fwfile, $hash);
|
|
|
|
|
|
|
|
"$fwfile"
|
|
|
|
}
|
|
|
|
|
2012-06-13 01:19:26 +04:00
|
|
|
sub drxk_terratec_htc_stick {
|
2013-01-01 15:54:26 +04:00
|
|
|
my $url = "http://ftp.terratec.de/Receiver/Cinergy_HTC_Stick/Updates/History/";
|
2012-06-13 01:19:26 +04:00
|
|
|
my $zipfile = "Cinergy_HTC_Stick_Drv_5.09.1202.00_XP_Vista_7.exe";
|
|
|
|
my $hash = "6722a2442a05423b781721fbc069ed5e";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 0);
|
|
|
|
my $drvfile = "Cinergy HTC Stick/BDA Driver 5.09.1202.00/Windows 32 Bit/emOEM.sys";
|
|
|
|
my $fwfile = "dvb-usb-terratec-htc-stick-drxk.fw";
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($zipfile, $url . $zipfile);
|
|
|
|
verify($zipfile, $hash);
|
|
|
|
unzip($zipfile, $tmpdir);
|
|
|
|
extract("$tmpdir/$drvfile", 0x4e5c0, 42692, "$fwfile");
|
|
|
|
|
|
|
|
"$fwfile"
|
|
|
|
}
|
|
|
|
|
2011-07-27 15:43:38 +04:00
|
|
|
sub it9135 {
|
2014-08-01 13:19:58 +04:00
|
|
|
my $url = "http://www.ite.com.tw/uploads/firmware/v3.25.0.0/";
|
|
|
|
my $file1 = "dvb-usb-it9135-01.zip";
|
2011-12-01 00:17:43 +04:00
|
|
|
my $fwfile1 = "dvb-usb-it9135-01.fw";
|
2014-08-01 13:19:58 +04:00
|
|
|
my $hash1 = "02fcf11174eda84745dae7e61c5ff9ba";
|
|
|
|
my $file2 = "dvb-usb-it9135-02.zip";
|
2011-12-01 00:17:43 +04:00
|
|
|
my $fwfile2 = "dvb-usb-it9135-02.fw";
|
2014-08-01 13:19:58 +04:00
|
|
|
my $hash2 = "d5e1437dc24358578e07999475d4cac9";
|
2011-12-01 00:17:43 +04:00
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
2014-08-01 13:19:58 +04:00
|
|
|
wgetfile($file1, $url . $file1);
|
|
|
|
unzip($file1, "");
|
|
|
|
verify("$fwfile1", $hash1);
|
|
|
|
|
|
|
|
wgetfile($file2, $url . $file2);
|
|
|
|
unzip($file2, "");
|
|
|
|
verify("$fwfile2", $hash2);
|
2011-12-01 00:17:43 +04:00
|
|
|
|
2014-08-01 13:19:58 +04:00
|
|
|
"$file1 $file2"
|
2011-12-01 00:17:43 +04:00
|
|
|
}
|
|
|
|
|
2011-08-02 06:34:58 +04:00
|
|
|
sub tda10071 {
|
2011-08-02 18:35:06 +04:00
|
|
|
my $sourcefile = "PCTV_460e_reference.zip";
|
2011-08-02 06:34:58 +04:00
|
|
|
my $url = "ftp://ftp.pctvsystems.com/TV/driver/PCTV%2070e%2080e%20100e%20320e%20330e%20800e/";
|
|
|
|
my $hash = "4403de903bf2593464c8d74bbc200a57";
|
|
|
|
my $fwfile = "dvb-fe-tda10071.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
2011-07-27 15:43:38 +04:00
|
|
|
|
2011-08-02 06:34:58 +04:00
|
|
|
wgetfile($sourcefile, $url . $sourcefile);
|
|
|
|
verify($sourcefile, $hash);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
extract("$tmpdir/PCTV\ 70e\ 80e\ 100e\ 320e\ 330e\ 800e/32\ bit/emOEM.sys", 0x67d38, 40504, $fwfile);
|
|
|
|
|
|
|
|
"$fwfile";
|
|
|
|
}
|
2011-07-27 15:43:38 +04:00
|
|
|
|
2012-03-19 18:48:18 +04:00
|
|
|
sub drxk_pctv {
|
|
|
|
my $sourcefile = "PCTV_460e_reference.zip";
|
|
|
|
my $url = "ftp://ftp.pctvsystems.com/TV/driver/PCTV%2070e%2080e%20100e%20320e%20330e%20800e/";
|
|
|
|
my $hash = "4403de903bf2593464c8d74bbc200a57";
|
|
|
|
my $fwfile = "dvb-demod-drxk-pctv.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url . $sourcefile);
|
|
|
|
verify($sourcefile, $hash);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
extract("$tmpdir/PCTV\ 70e\ 80e\ 100e\ 320e\ 330e\ 800e/32\ bit/emOEM.sys", 0x72b80, 42692, $fwfile);
|
|
|
|
|
|
|
|
"$fwfile";
|
|
|
|
}
|
|
|
|
|
2012-07-06 05:35:55 +04:00
|
|
|
sub sms1xxx_hcw {
|
|
|
|
my $url = "http://steventoth.net/linux/sms1xxx/";
|
|
|
|
my %files = (
|
|
|
|
'sms1xxx-hcw-55xxx-dvbt-01.fw' => "afb6f9fb9a71d64392e8564ef9577e5a",
|
|
|
|
'sms1xxx-hcw-55xxx-dvbt-02.fw' => "b44807098ba26e52cbedeadc052ba58f",
|
|
|
|
'sms1xxx-hcw-55xxx-isdbt-02.fw' => "dae934eeea85225acbd63ce6cfe1c9e4",
|
|
|
|
);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
my $allfiles;
|
|
|
|
foreach my $fwfile (keys %files) {
|
|
|
|
wgetfile($fwfile, "$url/$fwfile");
|
|
|
|
verify($fwfile, $files{$fwfile});
|
|
|
|
$allfiles .= " $fwfile";
|
|
|
|
}
|
|
|
|
|
|
|
|
$allfiles =~ s/^\s//;
|
|
|
|
|
|
|
|
$allfiles;
|
|
|
|
}
|
|
|
|
|
2014-07-23 00:12:11 +04:00
|
|
|
sub si2165 {
|
|
|
|
my $sourcefile = "model_111xxx_122xxx_driver_6_0_119_31191_WHQL.zip";
|
|
|
|
my $url = "http://www.hauppauge.de/files/drivers/";
|
|
|
|
my $hash = "76633e7c76b0edee47c3ba18ded99336";
|
|
|
|
my $fwfile = "dvb-demod-si2165.fw";
|
|
|
|
my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1);
|
|
|
|
|
|
|
|
checkstandard();
|
|
|
|
|
|
|
|
wgetfile($sourcefile, $url . $sourcefile);
|
|
|
|
verify($sourcefile, $hash);
|
|
|
|
unzip($sourcefile, $tmpdir);
|
|
|
|
extract("$tmpdir/Driver10/Hcw10bda.sys", 0x80788, 0x81E08-0x80788, "$tmpdir/fw1");
|
|
|
|
|
|
|
|
delzero("$tmpdir/fw1","$tmpdir/fw1-1");
|
|
|
|
#verify("$tmpdir/fw1","5e0909858fdf0b5b09ad48b9fe622e70");
|
|
|
|
|
|
|
|
my $CRC="\x0A\xCC";
|
|
|
|
my $BLOCKS_MAIN="\x27";
|
|
|
|
open FW,">$fwfile";
|
|
|
|
print FW "\x01\x00"; # just a version id for the driver itself
|
|
|
|
print FW "\x9A"; # fw version
|
|
|
|
print FW "\x00"; # padding
|
|
|
|
print FW "$BLOCKS_MAIN"; # number of blocks of main part
|
|
|
|
print FW "\x00"; # padding
|
|
|
|
print FW "$CRC"; # 16bit crc value of main part
|
|
|
|
appendfile(FW,"$tmpdir/fw1");
|
|
|
|
|
|
|
|
"$fwfile";
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Utilities
|
|
|
|
|
|
|
|
sub checkstandard {
|
|
|
|
if (system("which unzip > /dev/null 2>&1")) {
|
|
|
|
die "This firmware requires the unzip command - see ftp://ftp.info-zip.org/pub/infozip/UnZip.html\n";
|
|
|
|
}
|
|
|
|
if (system("which md5sum > /dev/null 2>&1")) {
|
|
|
|
die "This firmware requires the md5sum command - see http://www.gnu.org/software/coreutils/\n";
|
|
|
|
}
|
|
|
|
if (system("which wget > /dev/null 2>&1")) {
|
|
|
|
die "This firmware requires the wget command - see http://wget.sunsite.dk/\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub checkunshield {
|
|
|
|
if (system("which unshield > /dev/null 2>&1")) {
|
|
|
|
die "This firmware requires the unshield command - see http://sourceforge.net/projects/synce/\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub wgetfile {
|
|
|
|
my ($sourcefile, $url) = @_;
|
|
|
|
|
|
|
|
if (! -f $sourcefile) {
|
|
|
|
system("wget -O \"$sourcefile\" \"$url\"") and die "wget failed - unable to download firmware";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub unzip {
|
|
|
|
my ($sourcefile, $todir) = @_;
|
|
|
|
|
|
|
|
$status = system("unzip -q -o -d \"$todir\" \"$sourcefile\" 2>/dev/null" );
|
|
|
|
if ((($status >> 8) > 2) || (($status & 0xff) != 0)) {
|
|
|
|
die ("unzip failed - unable to extract firmware");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub unshield {
|
|
|
|
my ($sourcefile, $todir) = @_;
|
|
|
|
|
|
|
|
system("unshield x -d \"$todir\" \"$sourcefile\" > /dev/null" ) and die ("unshield failed - unable to extract firmware");
|
|
|
|
}
|
|
|
|
|
|
|
|
sub verify {
|
|
|
|
my ($filename, $hash) = @_;
|
|
|
|
my ($testhash);
|
|
|
|
|
|
|
|
open(CMD, "md5sum \"$filename\"|");
|
|
|
|
$testhash = <CMD>;
|
|
|
|
$testhash =~ /([a-zA-Z0-9]*)/;
|
|
|
|
$testhash = $1;
|
|
|
|
close CMD;
|
|
|
|
die "Hash of extracted file does not match!\n" if ($testhash ne $hash);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub copy {
|
|
|
|
my ($from, $to) = @_;
|
|
|
|
|
|
|
|
system("cp -f \"$from\" \"$to\"") and die ("cp failed");
|
|
|
|
}
|
|
|
|
|
|
|
|
sub extract {
|
|
|
|
my ($infile, $offset, $length, $outfile) = @_;
|
|
|
|
my ($chunklength, $buf, $rcount);
|
|
|
|
|
|
|
|
open INFILE, "<$infile";
|
|
|
|
open OUTFILE, ">$outfile";
|
|
|
|
sysseek(INFILE, $offset, SEEK_SET);
|
|
|
|
while($length > 0) {
|
|
|
|
# Calc chunk size
|
|
|
|
$chunklength = 2048;
|
|
|
|
$chunklength = $length if ($chunklength > $length);
|
|
|
|
|
|
|
|
$rcount = sysread(INFILE, $buf, $chunklength);
|
|
|
|
die "Ran out of data\n" if ($rcount != $chunklength);
|
|
|
|
syswrite(OUTFILE, $buf);
|
|
|
|
$length -= $rcount;
|
|
|
|
}
|
|
|
|
close INFILE;
|
|
|
|
close OUTFILE;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub appendfile {
|
|
|
|
my ($FH, $infile) = @_;
|
|
|
|
my ($buf);
|
|
|
|
|
|
|
|
open INFILE, "<$infile";
|
|
|
|
while(1) {
|
|
|
|
$rcount = sysread(INFILE, $buf, 2048);
|
|
|
|
last if ($rcount == 0);
|
|
|
|
print $FH $buf;
|
|
|
|
}
|
|
|
|
close(INFILE);
|
|
|
|
}
|
|
|
|
|
2007-07-05 02:18:34 +04:00
|
|
|
sub delzero{
|
|
|
|
my ($infile,$outfile) =@_;
|
|
|
|
|
|
|
|
open INFILE,"<$infile";
|
|
|
|
open OUTFILE,">$outfile";
|
|
|
|
while (1){
|
|
|
|
$rcount=sysread(INFILE,$buf,22);
|
|
|
|
$len=ord(substr($buf,0,1));
|
|
|
|
print OUTFILE substr($buf,0,1);
|
|
|
|
print OUTFILE substr($buf,2,$len+3);
|
|
|
|
last if ($rcount<1);
|
|
|
|
printf OUTFILE "%c",0;
|
|
|
|
#print $len." ".length($buf)."\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
close(INFILE);
|
|
|
|
close(OUTFILE);
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
sub syntax() {
|
|
|
|
print STDERR "syntax: get_dvb_firmware <component>\n";
|
|
|
|
print STDERR "Supported components:\n";
|
2010-02-05 13:57:58 +03:00
|
|
|
@components = sort @components;
|
2005-04-17 02:20:36 +04:00
|
|
|
for($i=0; $i < scalar(@components); $i++) {
|
|
|
|
print STDERR "\t" . $components[$i] . "\n";
|
|
|
|
}
|
|
|
|
exit(1);
|
|
|
|
}
|