diff options
author | Andy Walls <awalls@radix.net> | 2009-07-03 10:33:17 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-07-05 13:29:58 -0400 |
commit | 9f38a920b232800fd4000ba3d4617b41198e017e (patch) | |
tree | 431f5ddf1d3577deaeb5d5f590675f0b5d919360 /Documentation/dvb | |
parent | 637fb3d70b1e53a127cba5ffae5aa3b2b9f57df6 (diff) |
V4L/DVB (12181): get_dvb_firmware: Add Yuan MPC718 MT352 DVB-T "firmware" extraction
Add routine to support extracting the MT352 DVB-T demodulator initialization
sequence for Yuan MPC718 cards for use by the cx18 driver.
This routine uses a hueristic for extracting a good sequence. It should work
on all different versions of the "yuanrap.sys" file, given the way the MT352
tuning sequences are stored in all versions of that file I have seen so far.
However, the current patch simply looks for one specific archive URL.
Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation/dvb')
-rw-r--r-- | Documentation/dvb/get_dvb_firmware | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware index a52adfc9a57f..64174d6258f0 100644 --- a/Documentation/dvb/get_dvb_firmware +++ b/Documentation/dvb/get_dvb_firmware | |||
@@ -25,7 +25,7 @@ use IO::Handle; | |||
25 | "tda10046lifeview", "av7110", "dec2000t", "dec2540t", | 25 | "tda10046lifeview", "av7110", "dec2000t", "dec2540t", |
26 | "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004", | 26 | "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004", |
27 | "or51211", "or51132_qam", "or51132_vsb", "bluebird", | 27 | "or51211", "or51132_qam", "or51132_vsb", "bluebird", |
28 | "opera1", "cx231xx", "cx18", "cx23885", "pvrusb2" ); | 28 | "opera1", "cx231xx", "cx18", "cx23885", "pvrusb2", "mpc718" ); |
29 | 29 | ||
30 | # Check args | 30 | # Check args |
31 | syntax() if (scalar(@ARGV) != 1); | 31 | syntax() if (scalar(@ARGV) != 1); |
@@ -381,6 +381,56 @@ sub cx18 { | |||
381 | $allfiles; | 381 | $allfiles; |
382 | } | 382 | } |
383 | 383 | ||
384 | sub mpc718 { | ||
385 | my $archive = 'Yuan MPC718 TV Tuner Card 2.13.10.1016.zip'; | ||
386 | my $url = "ftp://ftp.work.acer-euro.com/desktop/aspire_idea510/vista/Drivers/$archive"; | ||
387 | my $fwfile = "dvb-cx18-mpc718-mt352.fw"; | ||
388 | my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); | ||
389 | |||
390 | checkstandard(); | ||
391 | wgetfile($archive, $url); | ||
392 | unzip($archive, $tmpdir); | ||
393 | |||
394 | my $sourcefile = "$tmpdir/Yuan MPC718 TV Tuner Card 2.13.10.1016/mpc718_32bit/yuanrap.sys"; | ||
395 | my $found = 0; | ||
396 | |||
397 | open IN, '<', $sourcefile or die "Couldn't open $sourcefile to extract $fwfile data\n"; | ||
398 | binmode IN; | ||
399 | open OUT, '>', $fwfile; | ||
400 | binmode OUT; | ||
401 | { | ||
402 | # Block scope because we change the line terminator variable $/ | ||
403 | my $prevlen = 0; | ||
404 | my $currlen; | ||
405 | |||
406 | # Buried in the data segment are 3 runs of almost identical | ||
407 | # register-value pairs that end in 0x5d 0x01 which is a "TUNER GO" | ||
408 | # command for the MT352. | ||
409 | # Pull out the middle run (because it's easy) of register-value | ||
410 | # pairs to make the "firmware" file. | ||
411 | |||
412 | local $/ = "\x5d\x01"; # MT352 "TUNER GO" | ||
413 | |||
414 | while (<IN>) { | ||
415 | $currlen = length($_); | ||
416 | if ($prevlen == $currlen || $currlen <= 64) { | ||
417 | chop; chop; # Get rid of "TUNER GO" | ||
418 | s/^\0\0//; # get rid of leading 00 00 if it's there | ||
419 | printf OUT "$_"; | ||
420 | $found = 1; | ||
421 | last; | ||
422 | } | ||
423 | } | ||
424 | } | ||
425 | close OUT; | ||
426 | close IN; | ||
427 | if (!$found) { | ||
428 | unlink $fwfile; | ||
429 | die "Couldn't find valid register-value sequence in $sourcefile for $fwfile\n"; | ||
430 | } | ||
431 | $fwfile; | ||
432 | } | ||
433 | |||
384 | sub cx23885 { | 434 | sub cx23885 { |
385 | my $url = "http://linuxtv.org/downloads/firmware/"; | 435 | my $url = "http://linuxtv.org/downloads/firmware/"; |
386 | 436 | ||