diff options
author | Daniel Pielmeier <billie@gentoo.org> | 2009-10-08 16:05:48 +0000 |
---|---|---|
committer | Daniel Pielmeier <billie@gentoo.org> | 2009-10-08 16:05:48 +0000 |
commit | ca67ff2d5952cb819ed720d06268b98b6978107f (patch) | |
tree | 6cb6fa42235b447ca6fa9067f034201bd69c6ae6 /media-tv/linuxtv-dvb-firmware | |
parent | [kde-base] Drop KDE 4.3.0 (diff) | |
download | gentoo-2-ca67ff2d5952cb819ed720d06268b98b6978107f.tar.gz gentoo-2-ca67ff2d5952cb819ed720d06268b98b6978107f.tar.bz2 gentoo-2-ca67ff2d5952cb819ed720d06268b98b6978107f.zip |
Version bump. Use updated get-dvb-firmware script to extract the usb-af9015 firmware from installer instead of downloading the pre-extracted firmware. Remove old.
(Portage version: 2.1.6.13/cvs/Linux i686)
Diffstat (limited to 'media-tv/linuxtv-dvb-firmware')
-rw-r--r-- | media-tv/linuxtv-dvb-firmware/ChangeLog | 12 | ||||
-rw-r--r-- | media-tv/linuxtv-dvb-firmware/files/get_dvb_firmware-2009.09.19 | 674 | ||||
-rw-r--r-- | media-tv/linuxtv-dvb-firmware/linuxtv-dvb-firmware-2009.09.19.ebuild (renamed from media-tv/linuxtv-dvb-firmware/linuxtv-dvb-firmware-2009.07.06.ebuild) | 55 |
3 files changed, 719 insertions, 22 deletions
diff --git a/media-tv/linuxtv-dvb-firmware/ChangeLog b/media-tv/linuxtv-dvb-firmware/ChangeLog index bda2c464b338..957b095a974d 100644 --- a/media-tv/linuxtv-dvb-firmware/ChangeLog +++ b/media-tv/linuxtv-dvb-firmware/ChangeLog @@ -1,6 +1,16 @@ # ChangeLog for media-tv/linuxtv-dvb-firmware # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-tv/linuxtv-dvb-firmware/ChangeLog,v 1.26 2009/09/10 18:01:24 billie Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-tv/linuxtv-dvb-firmware/ChangeLog,v 1.27 2009/10/08 16:05:47 billie Exp $ + +*linuxtv-dvb-firmware-2009.09.19 (08 Oct 2009) + + 08 Oct 2009; Pielmeier Daniel <billie@gentoo.org> + -linuxtv-dvb-firmware-2009.07.06.ebuild, + +files/get_dvb_firmware-2009.09.19, + +linuxtv-dvb-firmware-2009.09.19.ebuild: + Version bump. Use updated get-dvb-firmware script to extract the + usb-af9015 firmware from installer instead of downloading the + pre-extracted firmware. Remove old. 10 Sep 2009; Pielmeier Daniel <billie@gentoo.org> -files/get_dvb_firmware-1, -linuxtv-dvb-firmware-1.ebuild, diff --git a/media-tv/linuxtv-dvb-firmware/files/get_dvb_firmware-2009.09.19 b/media-tv/linuxtv-dvb-firmware/files/get_dvb_firmware-2009.09.19 new file mode 100644 index 000000000000..dcb86d5d4556 --- /dev/null +++ b/media-tv/linuxtv-dvb-firmware/files/get_dvb_firmware-2009.09.19 @@ -0,0 +1,674 @@ +#!/usr/bin/perl +# 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; + +@components = ( "sp8870", "sp887x", "tda10045", "tda10046", + "tda10046lifeview", "av7110", "dec2000t", "dec2540t", + "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004", + "or51211", "or51132_qam", "or51132_vsb", "bluebird", + "opera1", "cx231xx", "cx18", "cx23885", "pvrusb2", "mpc718", + "af9015"); + +# 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 $@; + print STDERR <<EOF; +Firmware(s) $outfile extracted successfully. +Now copy it(they) to either /usr/lib/hotplug/firmware or /lib/firmware +(depending on configuration of firmware hotplug). +EOF + 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"; + my $url = "http://2.download.softwarepatch.pl/1619edb0dcb493dd5337b94a1f79c3f6/$sourcefile"; + 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 { + my $sourcefile = "TT_PCI_2.19h_28_11_2006.zip"; + my $url = "http://www.tt-download.com/download/updates/219/$sourcefile"; + my $hash = "6a7e1e2f2644b162ff0502367553c72d"; + my $outfile = "dvb-fe-tda10046.fw"; + my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); + + checkstandard(); + + 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); + + $outfile; +} + +sub tda10046lifeview { + my $sourcefile = "7%5Cdrv_2.11.02.zip"; + my $url = "http://www.lifeview.hk/dbimages/document/$sourcefile"; + 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; +} + +sub av7110 { + my $sourcefile = "dvb-ttpci-01.fw-261d"; + my $url = "http://www.linuxtv.org/downloads/firmware/$sourcefile"; + 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; +} +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; +} + +sub vp7041 { + my $sourcefile = "TwinhanDTV2.608a.zip"; + my $url = "http://www.twinhan.com/files/AW/Software/$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/TwinhanDTV2.608a/Drivers/7041/WinXP/UDTTload.sys", 12503, 3036, "$tmpdir/fwtmp1"); + extract("$tmpdir/TwinhanDTV2.608a/Drivers/7041/WinXP/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; +} + +sub dibusb { + my $url = "http://www.linuxtv.org/downloads/firmware/dvb-usb-dibusb-5.0.0.11.fw"; + my $outfile = "dvb-dibusb-5.0.0.11.fw"; + my $hash = "fa490295a527360ca16dcdf3224ca243"; + + checkstandard(); + + wgetfile($outfile, $url); + verify($outfile,$hash); + + $outfile; +} + +sub nxt2002 { + my $sourcefile = "Technisat_DVB-PC_4_4_COMPACT.zip"; + my $url = "http://www.bbti.us/download/windows/$sourcefile"; + my $hash = "476befae8c7c1bb9648954060b1eec1f"; + my $outfile = "dvb-fe-nxt2002.fw"; + my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); + + checkstandard(); + + wgetfile($sourcefile, $url); + unzip($sourcefile, $tmpdir); + verify("$tmpdir/SkyNET.sys", $hash); + extract("$tmpdir/SkyNET.sys", 331624, 5908, $outfile); + + $outfile; +} + +sub nxt2004 { + my $sourcefile = "AVerTVHD_MCE_A180_Drv_v1.2.2.16.zip"; + my $url = "http://www.avermedia-usa.com/support/Drivers/$sourcefile"; + 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; +} + +sub or51211 { + my $fwfile = "dvb-fe-or51211.fw"; + my $url = "http://linuxtv.org/downloads/firmware/$fwfile"; + my $hash = "d830949c771a289505bf9eafc225d491"; + + checkstandard(); + + wgetfile($fwfile, $url); + verify($fwfile, $hash); + + $fwfile; +} + +sub cx231xx { + my $fwfile = "v4l-cx231xx-avcore-01.fw"; + my $url = "http://linuxtv.org/downloads/firmware/$fwfile"; + my $hash = "7d3bb956dc9df0eafded2b56ba57cc42"; + + checkstandard(); + + wgetfile($fwfile, $url); + verify($fwfile, $hash); + + $fwfile; +} + +sub cx18 { + my $url = "http://linuxtv.org/downloads/firmware/"; + + my %files = ( + 'v4l-cx23418-apu.fw' => '588f081b562f5c653a3db1ad8f65939a', + 'v4l-cx23418-cpu.fw' => 'b6c7ed64bc44b1a6e0840adaeac39d79', + 'v4l-cx23418-dig.fw' => '95bc688d3e7599fd5800161e9971cc55', + ); + + checkstandard(); + + my $allfiles; + foreach my $fwfile (keys %files) { + wgetfile($fwfile, "$url/$fwfile"); + verify($fwfile, $files{$fwfile}); + $allfiles .= " $fwfile"; + } + + $allfiles =~ s/^\s//; + + $allfiles; +} + +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($_); + if ($prevlen == $currlen && $currlen <= 64) { + 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; + } + $prevlen = $currlen; + } + } + close OUT; + close IN; + if (!$found) { + unlink $fwfile; + die "Couldn't find valid register-value sequence in $sourcefile for $fwfile\n"; + } + $fwfile; +} + +sub cx23885 { + my $url = "http://linuxtv.org/downloads/firmware/"; + + my %files = ( + 'v4l-cx23885-avcore-01.fw' => 'a9f8f5d901a7fb42f552e1ee6384f3bb', + 'v4l-cx23885-enc.fw' => 'a9f8f5d901a7fb42f552e1ee6384f3bb', + ); + + checkstandard(); + + my $allfiles; + foreach my $fwfile (keys %files) { + wgetfile($fwfile, "$url/$fwfile"); + verify($fwfile, $files{$fwfile}); + $allfiles .= " $fwfile"; + } + + $allfiles =~ s/^\s//; + + $allfiles; +} + +sub pvrusb2 { + my $url = "http://linuxtv.org/downloads/firmware/"; + + my %files = ( + 'v4l-cx25840.fw' => 'dadb79e9904fc8af96e8111d9cb59320', + ); + + checkstandard(); + + my $allfiles; + foreach my $fwfile (keys %files) { + wgetfile($fwfile, "$url/$fwfile"); + verify($fwfile, $files{$fwfile}); + $allfiles .= " $fwfile"; + } + + $allfiles =~ s/^\s//; + + $allfiles; +} + +sub or51132_qam { + my $fwfile = "dvb-fe-or51132-qam.fw"; + my $url = "http://linuxtv.org/downloads/firmware/$fwfile"; + my $hash = "7702e8938612de46ccadfe9b413cb3b5"; + + checkstandard(); + + wgetfile($fwfile, $url); + verify($fwfile, $hash); + + $fwfile; +} + +sub or51132_vsb { + my $fwfile = "dvb-fe-or51132-vsb.fw"; + my $url = "http://linuxtv.org/downloads/firmware/$fwfile"; + my $hash = "c16208e02f36fc439a557ad4c613364a"; + + checkstandard(); + + wgetfile($fwfile, $url); + verify($fwfile, $hash); + + $fwfile; +} + +sub bluebird { + my $url = "http://www.linuxtv.org/download/dvb/firmware/dvb-usb-bluebird-01.fw"; + my $outfile = "dvb-usb-bluebird-01.fw"; + my $hash = "658397cb9eba9101af9031302671f49d"; + + checkstandard(); + + wgetfile($outfile, $url); + verify($outfile,$hash); + + $outfile; +} + +sub af9015 { + my $sourcefile = "download.ashx?file=57"; + my $url = "http://www.ite.com.tw/EN/Services/$sourcefile"; + my $hash = "ff5b096ed47c080870eacdab2de33ad6"; + my $outfile = "dvb-usb-af9015.fw"; + my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); + my $fwoffset = 0x22708; + my $fwlength = 18225; + 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; +} + +# --------------------------------------------------------------- +# 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); +} + +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); +} + +sub syntax() { + print STDERR "syntax: get_dvb_firmware <component>\n"; + print STDERR "Supported components:\n"; + for($i=0; $i < scalar(@components); $i++) { + print STDERR "\t" . $components[$i] . "\n"; + } + exit(1); +} diff --git a/media-tv/linuxtv-dvb-firmware/linuxtv-dvb-firmware-2009.07.06.ebuild b/media-tv/linuxtv-dvb-firmware/linuxtv-dvb-firmware-2009.09.19.ebuild index a19d334174b0..89f13b3cce84 100644 --- a/media-tv/linuxtv-dvb-firmware/linuxtv-dvb-firmware-2009.07.06.ebuild +++ b/media-tv/linuxtv-dvb-firmware/linuxtv-dvb-firmware-2009.09.19.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/media-tv/linuxtv-dvb-firmware/linuxtv-dvb-firmware-2009.07.06.ebuild,v 1.1 2009/09/02 20:49:58 billie Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-tv/linuxtv-dvb-firmware/linuxtv-dvb-firmware-2009.09.19.ebuild,v 1.1 2009/10/08 16:05:47 billie Exp $ DESCRIPTION="Firmware files needed for operation of some dvb-devices" HOMEPAGE="http://www.linuxtv.org" @@ -42,7 +42,6 @@ FW_USE_FLAGS=( "usb-wt220u" "usb-wt220u" "usb-dib0700" - "usb-af9015" "sp887x" "af9005" "cx231xx" @@ -53,6 +52,7 @@ FW_USE_FLAGS=( "cx23885" "pvrusb2" "usb-bluebird" + "tda10045" # get_dvb_firmware "sp8870" "tda10046" @@ -65,6 +65,7 @@ FW_USE_FLAGS=( "vp7041" "nxt200x" "mpc718" + "usb-af9015" ) FW_FILES=( @@ -76,7 +77,7 @@ FW_FILES=( "dvb-usb-vp702x-01.fw" "dvb-usb-vp7045-01.fw" "dvb-usb-wt220u-01.fw" - "dvb-dibusb-5.0.0.11.fw" + "dvb-usb-dibusb-5.0.0.11.fw" "dvb-fe-or51211.fw" "dvb-fe-or51132-qam.fw" "dvb-fe-or51132-vsb.fw" @@ -86,7 +87,6 @@ FW_FILES=( "dvb-usb-wt220u-02.fw" "dvb-usb-wt220u-fc03.fw" "dvb-usb-dib0700-1.20.fw" - "dvb-usb-af9015.fw" "dvb-fe-sp887x.fw" "af9005.fw" "v4l-cx231xx-avcore-01.fw" @@ -97,6 +97,7 @@ FW_FILES=( "v4l-cx23885-enc.fw" "v4l-cx25840.fw" "dvb-usb-bluebird-01.fw" + "dvb-fe-tda10045.fw" # get_dvb_firmware "dvb-fe-sp8870.fw" "dvb-fe-tda10046.fw" @@ -109,6 +110,7 @@ FW_FILES=( "dvb-vp7041-2.422.fw" "dvb-fe-nxt2004.fw" "dvb-cx18-mpc718-mt352.fw" + "dvb-usb-af9015.fw" ) FW_GET_PARAMETER=( @@ -153,6 +155,7 @@ FW_GET_PARAMETER=( "vp7041" "nxt2004" "mpc718" + "af9015" ) FW_URLS=( @@ -174,7 +177,6 @@ FW_URLS=( "http://www.linuxtv.org/downloads/firmware/dvb-usb-wt220u-02.fw" "http://home.arcor.de/efocht/dvb-usb-wt220u-fc03.fw" "http://www.wi-bw.tfh-wildau.de/~pboettch/home/files/dvb-usb-dib0700-1.20.fw" - "http://www.otit.fi/~crope/v4l-dvb/af9015/af9015_firmware_cutter/firmware_files/4.95.0/dvb-usb-af9015.fw" "http://peterdamen.com/dvb-fe-sp887x.fw" "http://ventoso.org/luca/af9005/af9005.fw" "http://linuxtv.org/downloads/firmware/v4l-cx231xx-avcore-01.fw" @@ -185,6 +187,7 @@ FW_URLS=( "http://linuxtv.org/downloads/firmware/v4l-cx23885-enc.fw" "http://linuxtv.org/downloads/firmware/v4l-cx25840.fw" "http://linuxtv.org/downloads/firmware/dvb-usb-bluebird-01.fw" + "http://www.fireburn.co.uk/dvb-fe-tda10045.fw" # get_dvb_firmware "http://2.download.softwarepatch.pl/1619edb0dcb493dd5337b94a1f79c3f6/tt_Premium_217g.zip" "http://www.tt-download.com/download/updates/219/TT_PCI_2.19h_28_11_2006.zip" @@ -197,6 +200,7 @@ FW_URLS=( "http://www.twinhan.com/files/AW/Software/TwinhanDTV2.608a.zip" "http://www.avermedia-usa.com/support/Drivers/AVerTVHD_MCE_A180_Drv_v1.2.2.16.zip" "ftp://ftp.work.acer-euro.com/desktop/aspire_idea510/vista/Drivers/Yuan%20MPC718%20TV%20Tuner%20Card%202.13.10.1016.zip" + "http://www.ite.com.tw/EN/Services/download.ashx?file=57" ) SRC_URI="" @@ -235,7 +239,6 @@ DEPEND="${DEPEND} install_dvb_card() { if [[ -z ${DVB_CARDS} ]]; then # install (almost) all firmware files - # do not install this one due to conflicting filenames [[ "${1}" != "tda10046lifeview" ]] else @@ -254,11 +257,14 @@ pkg_setup() { eerror eerror "But beware that you cannot enable tda10046 and" eerror "tda10046lifeview at the same time." - eerror fi if [[ -z ${DVB_CARDS} ]]; then + elog elog "DVB_CARDS is not set, installing all available firmware files." + elog "To save bandwidth please consider setting the DVB_CARDS variable" + elog "in ${ROOT%/}/etc/make.conf. This way only the firmwares you own" + elog "the hardware will be installed." fi # according to http://devmanual.gentoo.org/general-concepts/use-flags/index.html # we should not die here. However, there is no sensible fallback choice to make @@ -268,25 +274,29 @@ pkg_setup() { eerror "You cannot have both tda10046 and tda10046lifeview in DVB_CARDS" eerror "because of colliding firmware filenames (dvb-fe-tda10046.fw)." eerror "Sorry." - eerror die "Conflicting values for DVB_CARDS set." fi + elog elog "List of possible card-names to use for DVB_CARDS:" echo ${FW_USE_FLAGS[*]}| tr ' ' '\n' | sort | uniq | fmt \ | while read line; do elog " ${line}" done + elog elog "If you need another firmware file and want it included create a bug" elog "at bugs.gentoo.org." - elog "If some firmware sources are not fetchable anymore please also report" - elog "a bug. If there is no alternative source or an update to the firmware" - elog "available we have to remove it from this ebuild and you are on your own." + elog "In case some firmware sources are not fetchable please try again at" + elog "a later time and if it still does not fetch report a bug. If there" + elog "is no alternative source or an update to the firmware available we" + elog "have to remove it from the ebuild and you are on your own." } src_unpack() { + local distfile + # link all downloaded files to ${S} - for f in ${A}; do - [[ -L ${f} ]] || ln -s ${DISTDIR}/${f} ${f} + for distfile in ${A}; do + [[ -L ${distfile} ]] || ln -s ${DISTDIR}/${distfile} ${distfile} done # unpack firmware-packet @@ -294,14 +304,17 @@ src_unpack() { unpack ${PACKET_NAME} fi - use dvb_cards_mpc718 && mv Yuan%20MPC718%20TV%20Tuner%20Card%202.13.10.1016.zip "Yuan MPC718 TV Tuner Card 2.13.10.1016.zip" - use dvb_cards_dibusb-usb1 && mv dvb-usb-dibusb-5.0.0.11.fw dvb-dibusb-5.0.0.11.fw - use dvb_cards_ttpci && mv dvb-ttpci-01.fw-fc2624 dvb-ttpci-01.fw + if [[ -z ${DVB_CARDS} ]] || use dvb_cards_mpc718 ; then + mv Yuan%20MPC718%20TV%20Tuner%20Card%202.13.10.1016.zip "Yuan MPC718 TV Tuner Card 2.13.10.1016.zip" + fi + if [[ -z ${DVB_CARDS} ]] || use dvb_cards_ttpci ; then + mv dvb-ttpci-01.fw-fc2624 dvb-ttpci-01.fw + fi - SCRIPT_V=${PV} + local script_v=${PV} # Adjust temp-dir of get_dvb_firmware - sed "${FILESDIR}"/get_dvb_firmware-${SCRIPT_V} \ + sed "${FILESDIR}"/get_dvb_firmware-${script_v} \ -e "s#/tmp#${T}#g" > get_dvb_firmware chmod a+x get_dvb_firmware @@ -323,9 +336,9 @@ src_install() { for ((CARD=0; CARD < ${#FW_USE_FLAGS[*]}; CARD++)) do if install_dvb_card ${FW_USE_FLAGS[CARD]}; then - local FILE=${FW_FILES[CARD]} - [[ -f ${FILE} ]] || die "File ${FILE} does not exist!" - doins ${FILE} + local file=${FW_FILES[CARD]} + [[ -f ${file} ]] || die "File ${file} does not exist!" + doins ${file} fi done } |