in reply to Re^3: r/w attached infrared head on /dev/ttyUSB0
in thread r/w attached infrared head on /dev/ttyUSB0
And you see in strace my problem: (only last lines of output)use Fcntl qw/:DEFAULT/;<br> use IO::Termios ();<br> use IO::Stty ();<br> <br> sysopen my $fh, '/dev/ttyUSB0', O_RDWR or die "sysopen: $!";<br> my $handle = IO::Termios->new($fh) or die "IO::Termios->new: $!";<br> $handle->set_mode('300,7,e,1');<br> IO::Stty::stty($handle, qw/ cs7 parenb -parodd raw -echo /);<br> <br> my $raw = "\x2F\x3F\x21\x0D\x0A";<br> $handle->syswrite($raw) == length($raw) or die "syswrite";<br> my $raw = "\x06\x30\x30\x30\x0D\x0A";<br> $handle->syswrite($raw) == length($raw) or die "syswrite";<br> <br> while(1) {<br> my $toread = 1;<br> $handle->sysread(my $in, $toread) == $toread or die "sysread";<br> print $in;<br> }<br> <br> $handle->close;<br> <br> <br>
read(4, "/", 1) = 1<br> read(4, "L", 1) = 1<br> read(4, "O", 1) = 1<br> read(4, "G", 1) = 1<br> read(4, "4", 1) = 1<br> read(4, "L", 1) = 1<br> read(4, "K", 1) = 1<br> read(4, "1", 1) = 1<br> read(4, "3", 1) = 1<br> read(4, "B", 1) = 1<br> read(4, "D", 1) = 1<br> read(4, "2", 1) = 1<br> read(4, "0", 1) = 1<br> read(4, "2", 1) = 1<br> read(4, "0", 1) = 1<br> read(4, "1", 1) = 1<br> read(4, "5", 1) = 1<br> read(4, "\r", 1) = 1<br> read(4, "\n", 1) = 1<br> write(1, "/LOG4LK13BD202015\r\n", 19/LOG4LK13BD202015) = 19<br> read(4, <br>
|
|---|