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

Am 07.02.14 10:40, schrieb Michael van Elst:
> (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
> printjob.
> _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.

The delay of 1 second between two accesses to a serial printer can be a
huge problem in some applications (like the issue we just had at a large
site).  Consider that opening a cash drawer is often done by sending
some escape sequence to a printer.  so that's job 1.  Now the next thing
is to print a receipt, job nr 2.  That already gives a waiting time of
two seconds to close a sale, which is way to long.

Serial printers are in no way a thing of the past, they are heavily used
for stores, boarding passes, ticket printers etc.

setting softcar in /etc/ttys solved the problem for all printers we use.

>> 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.

At least our applications don't use lpr/lpd at all.  They talk directly
to the printers.  So if we don't want to set stuff in /etc/ttys, we can
do it in the application itself.

Home | Main Index | Thread Index | Old Index