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