add scripts to help load a bunch of econotags

This commit is contained in:
maralvira 2010-11-07 14:11:18 +00:00
parent 8b2ef2675d
commit 9f7d860e9c
4 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,17 @@
#!/usr/bin/perl
use strict;
my $terms = shift;
if (! $terms) {
print "Usage: num-devices\n";
die;
}
for (my $t=0; $t<$terms; $t++) {
my $dev_num = 2 * $t + 1;
my $ftdi_num = $terms - $t - 1;
my $cmd = "bbmc -l redbee-econotag -i $ftdi_num erase &";
print "$cmd\n";
system($cmd);
}

View File

@ -0,0 +1,18 @@
#!/usr/bin/perl
use strict;
my $bin = shift;
my $terms = shift;
if (! $terms) {
print "Usage: $0 file.bin num-devices\n";
die;
}
for (my $t=0; $t<$terms; $t++) {
my $dev_num = 2 * $t + 1;
my $ftdi_num = $terms - $t - 1;
my $cmd = "mc1322x-load.pl -e -f $bin -t /dev/ttyUSB$dev_num -c 'bbmc -l redbee-econotag -i $ftdi_num reset' &";
print "$cmd\n";
system($cmd);
}

View File

@ -0,0 +1,49 @@
#!/usr/bin/perl
use strict;
use integer;
my $start = shift;
my $end = shift;
if (! $end) {
print "Usage: $0 first-term-num last-term-num\n";
die;
}
my $COLS = 4;
my $index = 0;
for (my $n=$start; $n <= $end; $n += 2) {
#print "$n\n";
open(OUT, ">/tmp/USB$n.ini");
my $dev = "/dev/ttyUSB$n";
print OUT <<end
set line $dev
if failure { exit 1 "Unable top open $dev" }
set carrier-watch off
set flow-control none
set speed 115200
set serial 8n1
set key \\127 \\8
connect
quit
end
;
close(OUT);
my ($row, $col);
$row = $index / $COLS;
$col = $index % $COLS;
my ($offx, $offy);
$offx = $col * 300;
$offy = $row * 300;
#my $cmd = "xterm -geometry 40x20+$offx+$offy -e 'kermit /tmp/USB$n.ini'&";
my $cmd = "xterm -geometry 40x20+$offx+$offy -e 'stty -F /dev/ttyUSB$n 115200 && cat /dev/ttyUSB$n'&";
# my $cmd = "xterm -e 'stty -F /dev/ttyUSB$n 115200 && cat /dev/ttyUSB$n'&";
print "$cmd\n";
system($cmd);
$index++;
}

View File

@ -0,0 +1,17 @@
#!/usr/bin/perl
use strict;
my $terms = shift;
if (! $terms) {
print "Usage: num-devices\n";
die;
}
for (my $t=0; $t<$terms; $t++) {
my $dev_num = 2 * $t + 1;
my $ftdi_num = $terms - $t - 1;
my $cmd = "bbmc -l redbee-econotag -i $ftdi_num reset &";
print "$cmd\n";
system($cmd);
}