tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Closing a serial device takes one second (Marc Balmer) writes:

>The other proposed "solution", namely to add a delay to open in case the
>device is reopened, does not help either in the use cases where we run
>into trouble:

>When talking to serial printers, we open a tty, send the data to the
>printer and then close the tty again.  This is done several times in a
>sequence, each time causing a one second delay.

I am quite sure that lpd does not open/close the device for sending a
few characters every time. Instead it keeps it open for the whole

_Even here_ some printers recognize the hangup signal to denote the
end of a print job, and a 1 second pause between print jobs is
irrelevant. On the other hand, serial printers are mostly a thing
of the past.

>Now adding softcar to the respective line /etc/ttys can fix the issue,
>if the hardware does not rely on it (which we are currently testing).

I don't think /etc/ttys is the correct place to configure the port
for print jobs. Instead you can use /etc/printcap (xc/xs attributes)
to clear or set tty flags, in particular you can clear the HUPCL flag.

#define NOHANG 0x01000000      /* (no-op) was no SIGHUP on carrier drop */

if (ISSET(flags, NOHANG))
                CLR(cflag, HUPCL);

->   xc=0x01000000   does what you need.

Home | Main Index | Thread Index | Old Index