lkml.org 
[lkml]   [1999]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: serial port - ioctl's prevent subsequent reads
   Date: Thu, 18 Nov 1999 10:09:41 +0100 (MET)
From: David Monniaux <David.Monniaux@ens.fr>
> That's not what CLOCAL means. Read the POSIX specification. POSIX

:-) Nobody has POSIX standards available around. I'll have it ordered by
the library.

Perhaps documenting the Linux kernel ioctl's and other settings would be a
step in the right direction. The only information I had about TIOCMGET/SET
was reading gpm sources.

The interfaces for TIOCMGET/SET/BIS/BIC are all taken from Unix System
V; that's for compatibility with programs written on other Unix systems.
It also means that there are a number of good books on the subject you
can order. Here are two:

>a) "Advanced programming in the Unix environment" by W R Stevens
> (Published by Addison Wesley)
>
>This is a classic text, and has two chapters worth reading: Chap. 11
>(Terminal I/O) and chap. 18 (A Modem Dialer); basically a chapter of
>theory with some small code examples and then a complete chapter of
>serial code.
>
>b) "POSIX programmer's guide: Writing portable Unix programs" by D Lewine
> (Published by O'Reilly)
>
>Chapter 8 (Terminal I/O) is an excellent read, and comes complete with
>annotated code for a small comms package.

There are books available, so you don't have to purchase the POSIX
specifications. However, POSIX is relatively cheap, all things
considered; it's far cheaper than the hardware that's in front of you,
and it's a very good and handy reference to have a round. I'd strongly
encourage you to purchase it. Other resources, such as the Single Unix
Specification from the Open Group, are available for free on-line
(http://www.opengroup.org/publications/catalog/web.htm).


> As far as the serial driver's enabling DTR when the port is opened; this

The problem is not DTR, but RTS. I don't care whether the kernel moves
DTR, but I don't understand why it would touch RTS even when we are
-crtscts (it pulls RTS low for a little period).

The RTS line is controlled by the UART's MCR register, and I have to
initialize that register to some value when a port is freshly
initialized. Currently, RTS is initialized to on if CBAUD is non-zero,
and off if CBAUD is 0.

Fundamentally, the RTS and DTR lines have well defined meanings within
the RS-232 specification. They're not random, arbitrary lines that you
can control up or down because it's convenient for you to do so. People
who write programs and make hardware assuming they can do so are doing
something fundamentally unportable, and it's really not something I'm
interested in supporting.

As I've said earilier, if you want to control the serial driver at a
very low level, and hook up a detonator to a RS-232 line, and control
precisely exactly when that line goes high or low, across open, closes,
etc., you probably shouldn't be using the serial driver. Write your own
low-level kernel module, since you probably don't need the rest of the
serial driver's functionality anyway.

- Ted


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.073 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site