my $read_len = 255;
+my $path = shift @ARGV || '/dev/serial/by-path/platform-20980000.usb-usb-0:1.3.1:1.0-port0';
+
$|=1;
-my $s = new Device::SerialPort( '/dev/ttyUSB0' ) || die $!;
+my $s = new Device::SerialPort( $path ) || die $!;
$s->baudrate(2400);
-$s->databits(8);
+$s->databits(8); # 7
$s->parity('none');
$s->stopbits(1);
$s->handshake('none');
my $t = time();
+my $sym;
+my $chr = 'A';
+
while (1) {
my ($len, $string) = $s->read($read_len);
my $ts = time();
if ( $len > 0 ) {
my $hex = unpack('H*',$string);
$hex =~ s/(..)/$1 /g;
+=for later
+ my $ascii;
+ foreach ( split(/ /, $hex) ) {
+ if ( ! exists $sym->{$_} ) {
+ $chr++;
+ $ascii
+=cut
#printf "%s %2d %s\n", time(), $len, $hex;
- printf "%8.4f %0.4f %2d %s\n", $ts, $ts - $t, $len, $hex;
+ printf "%8.4f %6.2f %2d %s\n", $ts, $ts - $t, $len, $hex;
$t = time();
}
}