From: Roger Leigh <roger.leigh@epictechnology.co.uk>
To: linux-msdos@vger.kernel.org
Subject: LPT timeout and forcing a flush
Date: Tue, 20 Sep 2005 15:39:32 +0100 [thread overview]
Message-ID: <20050920143932.GA27010@epictechnology.co.uk> (raw)
Hi folks,
In a DOS application I have to support, it prints a lot of print jobs to
LPT2 and LPT3. However, the LPT timeout is causing problems, even when
set to 1 second. The problem is that we need a fast response, but it
sends data so frequently that it can take a long time to time out. i.e.
we are repeatedly (potentially up to tens per second) creating print
jobs.
In order to work around this, I've tried this small hack:
--- dosemu-1.2.1.orig/src/base/dev/misc/lpt.c 2004-01-17 21:59:07.000000000 +0000
+++ dosemu-1.2.1/src/base/dev/misc/lpt.c 2005-09-20 14:38:54.260224500 +0100
@@ -72,6 +72,10 @@
/* dbug_printf("printer 0x%x status: 0x%x\n", LO(dx), HI(ax)); */
break;
+ case 3:
+ (lpt[LO(dx)].fops.flush)(LO(dx));
+ break;
+
default:
error("printer int17 bad call ax=0x%x\n", LWORD(eax));
show_regs(__FILE__, __LINE__);
@@ -127,6 +131,11 @@
int
printer_flush(int prnum)
{
+ if (lpt[prnum].file == NULL || lpt[prnum].remaining == -1) {
+ p_printf("LPT: flush aborted: nothing to print\n");
+ return 0;
+ }
+
p_printf("LPT: flushing printer %d\n", prnum);
fflush(lpt[prnum].file);
This is simply to allow me the ability to request that the print buffer
be flushed from within DOS. By setting AX=0x300, DX=0x1 and calling
INT 17h, the print queue for LPT2 gets flushed. I'm not too proud of
this--it's a gross hack. Is there a better way to request a flush?
This at least gives the program doing the printing a measure of control
over the buffering, so that I can tell DOSEMU when a print job has
ended.
I have a couple of concerns here:
fops.flush (print_flush()) is called within print_tick, but I'm
breaking that assumption. Are there any locking issues to be
aware of? I really don't want the tick to go off while I'm in
the middle of flushing, because it could crash the emulator e.g.
if the file has been closed and I try seeking on it. Is there
some lock held in print_tick that isn't available during an
interrupt?
I'm abusing INT 17h. Is there a cleaner (or at least, approved)
way of doing this?
Many thanks,
Roger
--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
next reply other threads:[~2005-09-20 14:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-20 14:39 Roger Leigh [this message]
2005-09-20 21:33 ` LPT timeout and forcing a flush Bart Oldeman
2005-09-21 12:25 ` Roger Leigh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050920143932.GA27010@epictechnology.co.uk \
--to=roger.leigh@epictechnology.co.uk \
--cc=linux-msdos@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox