Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #188367

Re: Serial Ports and Perl

From Andy Smith <andy@strugglers.net>
Newsgroups linux.debian.user
Subject Re: Serial Ports and Perl
Date 2017-10-27 03:50 +0200
Message-ID <uF1Wx-4TG-1@gated-at.bofh.it> (permalink)
References <uF10t-4gy-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Martin,

On Thu, Oct 26, 2017 at 07:37:07PM -0500, Martin McCormick wrote:
> 	If anybody has gotten the perl Device::SerialPort to
> work, I am interested to know what I am doing or not doing.

I have been using it successfully for a long time, but all I do is
read whole lines from the serial device like:

my $dev  = '/dev/ttyUSB0';
my $port = Device::SerialPort->new($dev);

$port->baudrate(57600);
$port->write_settings;

open my $fh, '<', $dev or die "Can't open $dev: $!";

while (<$fh>) {
    print "READ: $_\n";
}

So, I am only using Device::SerialPort to configure the device,
while all reading is done by treating it as a normal file.

I see you are using lookfor(), which I have never used before. From
a brief look at:

    http://search.cpan.org/~cook/Device-SerialPort-1.002/SerialPort.pm#Methods_for_I/O_Processing

it seems you should be setting are_match() if you want lookfor() to
match anything.

Cheers,
Andy

-- 
https://bitfolk.com/ -- No-nonsense VPS hosting

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Serial Ports and Perl "Martin McCormick" <martin.m@suddenlink.net> - 2017-10-27 02:50 +0200
  Re: Serial Ports and Perl Andy Smith <andy@strugglers.net> - 2017-10-27 03:50 +0200
    Re: Serial Ports and Perl "Martin McCormick" <martin.m@suddenlink.net> - 2017-10-27 04:40 +0200
      Re: Serial Ports and Perl Richard Hector <richard@walnut.gen.nz> - 2017-10-27 06:50 +0200
    Re: Serial Ports and Perl "Martin McCormick" <martin.m@suddenlink.net> - 2017-10-27 18:50 +0200
  Re: Serial Ports and Perl Henning Follmann <hfollmann@itcfollmann.com> - 2017-10-27 04:00 +0200
  Re: Serial Ports and Perl Fred <fred@blakemfg.com> - 2017-10-27 04:20 +0200

csiph-web