add command line option to set flow control mode

This commit is contained in:
Mariano Alvira 2010-03-03 08:10:35 -05:00
parent 00224dd7eb
commit 8abb7baabe

View file

@ -12,12 +12,14 @@ my $second = '';
my $term = '/dev/ttyUSB0'; my $term = '/dev/ttyUSB0';
my $baud = '115200'; my $baud = '115200';
my $verbose; my $verbose;
my $rts = 'rts';
GetOptions ('file=s' => \$filename, GetOptions ('file=s' => \$filename,
'secondfile=s' => \$second, 'secondfile=s' => \$second,
'terminal=s' => \$term, 'terminal=s' => \$term,
'verbose' => \$verbose, 'verbose' => \$verbose,
'baud=s' => \$baud, 'baud=s' => \$baud,
'rts=s' => \$rts,
) or die 'bad options'; ) or die 'bad options';
$| = 1; $| = 1;
@ -44,7 +46,11 @@ $ob->baudrate($baud);
$ob->parity('none'); $ob->parity('none');
$ob->databits(8); $ob->databits(8);
$ob->stopbits(1); $ob->stopbits(1);
$ob->handshake("rts"); if($rts eq 'rts') {
$ob->handshake('rts');
} else {
$ob->handshake('none');
}
$ob->read_const_time(1000); # 1 second per unfulfilled "read" call $ob->read_const_time(1000); # 1 second per unfulfilled "read" call
$ob->rts_active(1); $ob->rts_active(1);