Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!ox.com!math.fu-berlin.de!fauern!unido!mikros!mwtech!joerg From: joerg@mwtech.UUCP (Joerg Werner) Newsgroups: comp.os.minix Subject: Re: Minix ST 1.5 printer driver problems Message-ID: <1095@mwtech.UUCP> Date: 22 Apr 91 09:24:09 GMT References: <30@oski.toppoint.de> Reply-To: joerg@mwtech.UUCP (Joerg Werner) Organization: MIKROS Systemware, Darmstadt/W-Germany Lines: 36 In article <30@oski.toppoint.de> schlut@oski.toppoint.de (Olaf Schlueter) writes: >When I wrote a HP Deskjet + printer driver for mroff on Minix ST 1.5, I >got problems with the kernel printer driver. It looked like on the way from >the mroff driver to the printer somewhere bytes had been added or removed >so I got nasty bit shifts and misinterpreted graphics data on the >page occasionally. What had been most weird, it was only partially >reproducable, i.e. I could count on getting at least two destroyed lines >on the page, but could not predict where it would happen, even with >essantially the same output. The problem is definitely in the kernel: I've had the same problem with NEC P6+! >Every once and again during the output the kernel reported "printer still >busy". To cite Mr. Spock "That's fascinating", since the place where this >message is produced, is entered on response to a printer not busy interrupt. Delete the print statement :-) >Just a layer above in piaint() I guess a race condition: there is >a sequence of code looking like: > > while(left > 0) { outchar(*addr++); left--; ... } > Yes, there is a race condition. But the solution is very simple. The Problem is, that piaint() is reentered before left is decremented. My solution (since MINIX ST 1.1) is: while(left > 0) { left--; outchar(*addr++); ... } Decrement left _before_ outchar() is called! Ciao Joerg -- Joerg Werner, email: joerg@mwtech.UUCP, voice: 49-(0)6151-37 33 66