--- fw-info.pl 2007/04/23 17:41:34 16 +++ fw-info.pl 2007/04/24 20:43:36 34 @@ -7,11 +7,17 @@ use strict; use Data::Dump qw/dump/; -my $path = shift @ARGV || '/srv/tftp/BANT-R'; # die "Usage: $0 firmware.bin\n"; +my @images = @ARGV; +push @images, '/srv/tftp/BANT-R' unless @images; -open(my $fh, $path) || die "Can't open $path: $!"; -my $ver; -seek($fh, 32, 0) || die "can't seek to 32: $!"; -read($fh, $ver, 4); -print join('.',unpack('CCCC', $ver)),"\t$path\n"; +my $magic = 'BLI223QH0'; +for my $path ( @images ) { + open(my $fh, $path) || die "Can't open $path: $!"; + my $b; + read($fh, $b, length($magic)); + warn "# $path not a firmware image\n" unless ($b eq $magic); + seek($fh, 32, 0) || die "can't seek to 32: $!"; + read($fh, $b, 4); + printf("%8s %s\n", join('.',unpack('CCCC', $b)), $path); +}