From: Dobrica Pavlinusic Date: Wed, 12 Oct 2016 16:21:15 +0000 (+0200) Subject: dump data from serial level convertor board X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=0361fdbfc6806f949179c2a2d46af6bff66d1245;p=vaillant-thermostat dump data from serial level convertor board --- 0361fdbfc6806f949179c2a2d46af6bff66d1245 diff --git a/serial.pl b/serial.pl new file mode 100755 index 0000000..e72c99a --- /dev/null +++ b/serial.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Device::SerialPort; +use Data::Dump qw(dump); + +$|=1; + +my $s = new Device::SerialPort( '/dev/ttyUSB0' ) || die $!; +$s->baudrate(2400); +$s->databits(8); +$s->parity('none'); +$s->stopbits(1); +$s->handshake('none'); +$s->read_char_time(2); +$s->read_const_time(3); + +#$s->write('o'); + +while (1) { + my ($len, $string) = $s->read(255); + + if ( $len > 0 ) { + my $hex = unpack('H*',$string); + $hex =~ s/(..)/$1 /g; + print time(), " $len $hex\n"; + } +} + +$s->close;