Genesis mode success

Pavel Roskin proski at gnu.org
Mon Apr 28 00:20:07 EDT 2003


On Sun, 27 Apr 2003, Pavel Roskin wrote:

> The bad thing is that the card now identifies itself as BroMax.  Although
> flash 0.5e can dump the CIS using the "-cd" switch, it cannot write it
> back.  Frankly the dump doesn't even look like a valid CIS.  It should be
> possible to convert the output of dump_cis from pcmcia-cs to an S3 file.

The attached script runs dump_cis and converts the output to an S3 file
suitable for flashing on cards with HFA3841.

Yes, my perl is very bad.  Yet the card is as good as it was before :-)

-- 
Regards,
Pavel Roskin
-------------- next part --------------
#!/usr/bin/perl

use strict;
use vars qw(@bytes $address $index);

open(DUMP, "dump_cis -v |");
while (<DUMP>) {
	if (/^\s*$/) {
		next;
	}
	if (/offset 0x.., tuple 0x(..), link 0x(..)/) {
		push (@bytes, $1, $2);
		next;
	}
	if (/^[0-9a-f ]*$/) {
		push (@bytes, split(' '));
		next;
	}
}

push (@bytes, "FF");
push (@bytes, "FF");
push (@bytes, "FF");

$address = 0x003EFE00;
$index = 0;

while (1) {
	my $bstr;
	my $line;
	my $sum;

	my $str_len = $#bytes - $index;
	if ($str_len <= 0) {
		last;
	}

	if ($str_len > 16) {
		$str_len = 16;
	}

	$line = sprintf ("%02X%08X", $str_len + 5, $address);
	for (0 .. $str_len - 1) {
		my $num = hex($bytes[$index]);
		$line = $line . sprintf ("%02X", $num);
		$index = $index + 1;
	}

	my @b = split (/(..)/, $line);
	$sum = 0;
	print "S3";
	foreach (@b) {
		next if (length($_) == 0);
		printf ("%02X", hex($_));
		$sum = $sum + hex($_);
	}

	$sum = (-1 - $sum) & 0xFF;

	printf "%02X\n", $sum;
	$address = $address + $str_len;
}

print "S70500000000FA\n";


More information about the HostAP mailing list