Path: utzoo!attcan!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!ast@cs.vu.nl From: ast@cs.vu.nl (Andy Tanenbaum) Newsgroups: comp.os.minix Subject: Fix to printer.c Message-ID: <1785@ast.cs.vu.nl> Date: 8 Dec 88 21:38:09 GMT Sender: ast@cs.vu.nl Reply-To: ast@cs.vu.nl (Andy Tanenbaum) Organization: VU Informatica, Amsterdam Lines: 54 There have been lots of reports about printers not working, giving printer busy or out of paper and refusing to work. A few weeks ago, somebody (I forget who, sorry) posted a message saying these were caused by using the wrong printer port. I have now changed printer.c to make a dynamic test to discover the printer port. The fix below to printer.c should end this problem forever. If it doesn't, let me know. Andy Tanenbaum (ast@cs.vu.nl) *** printer.old Thu Dec 8 21:18:44 1988 --- printer.c Thu Dec 8 21:56:54 1988 *************** *** 221,230 **** { /* Color display uses 0x378 for printer; mono display uses 0x3BC. */ ! int i; ! extern int color; ! ! port_base = (color ? PR_COLOR_BASE : PR_MONO_BASE); pr_busy = FALSE; port_out(port_base + 2, INIT_PRINTER); for (i = 0; i < DELAY_COUNT; i++) ; /* delay loop */ --- 221,233 ---- { /* Color display uses 0x378 for printer; mono display uses 0x3BC. */ ! int i = 0, testval = 0xAA; ! extern int color; ! ! /* See if PR_COLOR_BASE installed by writing to it and reading it back. */ ! port_out(PR_COLOR_BASE, testval); /* output random bit pattern */ ! port_in(PR_COLOR_BASE, &i); /* read it back */ ! port_base = (i == testval ? PR_COLOR_BASE : PR_MONO_BASE); pr_busy = FALSE; port_out(port_base + 2, INIT_PRINTER); for (i = 0; i < DELAY_COUNT; i++) ; /* delay loop */ *************** *** 233,239 **** /*===========================================================================* ! * pr_char * *===========================================================================*/ PUBLIC pr_char() { --- 236,242 ---- /*===========================================================================* ! * pr_char * *===========================================================================*/ PUBLIC pr_char() {