Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
January 5, 2005, 5:42 pm
rate this thread
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:
sysopen SERIAL, "COM$:", O_RDWR;
to open the port. Is it suitable for my purposes?
Thanks in advance,
Re: How to set the baud rate on a serial port (Perl under cygwin)?
> 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?
CPAN troubles (Was: Re: How to set the baud rate on a serial port (Perl under cygwin)?)
Paul Lalli wrote:
> > 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
> > under cygwin)?" says it all.
> A search for 'SerialPort' at search.cpan.org turns up a number of
> 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,
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
Scanning cache /cygdrive/c/arkady/.cpan/build for sizes
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
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