-
Thomas Gleixner authored
Based on 1 normalized pattern(s): released under gplv2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 1 file(s). Signed-off-by:
Thomas Gleixner <tglx@linutronix.de> Reviewed-by:
Alexios Zavras <alexios.zavras@intel.com> Reviewed-by:
Armijn Hemel <armijn@tjaldur.nl> Reviewed-by:
Allison Randal <allison@lohutok.net> Reviewed-by:
Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190530000436.946199729@linutronix.de Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
eee1cba5
extract_xc3028.pl 44.62 KiB
#!/usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) Mauro Carvalho Chehab <mchehab@kernel.org>
#
# In order to use, you need to:
# 1) Download the windows driver with something like:
# Version 2.4
# wget http://www.twinhan.com/files/AW/BDA T/20080303_V1.0.6.7.zip
# or wget http://www.stefanringel.de/pub/20080303_V1.0.6.7.zip
# Version 2.7
# wget http://www.steventoth.net/linux/xc5000/HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip
# 2) Extract the files from the zip into the current dir:
# unzip -j 20080303_V1.0.6.7.zip 20080303_v1.0.6.7/UDXTTM6000.sys
# unzip -j HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip Driver85/hcw85bda.sys
# 3) run the script:
# ./extract_xc3028.pl
# 4) copy the generated files:
# cp xc3028-v24.fw /lib/firmware
# cp xc3028-v27.fw /lib/firmware
#use strict;
use IO::Handle;
my $debug=0;
sub verify ($$)
{
my ($filename, $hash) = @_;
my ($testhash);
if (system("which md5sum > /dev/null 2>&1")) {
die "This firmware requires the md5sum command - see http://www.gnu.org/software/coreutils/\n";
}
open(CMD, "md5sum ".$filename."|");
$testhash = <CMD>;
$testhash =~ /([a-zA-Z0-9]*)/;
$testhash = $1;
close CMD;
die "Hash of extracted file does not match (found $testhash, expected $hash!\n" if ($testhash ne $hash);
}
sub get_hunk ($$)
{
my ($offset, $length) = @_;
my ($chunklength, $buf, $rcount, $out);
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);
$out .= $buf;
$length -= $rcount;
}
return $out;
}
sub write_le16($)
{
my $val = shift;
my $msb = ($val >> 8) &0xff;
my $lsb = $val & 0xff;
syswrite(OUTFILE, chr($lsb).chr($msb));
}