Dear Bretheren, I'm almost the serial opener exraordinare by now. Except, I'm getting a strange error message from my two serial ports on Linux which I'm trying to 1. supress 2. not use those ports. How do I do that?. The errors I'm getting are: (I have ttyS0, ttyS1, ttyS2, ttyS3 - the later two complaint)
can't getattr: Input/output error at registry.pl line 36 can't getattr: Input/output error at registry.pl line 36 ports opening are: /dev/ttyS1 /dev/ttyS0
Code
eval "use Device::SerialPort; 1" or die $@; my $directory = '/dev'; opendir (DIR, $directory) or die $!; while (my $file = readdir(DIR)) { push (@ports, "$directory/$file") if ($file =~ /ttyS/g); push (@ports, "$directory/$file") if ($file =~ /ttyUSB/g); } closedir(DIR); foreach my $port (@ports){ $PortObj = new Device::SerialPort($port, 1) or next; $PortObj->close; push(@ok_ports, $port); sleep (1); } print "ports opening are: @ok_ports \n";
In reply to Supressing error messages on serial port open in Linux by pashanoid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |