Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vecs
FIJI Public
Commits
34625949
Commit
34625949
authored
Feb 11, 2015
by
Stefan Tauner
Browse files
fiji_download.pl: Fix baudrate selection on Windows
parent
3cd4a51e
Changes
1
Hide whitespace changes
Inline
Side-by-side
fiji_download.pl
View file @
34625949
...
...
@@ -3,13 +3,14 @@
use
strict
;
use
warnings
;
use
Switch
;
use
AnySerialPort
;
use
Log::
Log4perl
qw(get_logger)
;
use
Scalar::
Util
"
looks_like_number
";
use
Config::
Simple
;
use
Time::
HiRes
"
usleep
";
use
AnySerialPort
;
use
Digest::
CRC
"
crc
";
use
Data::
Dumper
;
#** Initiates a serial port
#
...
...
@@ -34,9 +35,24 @@ sub init_uart {
return
undef
;
}
if
(
$port
->
can
("
are_baudrate
")
&&
$port
->
are_baudrate
!~
$baudrate
)
{
$logger
->
error
("
Invalid baud rate (
$baudrate
). Possible choices are
$port
->are_baudrate
");
return
undef
;
if
(
$port
->
can
("
are_baudrate
"))
{
my
@rates
=
$port
->
are_baudrate
;
if
(
grep
(
/^$baudrate$/
,
@rates
)
==
0
)
{
$logger
->
error
("
Invalid baud rate (
$baudrate
). Possible choices are:
",
{
filter
=>
sub
{
my
$opts
=
shift
;
my
$ret
=
"";
foreach
my
$o
(
@$opts
)
{
$ret
.=
sprintf
("
\n
%d
",
$o
);
}
return
$ret
;
},
value
=>
\
@rates
}
);
return
undef
;
}
}
$port
->
databits
(
8
);
$port
->
baudrate
(
$baudrate
);
...
...
@@ -52,7 +68,6 @@ sub init_uart {
}
$logger
->
info
("
Using serial port
$portname
with baud rate
$baudrate
.
");
return
$port
;
}
## @function rcv_bitstream ($port, $todo, $timeout, @$out_ref)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment