How to set the baud rate on a serial port (Perl under cygwin)?

A

arkadyz1

I'm not sure if it's the right group for this question as it's very
environment-specific.
Actually, the subject "How to set the baud rate on a serial port (Perl
under cygwin)?" says it all.

Here is the more detailed description of the problem:
I have a device connected to my Windows 2000 PC's serial port. The
device might talk at different baud rates (19200, 38400, 57600,
115200). Before starting to work with the device I have to determine
its baud rate. The device has some predefined response to a certain
'command' sent its way so it should be easy enough to find out the baud
rate from a Perl script... if only I knew how to change the baud rate
of the open port! Intuitively, ioctl() seems to be the best bet but
perldoc -f ioctl is not very helpful, and, since I don't have any
"native" Windows development environment, there is no ioctl.h to h2ph.

As a side note:
I use
sysopen SERIAL, "COM${port}:", O_RDWR;
to open the port. Is it suitable for my purposes?
Thanks in advance,
Arkady.
 
P

Paul Lalli

I'm not sure if it's the right group for this question as it's very
environment-specific.
Actually, the subject "How to set the baud rate on a serial port (Perl
under cygwin)?" says it all.

A search for 'SerialPort' at search.cpan.org turns up a number of likely
candidates. Have you seen any of those? Can you explain in what way
they do not meet your needs?

Paul Lalli
 
A

arkadyz1

Paul said:
A search for 'SerialPort' at search.cpan.org turns up a number of likely
candidates. Have you seen any of those? Can you explain in what way
they do not meet your needs?

Paul Lalli


Thanks for the advice.
It looks like Win32::SerialPort does all I need. Unfortunately, I
can't install it. At some point, I get a message "No 'Makefile' will
be created" and it's pretty much the end of installation - the rest of
the messages just complain about the lack of makefile.

What am I doing wrong?

Thanks in advance,
Arkady.

Here is the full session log:

$ cpan -i Win32::SerialPort
CPAN: Storable loaded ok
Going to read /cygdrive/c/arkady/.cpan/Metadata
Database was generated on Wed, 05 Jan 2005 08:51:16 GMT
Running install for module Win32::SerialPort
Running make for B/BB/BBIRTH/Win32-SerialPort-0.19.tar.gz
CPAN: Digest::MD5 loaded ok
CPAN: Compress::Zlib loaded ok
Checksum for
/cygdrive/c/arkady/.cpan/sources/authors/id/B/BB/BBIRTH/Win32-SerialPort-0.19.tar.gz
ok
Scanning cache /cygdrive/c/arkady/.cpan/build for sizes
SerialPort-0.19/
SerialPort-0.19/README
SerialPort-0.19/Changes
SerialPort-0.19/README.txt
SerialPort-0.19/Makefile.PL
SerialPort-0.19/MANIFEST
SerialPort-0.19/Altport.pm
SerialPort-0.19/t/
SerialPort-0.19/t/test1.t
SerialPort-0.19/t/test2.t
SerialPort-0.19/t/test3.t
SerialPort-0.19/t/test4.t
SerialPort-0.19/t/test5.t
SerialPort-0.19/t/test6.t
SerialPort-0.19/t/test7.t
SerialPort-0.19/lib/
SerialPort-0.19/lib/Win32API/
SerialPort-0.19/lib/Win32API/CommPort.pm
SerialPort-0.19/lib/Win32/
SerialPort-0.19/lib/Win32/SerialPort.pm
SerialPort-0.19/eg/
SerialPort-0.19/eg/any_os.plx
SerialPort-0.19/eg/demo1.plx
SerialPort-0.19/eg/demo2.plx
SerialPort-0.19/eg/demo3.plx
SerialPort-0.19/eg/demo4.plx
SerialPort-0.19/eg/demo5.plx
SerialPort-0.19/eg/demo6.plx
SerialPort-0.19/eg/demo7.plx
SerialPort-0.19/eg/demo8.plx
SerialPort-0.19/eg/demo9.plx
SerialPort-0.19/eg/options.plx
SerialPort-0.19/eg/stty.plx
SerialPort-0.19/html/
SerialPort-0.19/html/Win32/
SerialPort-0.19/html/Win32/SerialPort.html
SerialPort-0.19/html/Win32API/
SerialPort-0.19/html/Win32API/CommPort.html
Removing previously used /cygdrive/c/arkady/.cpan/build/SerialPort-0.19

CPAN.pm: Going to build B/BB/BBIRTH/Win32-SerialPort-0.19.tar.gz


Creating new t/DefaultPort.pm

Win32::SerialPort and Win32API::CommPort
VERSION 0.19
No 'Makefile' will be created
Test with: perl test.pl
Install with: perl install.pl

Test with nothing connected to COM1
or for different port: perl test.pl PORT
Timeout tests can take up to 30 seconds per test

Creating new test.pl
Creating new install.pl
make: *** No targets specified and no makefile found. Stop.
/usr/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top