/usr/bin/tos-decode-flid is in tinyos-tools 1.4.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #!/usr/bin/perl -w
use strict;
sub decode ($$) {
my $a = shift;
my $b = shift;
die if ($a<0 || $a>3);
die if ($b<0 || $b>3);
my $c = ($a << 2) + $b;
my $h = sprintf "%X", $c;
return $h;
}
sub usage() {
print "Usage: tos-decode-flid flid-file flid\n";
exit 2;
}
sub make_flid () {
my $flid = $ARGV[1];
die "expected 8 characters" if (length($flid) != 8);
my $flidstr =
"0x" .
decode(substr($flid,0,1),substr($flid,1,1)) .
decode(substr($flid,2,1),substr($flid,3,1)) .
decode(substr($flid,4,1),substr($flid,5,1)) .
decode(substr($flid,6,1),substr($flid,7,1));
}
usage() if (scalar(@ARGV)!=2);
my $flidstr = make_flid();
my $fn = $ARGV[0];
my $found = 0;
if (defined ($fn)) {
open INF, "<$fn" or die;
while (my $line = <INF>) {
chomp $line;
my @fields = split /\#\#\#/, $line;
foreach (@fields) {
(s/^\s*//g);
(s/\s*$//g);
(s/^\"//g);
(s/\"$//g);
}
if (hex($fields[0]) == hex($flidstr)) {
my $check = $fields[1];
my $text = $fields[2];
my $loc = $fields[3];
my $func = $fields[4];
$found = 1;
print "Deputy error message for flid $flidstr:\n\n";
printf "%s: %s: Assertion failed in %s:\n %s\n",
$loc, $func, $check, $text;
}
}
close INF;
}
else {
usage();
}
if (!$found) {
print "oops -- flid $flidstr not found in file\n";
}
|