pashanoid has asked for the wisdom of the Perl Monks concerning the following question:
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";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Supressing error messages on serial port open in Linux
by Eliya (Vicar) on Sep 02, 2011 at 12:25 UTC | |
by Corion (Patriarch) on Sep 02, 2011 at 12:57 UTC | |
by pashanoid (Scribe) on Sep 05, 2011 at 05:31 UTC | |
by pashanoid (Scribe) on Sep 05, 2011 at 05:52 UTC | |
by Corion (Patriarch) on Sep 05, 2011 at 07:06 UTC | |
|
Re: Supressing error messages on serial port open in Linux
by Khen1950fx (Canon) on Sep 02, 2011 at 16:49 UTC |