/[mdap]/bin/fw-info.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /bin/fw-info.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 16 by dpavlin, Mon Apr 23 17:41:34 2007 UTC revision 34 by dpavlin, Tue Apr 24 20:43:36 2007 UTC
# Line 7  Line 7 
7  use strict;  use strict;
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9    
10  my $path = shift @ARGV || '/srv/tftp/BANT-R'; # die "Usage: $0 firmware.bin\n";  my @images = @ARGV;
11    push @images, '/srv/tftp/BANT-R' unless @images;
12    
13  open(my $fh, $path) || die "Can't open $path: $!";  my $magic = 'BLI223QH0';
 my $ver;  
 seek($fh, 32, 0) || die "can't seek to 32: $!";  
 read($fh, $ver, 4);  
 print join('.',unpack('CCCC', $ver)),"\t$path\n";  
14    
15    for my $path ( @images ) {
16            open(my $fh, $path) || die "Can't open $path: $!";
17            my $b;
18            read($fh, $b, length($magic));
19            warn "# $path not a firmware image\n" unless ($b eq $magic);
20            seek($fh, 32, 0) || die "can't seek to 32: $!";
21            read($fh, $b, 4);
22            printf("%8s %s\n", join('.',unpack('CCCC', $b)), $path);
23    }

Legend:
Removed from v.16  
changed lines
  Added in v.34

  ViewVC Help
Powered by ViewVC 1.1.26