I didn't see a lot of responses to this, so I guess you really answered your own question. Must be something wrong with the Buster OS. See if these do you any good: https://forum.arduino.cc/index.php?topic=109475.0 https://www.linuxquestions.org/questions/ubuntu-63/serial-port-problem-516635/ Mike On 7/10/2019 8:51 AM, Martin McCormick wrote:
Before I take this too far, I want to make sure I am not doing something wrong with use of the Device::SerialPort module in perl. The code below talks to what it thinks is a RS-232 serial port and controlls a radio scanner so that one can program the scanner's settings and enter frequency and operational data. Don't worry about all that. It used to work on debian stretch which is last year's version of debian. After an upgrade to buster which is this year's version, also known as debian 10, all RS-232 ports appear to be dead. Interestingly enough, a debian system running stretch, containing perl was upgraded to buster and serial communications between that system and a native serial port on it's mother board are fine. The very same code ported to the buster system also fails with Can't call method "baudrate" on an undefined value at /home/martin/etc/mm line 121. It doesn't matter what serial port or whether it is native mother board hardware or what. Serial ports are all broken right now. Here is the scanner control code. I am sending it to see if I am using some deprecated method that is wrong to set the serial port or we really do have big trouble. Thanks for any and all constructive ideas. Code follows: #!/usr/bin/perl -w use strict; use warnings::unused; use File::Basename; use File::Copy; use File::Spec; use Time::Local; use Device::SerialPort; sub waitfor { #Receive from serial port. my $received = ""; our $port; until ( "" ne $received ) { $received = $port->lookfor; } return ($received); } #Receive from serial port. #no more sub routine code past this point #main global variables our @dbstrings; #main local variables my $response; my $cmd = ""; my $ONEARG = ""; #my $counter = 1; #Setup the comm port. my $dev = "/dev/ttyACM0"; our $instring = ""; our $port = Device::SerialPort->new("$dev"); $port->baudrate(115200); $port->databits(8); $port->parity("none"); $port->stopbits(1); $port->handshake("none"); $port->read_const_time(500); # 500 milliseconds = 0.5 seconds $port->are_match( "\r", "\n", ); # possible end strings foreach $ONEARG (@ARGV) { #each argument $ONEARG =~ s/^\s+//; $ONEARG =~ s/\s+$//; $cmd = $cmd . " " . $ONEARG; $cmd =~ s/^\s+//; $cmd =~ s/\s+$//; } #each argument $cmd = uc $cmd; $port->write("$cmd\r"); $instring = waitfor; my @chars = split( "", $instring ); foreach my $char (@chars) { # #print ord($char); if ( $char =~ /[\,\s\.\-\+\_0-9A-Za-z]/ ) { #printable $response = $response . $char; } #printable } # print "$response\n"; $instring = ""; exit(0);
-- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/