sentient has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I am writing a Perl program that talks to stepper motors over a serial port. My problem is in the initialization of the serial port. I am using the POSIX module to set terminal control attributes (e.g. PARENB, CLOCAL, CREAD, CSTOP, CS8, CSIZE, etc.), however CRTSCTS (flow control) is not recognized. It seems that CRTSCTS is non-Posix. So I am stuck. One option that seems feasible is to do something like:

`stty -crtscts > /dev/ttyS0`;

to turn flow control off using the shell. I haven't tried this yet, but I would rather not use the shell, if possible.

Is there some other module I can use to set CRTSCTS for the port, or ??? I am a newcomer to perlmonks.org, so please forgive me of any message-posting protocol violations that I may have inadvertently created with this post.

Thanks in advance!
sentient

Replies are listed 'Best First'.
Re: Serial I/O Question
by TheoPetersen (Priest) on Feb 22, 2001 at 01:31 UTC
    If you are on a Linux system you might try Device::SerialPort. The interface is largely the same as Win32::SerialPort, implemented via a combination of Linux and POSIX functions.

    $PortObj = new Win32::SerialPort ($PortName, $quiet) || die "Can't open $PortName: $^E\n"; $PortObj->handshake("rts");