/[mdap]/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 /fw-info.pl

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

revision 21 by dpavlin, Mon Apr 23 20:49:47 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  my $magic = 'BLI223QH0';  my $magic = 'BLI223QH0';
14    
15  open(my $fh, $path) || die "Can't open $path: $!";  for my $path ( @images ) {
16  my $b;          open(my $fh, $path) || die "Can't open $path: $!";
17  read($fh, $b, length($magic));          my $b;
18  die "# $path not a firmware image\n" unless ($b eq $magic);          read($fh, $b, length($magic));
19  seek($fh, 32, 0) || die "can't seek to 32: $!";          warn "# $path not a firmware image\n" unless ($b eq $magic);
20  read($fh, $b, 4);          seek($fh, 32, 0) || die "can't seek to 32: $!";
21  printf("%8s %s\n", join('.',unpack('CCCC', $b)), $path);          read($fh, $b, 4);
22            printf("%8s %s\n", join('.',unpack('CCCC', $b)), $path);
23    }

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

  ViewVC Help
Powered by ViewVC 1.1.26