smagt@ark.cs.vu.nl (Smagt v der PPP) (03/06/87)
The MINIX printer driver may not work for all printers. The trouble is this. Printer.c expects a printer status of 0xDF when the printer is ready, or 0x5F when the printer is busy. I discovered, however, that some printers (e.g. mine) return some other values as well: 0xDC and 0xD8 when ready, or 0x58 or 0x5C when busy. So I adapted printer.c to be less choosy, i.e. to accept all 0xD? as "ready" and 0x5? as "busy" status. The patches are these: on line 121, change if (value == NORMAL_STATUS) { to if ((value | LOW_FOUR) == NORMAL_STATUS) { on line 127, change if (value == BUSY_STATUS) { to if ((value | LOW_FOUR) == BUSY_STATUS) { on line 139, change if (value == BUSY_STATUS) r = EAGAIN; to if ((value | LOW_FOUR) == BUSY_STATUS) r = EAGAIN; on line 253, change if (value == NORMAL_STATUS) { to if ((value | LOW_FOUR) == NORMAL_STATUS) { and on line 264, change } else if (value == BUSY_STATUS) { to } else if ((value | LOW_FOUR) == BUSY_STATUS) { I deliberately didn't change the 'value' itself, because other programs (e.g. lpr) use its value to print an error message (if anything is wrong). Prof. Tanenbaum accepted my patched readily. P.P.Patrick van der Smagt.
smagt@cs.vu.nl (Smagt v der PPP) (05/07/87)
Again I post patches to the MINIX printer driver. I did this before, but those patches did not do well. Some printers, when being addressed using the printer driver with my previous patches, stopped after printing a few lines for returning an incorrect status (according to the driver). All the driver could do then was display "Printer error". The patches in kernel/printer.c are very simple, again: change #define NORMAL_STATUS 0xDF /* ... */ to #define NORMAL_STATUS 0x90 /* ... */ change #define BUSY_STATUS 0x5F /* ... */ to #define BUSY_STATUS 0x10 /* ... */ and add the definition #define STATUS_MASK 0xB0 /* mask to filter out status bits */ Next, all tests if (value == NORMAL_STATUS) and if (value == BUSY_STATUS) must be changed to if (value&STATUS_MASK == NORMAL_STATUS) or if (value&STATUS_MASK == BUSY_STATUS) respectively (for a total of five tests). For those of you who installed my previous patches, the 'original' tests in your file printer.c look like if ((value|LOW_FOUR) == NORMAL_STATUS) and if ((value|LOW_FOUR) == BUSY_STATUS) I do trust your printer will work now. P. van der Smagt VU Informatica Amsterdam The Netherlands (send mail to smagt@cs.vu.nl)
smagt@cs.vu.nl (Smagt v der PPP) (05/12/87)
In my last patches for the printer driver (7 May 1987) I forgot some very important parentheses. I'm sorry. I hope you noticed it. In the previous message I said you had to change if (value == ...._STATUS) to if (value&STATUS_MASK == ...._STATUS) This should have been if ((value&STATUS_MASK) == ...._STATUS) however! (.... = BUSY or NORMAL) P. van der Smagt VU Informatica Amsterdam The Netherlands (send mail to smagt@cs.vu.nl)