Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!cancer.vividnet.com!hunter.premier.net!op.net!news.mathworks.com!news-res.gsl.net!news.gsl.net!portc01.blue.aol.com!newsxfer2.itd.umich.edu!agate!sunsite.doc.ic.ac.uk!dundee.ac.uk!zippy.dct.ac.uk!str-ccsun!not-for-mail
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Serial port reading
Message-ID: <4tbo4q$ks1@vulture.dmem.strath.ac.uk>
From: nbc@vulture.dmem.strath.ac.uk (Neil Brendan Clark)
Date: 27 Jul 1996 01:33:30 +0100
References: <Pine.BSF.3.91.960719175019.5545A-100000@ns.tid.com>
Organization: University of Strathclyde
NNTP-Posting-Host: vulture.dmem.strath.ac.uk
Lines: 33
Nuno Filipe Monteiro Nunes <nfmn@ns.tid.com> wrote:
>
>So my problem is this: I have a device connected to my pc serial port
>(well, to both ports to be more precise...) and it is constantly dumping
>text lines which I have to dump to a file.
>So the thing is, how can I do this?
While it is possible to simply "cat" the device and redirect it to
a file, this is a bit messy and very dodgy. The best way IMHO is
to write a small C program for this purpose, which sets up the serial
parameters in a reproducable way. Check the man pages for tcsetattr,
tcgetattr, open, close, read and write, and have a look at
/usr/include/unistd.h.
If you want some example source, give me a mail and I'd be happy to help
out.
>So now that I've come to the experts I can just seat back and relax,
>right? :-))
<chuckle>, well once you have it sorted out you can help the next time :-)
>Anyway, I've allready lost a few days looking for this so it really is
>getting on my nerves, after all, how hard can it be to set up a simple
>serial line reader?
Funny, that's what I thought too... it's really not too bad when you know
how though.
--
/earth is 98% full ... | Neil Clark
please delete anyone you can. | Transparent Telepresence Group
| <http://telepresence.dmem.strath.ac.uk/~nbc>