Web lists-archives.com

Re: Serial Ports and Perl




On 27/10/17 15:38, Martin McCormick wrote:
> 	A perldoc of Device::SerialPort says that lookfor is
> supposed to block or hold until a character string emerges from
> the port as in /dev/ttyUSB0 or /dev/ttyS1.  When I trace the
> code, it just loops as fast as it can and never holds to wait for
> anything.

From my reading, if you call lookfor without any arguments, it will not
block, but poll the device and return immediately. Examples using that
behaviour have a sleep to stop it running away.

If you want the blocking behaviour, give it the number of characters
you're waiting for, and it will return only when it gets them.

I'm looking at

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

Richard

Attachment: signature.asc
Description: OpenPGP digital signature