Force serial to non-blocking.

This commit is contained in:
Stefan `Sec` Zehl 2012-05-06 23:37:28 +02:00
parent 5b7e0a38ce
commit a5ae20daff
1 changed files with 9 additions and 1 deletions

View File

@ -8,7 +8,7 @@ use IO::Select;
package r0ket;
use Digest::CRC qw(crcccitt);
use POSIX qw(strftime);
use POSIX qw(strftime VTIME VMIN TCSANOW);
use Time::HiRes;
our $verbose=0;
@ -328,6 +328,14 @@ sub r0ket_init{
if($verbose){
print "using: $ser\n";
};
# Set serial to non-blocking:
my ($term)=POSIX::Termios->new();
$term->getattr(fileno($bridge));
$term->setcc(VTIME,1);
$term->setcc(VMIN,0);
$term->setattr(fileno($bridge),TCSANOW);
return $ser;
};