[Tinyos-2-commits] CVS: tinyos-2.x/tools/platforms/msp430/motelist
motelist-macos, NONE, 1.1 Makefile.am, 1.2, 1.3
Kevin Klues
klueska at users.sourceforge.net
Thu Jun 7 00:22:21 PDT 2007
Update of /cvsroot/tinyos/tinyos-2.x/tools/platforms/msp430/motelist
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv22974/tools/platforms/msp430/motelist
Modified Files:
Makefile.am
Added Files:
motelist-macos
Log Message:
Added support for MAC OS in tools compilation
--- NEW FILE: motelist-macos ---
#!/usr/bin/perl -w
use strict;
my $help = <<'EOF';
usage: motelist [options]
options:
-h display this help
-c compact format, not pretty but easier for parsing
EOF
my %Opt = (
compact => 0,
dev_prefix => [ "/dev/tty.usbserial-" ],
);
while (@ARGV) {
last unless $ARGV[0] =~ /^-/;
my $opt = shift @ARGV;
if( $opt eq "-h" ) { print "$help\n"; exit 0; }
elsif( $opt eq "-c" ) { $Opt{compact} = 1; }
else { print STDERR "$help\nerror, unknown command line option $opt\n"; exit 1; }
}
print_motelist( scan_dev() );
#
# Scan /dev for tty.usbserial-*
#
sub scan_dev {
my @devs;
foreach (`ls /dev/tty.usbserial-* 2>&1`) {
my($dev, $serial) = /(\/dev\/tty.usbserial-(\S+))/;
if ($serial ne "*:") {
my $d;
$d->{"InfoSerial"} = $serial;
$d->{"SerialDevName"} = $dev;
push(@devs, $d);
}
}
return @devs;
}
#
# Print motelist
#
sub print_motelist {
my @devs = @_;
# If none were found, quit
if( @devs == 0 ) {
print "No devices found.\n";
return;
}
# Print a header
if( !$Opt{compact} ) {
print << "EOF" unless $Opt{compact};
Reference Device Description
---------- --------------------------- ---------------------------------------
EOF
}
# Print the usb information
for my $dev (@devs) {
my $desc = "(none)";
my @output = ( $dev->{"InfoSerial"}, $dev->{"SerialDevName"}, $desc );
if( $Opt{compact} ) {
print join(",", at output) . "\n";
} else {
printf( "%-10s %-27s %s\n", @output );
}
}
}
Index: Makefile.am
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/platforms/msp430/motelist/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Makefile.am 12 Jul 2006 17:00:38 -0000 1.2
--- Makefile.am 7 Jun 2007 07:22:18 -0000 1.3
***************
*** 6,11 ****
motelist: motelist-win32.cpp
g++ -O3 -Wall -o motelist motelist-win32.cpp
! else
motelist: motelist-linux
cp motelist-linux motelist
endif
--- 6,16 ----
motelist: motelist-win32.cpp
g++ -O3 -Wall -o motelist motelist-win32.cpp
! else !CYGWIN
! if DARWIN
! motelist: motelist-macos
! cp motelist-macos motelist
! else !DARWIN
motelist: motelist-linux
cp motelist-linux motelist
endif
+ endif
More information about the Tinyos-2-commits
mailing list