Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!usc!ucsd!nosc!cod!hall From: hall@cod.NOSC.MIL (Robert R. Hall) Newsgroups: comp.os.minix Subject: patch for kernel/printer.c Keywords: printer driver Message-ID: <1614@cod.NOSC.MIL> Date: 20 Aug 89 03:35:24 GMT Organization: Naval Ocean Systems Center, San Diego Lines: 110 With printer driver version 1.3 and the protected mode version, after printing 2 pages of a 3 page file the error message 'Printer error' would apprear on the screen and the print job would terminate. The following patch is what I found neccessary to correct this problem. The cdiff is relative to Bruce Evan's protected mode version but patch will also apply it to version 1.3d with offset warning messages thought. Robert R. Hall hall@nosc.mil --------------------- kernel/printer.c.cdif ---------------------- echo x - printer.c.cdif sed '/^X/s///' > printer.c.cdif << '/' X*** /usr/m286pm/kernel/printer.c Tue Jul 18 21:13:42 1989 X--- printer.c Sat Aug 19 19:33:55 1989 X*************** X*** 32,44 **** X X #define NORMAL_STATUS 0x90 /* printer gives this status when idle */ X #define BUSY_STATUS 0x10 /* printer gives this status when busy */ X #define ASSERT_STROBE 0x1D /* strobe a character to the interface */ X #define NEGATE_STROBE 0x1C /* enable interrupt on interface */ X #define SELECT 0x0C /* select printer bit */ X #define INIT_PRINTER 0x08 /* init printer bits */ X #define NO_PAPER 0x20 /* status bit saying that paper is up */ X #define OFF_LINE 0x10 /* status bit saying that printer not online*/ X- #define PR_ERROR 0x08 /* something is wrong with the printer */ X #define PR_COLOR_BASE 0x378 /* printer port when color display used */ X #define PR_MONO_BASE 0x3BC /* printer port when mono display used */ X #define CANCELED -999 /* indicates that command has been killed */ X--- 32,44 ---- X X #define NORMAL_STATUS 0x90 /* printer gives this status when idle */ X #define BUSY_STATUS 0x10 /* printer gives this status when busy */ X+ #define READY_BIT 0x80 /* printer ready status bit */ X #define ASSERT_STROBE 0x1D /* strobe a character to the interface */ X #define NEGATE_STROBE 0x1C /* enable interrupt on interface */ X #define SELECT 0x0C /* select printer bit */ X #define INIT_PRINTER 0x08 /* init printer bits */ X #define NO_PAPER 0x20 /* status bit saying that paper is up */ X #define OFF_LINE 0x10 /* status bit saying that printer not online*/ X #define PR_COLOR_BASE 0x378 /* printer port when color display used */ X #define PR_MONO_BASE 0x3BC /* printer port when mono display used */ X #define CANCELED -999 /* indicates that command has been killed */ X*************** X*** 208,215 **** X /* The printer is not ready. Display a message on the console telling why. */ X X if (status & NO_PAPER) printf("Printer is out of paper\n"); X! if ((status & OFF_LINE) == 0) printf("Printer is not on line\n"); X! if ((status & PR_ERROR) == 0) printf("Printer error\n"); X } X X X--- 208,215 ---- X /* The printer is not ready. Display a message on the console telling why. */ X X if (status & NO_PAPER) printf("Printer is out of paper\n"); X! else if ((status & OFF_LINE) == 0) printf("Printer is not on line\n"); X! else printf("Printer status error is: 0x%x\n", status); X } X X X*************** X*** 246,254 **** X X if (pr_busy == FALSE) return; /* spurious 8259A interrupt */ X X! while (pcount > 0) { X! port_in(port_base + 1, &value); /* get printer status */ X! if ((value&STATUS_MASK) == NORMAL_STATUS) { X /* Everything is all right. Output another character. */ X ch = get_phys_byte(offset); /* fetch char from user buf */ X port_out(port_base, ch); /* output character */ X--- 246,258 ---- X X if (pr_busy == FALSE) return; /* spurious 8259A interrupt */ X X! if (pcount > 0) { X! for (i = 0; i < DELAY_COUNT; i++) { X! port_in(port_base + 1, &value); /* get printer status */ X! if ((value&READY_BIT) == READY_BIT) break; X! } X! if ((value&STATUS_MASK) == BUSY_STATUS) return; /* false alarm? */ X! else if ((value&STATUS_MASK) == NORMAL_STATUS) { X /* Everything is all right. Output another character. */ X ch = get_phys_byte(offset); /* fetch char from user buf */ X port_out(port_base, ch); /* output character */ X*************** X*** 257,267 **** X offset++; X pcount--; X cum_count++; /* count characters output */ X! for (i = 0; i < DELAY_COUNT; i++) ; /* delay loop */ X! } else if ((value&STATUS_MASK) == BUSY_STATUS) { X! return; /* printer is busy; wait for interrupt*/ X! } else { X! break; /* err: send message to printer task */ X } X } X X--- 261,267 ---- X offset++; X pcount--; X cum_count++; /* count characters output */ X! return; /* wait for next interrupt */ X } X } X /