Re: [nottingham] Serial port data acquisition in Perl

From: Robert Davies (rob_davies@ntlworld.com)
Date: Mon 14 Jan 2002 - 20:23:01 GMT


On Monday 14 January 2002 19:57, you wrote:
> On Mon, Jan 14, 2002 at 07:03:17PM +0000, Tom Bird wrote:
> > On Mon, 14 Jan 2002, Graeme Fowler wrote:

>> This is probably ugly, evil and just totally wrong, but when I needed to
>> send data to the serial port to control the little LCD screen thing I
>> acquired, I just used /dev/ttyS0 like a file and shoved the data into
>> that.
> I can't see why that's necessarily so wrong - all communication is
> via 'files' in *nix so why should doing that be so wrong?

I think that's beautiful and good orthogonal behavious.

Not at all, it's using ioctl's that is ugly. The I/O absolutely has to go
through a device, which is generally accessed via a filedescriptor, openened
on some filename. Even the tty (and many programs open /dev/tty for terminal
i/o) for standard output has to be opened by something, either getty or login
though the detail's not important.

There was quite alot of discussion on LMKL a while back about using Plan 9
style filenames to set IOCTL's from user space on drivers. Soemthing like
/dev/ttyS1/speed=19200 for example. Or should you echo speed=19200 >
/proc/sys/ttyS1?

Rob
--------------------------------------------------------------------
http://www.lug.org.uk http://www.linuxportal.co.uk
http://www.linuxjob.co.uk http://www.linuxshop.co.uk
--------------------------------------------------------------------



This archive was generated by hypermail 2.1.3 : Mon 14 Jan 2002 - 20:25:19 GMT