Am Montag, den 25.02.2008, 18:13 +0100 schrieb Rainer Hantsch: > | > I only want to use sme kind of API, Class, Object or set of procedures > | > which allows me similar things as were possible with the FOSSIL > | > driver: > | > - Buffered I/O > | > - Flow Control as I need (RTS/CTS, XON/XOFF, Both, None) > | > - Direct Control of control lines like DTR, ... > | > - Possibilities for monitoring fill level of buffers, to force > | > them to be erased (made empty), ... > | > | In Linux you simply open() the /dev/ttySxx device and then read() and > | write() to it. This is for data, for other stuff (e.g. flow > | control, ...) can be done via ioctl() (please excuse the C syntax). But > | as Horacio already said you probably go better with a wrapper, e.g. > | Synaser or TSerial (but I didn't use either).
[...] > As far as I could find out some years ago, the /dev/ttySxx are having no > buffer. I think that is a matter of your OS and maybe a question of port settings, but I'm not really sure. ;) > --> "BLOCKING" is the magic word which is the problem. :-( That problem is easily solved. I'm only using serial.pp for reading a dumb and slow dmm, but in principle (on FreeBSD): fCom := fpOpen('/dev/cuaa0', O_RDWR OR O_NOCTTY );//OR O_NONBLOCK); See the commented tail of that line? Linux must have something similar (IMHO). That way you can switch to the expected behaviour. After opening some settings need to be done: tios: termios; begin fillchar(tios, sizeof(tios), #0); tios.c_ispeed := B1200; tios.c_ospeed := B1200; tios.c_cflag := CREAD or CLOCAL or CS7 or CSTOPB; tios.c_oflag := 0; tios.c_iflag := IGNBRK OR IGNPAR; tios.c_lflag := 0; r := tcsetattr(fCom, TCSANOW, tios); All of that could be done using: SerSetParams(fCom, 1200, 7, NoneParity, 2, []); but for me that did not set all I needed, though I don't remember what was missing. And for controlling the lines you can do sth. lke: SerSetRTS(fCom, FALSE); and the same for other lines. Look into the serial unit and also the tios unit. On FreeBSD termios(4) has a lot of information (and it states every line has an input queue aka buffer). HTH, Marc _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal