[nSLUG] /dev/ttyS0: open from Perl ??

Jeff Warnica jeffw at chebucto.ns.ca
Wed Mar 10 13:05:27 AST 2004


I've had simmilar problems in the last month... CPAN is your friend.
Look at Device::SerialPort.

On Wed, 2004-03-10 at 11:13, George N. White III wrote:
> On Wed, 10 Mar 2004, Mike wrote:
> 
> >
> > I'm trying to get a Kodak DC40 talking to my PC.  To do this, I have
> > to converse with the serial port (not USB).  A Perl script called
> > kdcpi should do this but doesn't.
> >
> > The problem seems to be that an attempt to open /dev/ttyS0 hangs.
> > That is, a call to open or sysopen (or to IO::File->new which uses
> > either open or sysopen) never returns.
> >
> > If I disconnect the camera and plug my modem back in, an attempt to
> > open /dev/ttyS0 turns on the the DTR light but nothing further
> > happens.  The [sys]open call hangs and never returns.
> >
> >    /dev/ttyS0 works with pppd and minicom
> >    /dev/ttyS0 is rw-rw-rw
> >
> > The kdcpi script uses IO::File->new($tty,$O_RDWR) and thus sysopen.
> > It's said to work.  Looking at the C code for minicom and the
> > Serial-Programming-HOWTO, I don't see any special incantations needed
> > to do an open on /dev/ttyS0.
> >
> > What am I missing?
> 
> ttyS0 is often a symbolic link, you need to see the permissions on
> the actual device file:
> 
> $ ls -l /dev/ttyS0 /dev/tts/0
> crw-rw---- 1 gwhite  tty 4, 64 Mar 9 14:24 /dev/tts/0
> lr-xr-xr-x 1 root    root    5 Jan  9 15:02 /dev/ttyS0 -> tts/0
> 
> You may also encounter permission issues for lock files.  I can't
> get kermit to work except as "sudo kermit" or I get:
> 
> (/usr2/people/gwhite/) C-Kermit>set port /dev/ttyS0
> /var/lock
> Sorry, write access to UUCP lockfile directory denied.
> 
> 
> 
> --
> George N. White III  <aa056 at chebucto.ns.ca>
>   Head of St. Margarets Bay, Nova Scotia, Canada
> 
> 
> _______________________________________________
> nSLUG mailing list
> nSLUG at nslug.ns.ca
> http://nslug.ns.ca/cgi-bin/mailman/listinfo/nslug
> 




More information about the nSLUG mailing list