in reply to Supressing error messages on serial port open in Linux

I'm on Linux, but on my system there is no ttyS or ttyUSB. I tried your script and got the same warnings; however, if you use /dev/tty1, /dev/tty2, etc., then everything comes together. For example,
#!/usr/bin/perl -slw use strict; $|=1; BEGIN { eval "use Device::SerialPort qw( :PARAM ); 1;"; die "$@\n" if ($@); } my $port = $ARGV; foreach $port(@ARGV) { my $ob = Device::SerialPort->new($port, 1) or die "Could not open $port: $!"; sleep 1; print "$port is open"; undef $ob; }
I used undef $ob rather than $ob->close. It just worked better.