/[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

Annotation of /bin/fw-info.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34 - (hide annotations)
Tue Apr 24 20:43:36 2007 UTC (17 years ago) by dpavlin
Original Path: fw-info.pl
File MIME type: text/plain
File size: 543 byte(s)
support multiple firmware images as argument(s)
1 dpavlin 5 #!/usr/bin/perl -w
2    
3     # fw-info.pl
4     #
5     # 04/22/07 16:33:13 CEST Dobrica Pavlinusic <dpavlin@rot13.org>
6    
7     use strict;
8     use Data::Dump qw/dump/;
9    
10 dpavlin 34 my @images = @ARGV;
11     push @images, '/srv/tftp/BANT-R' unless @images;
12 dpavlin 5
13 dpavlin 18 my $magic = 'BLI223QH0';
14    
15 dpavlin 34 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     }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26