Andrea Arcangeli (arcangeli@mbox.queen.it)
Wed, 29 Apr 1998 01:05:01 +0200 (CEST)
Some people was having troubles with lp interrupt driven. Great thanks to
Andreas Muck <andi@koala.rhein-neckar.de>, "Garst R. Reese"
<reese@isn.net>, Anthony DeStefano <destefano@usa.net> that alpha-testing
my _lot_ of patches made me able to discovered the lp bug (or better to
develop a workaround ;-).
The problem is pretty simple (now that I just discovered it ;-). HP
Deskjet (for example) reput ACK low and so generate an interrupt before to
be ready and so before to put BUSY high. The current lp code check if BUSY
is high or ACK is low and if this result false it thinks that the
interrupt is not yet happened and so go to sleep on the interrupt.
For some printer instead the interrupt could be just happened and so we
can' t more take care of the state of the printer to know if we must wait
or not the interrupt.
In this patch I implemented the workaround.
This patch make also configurable (via editing lp.c) LP_STATS and
LP_NEED_CAREFUL since I am pretty sure nobody is using it. If somebody has
strange hardware or so on, he only need to exchange #undef LP_NEED_CAREFUL
with #define LP_NEED_CAREFUL 1 (does the same with LP_STATS if he like to
compile the status staff) and all future patches will apply cleanly and
all will be fine for him, and LP_STATS and LP_CAREFUL will not slowdown
us. Theorically we could make them CONFIG options but as I just said I
think nobody is using it.
I also fixed a possible race conditions in lp_open in SMP system due not
atomic operation. To do that I added a spinlock to lp_struct. Since
lp_struct is a static area I tried to initialize the spinlock as usual.
Unfortunately this code doesn' t compile.
[0 ... LP_NO-1] = {NULL, 0, LP_INIT_CHAR, LP_INIT_TIME,
LP_INIT_WAIT,
NULL,
#ifdef LP_STATS
0, 0, {0},
#endif
NULL, 0, 0,
SPIN_LOCK_UNLOCKED }
SPIN_LOCK_UNLOCKED on my UP kernel means {} and unfortunately gcc2.7.2.3
segfault (sig11) if I try to use SPIN_LOCK_UNLOCKED there. egcs compile
the same code fine so it' s really a compiler bug. Since I think it' s
better take 2.7.2.3 compatibilty instead of force people to use egcs ;-) I
didn' t initialized the spinlock in the static area (leaving it as the
last field) and I do it by hand at runtime.
The patch for now is tested by me, Andreas, Anthony and Garst and works
great for us.
If all is OK next days I will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3;X#\];)L219=VB_7!$%),/MTC3;X#\];)L219=VB_7!$%),/_@UKV/9W.S4V67Z"@(5L^%RG]A8<(+'XSK#
MFI_"LP^JVS0$1U70RG5"2+?!2GS]!J#Y.(+,G/4/@W51E[+SUY"2;<C%]DQ%
MTD];\C0N[$7?>I+U6R\2<&',Q?>OL*W;DV*@O7G,7]&W(!81N5DTG5*^4VW<
M*!-G"J`!Y+\"$<LTE["'&0_7>T4Q<4(N)!358E*27IW]1/NJC*N^),><91K-
ML6<%^Z^!FTO+LLSVX7[>CXEB642)2M8DSO%?2$_*=.RG^8%6XFM"233GZ<RG
M#A>6.$CO9RZ_>T5;M#A>6.$CO9RZ_>T5;TFDI@G`GR!K+2=JUN;,:R[<R(-$ZT(:8AM_=*@KLP0E3
M@M@K@I?BL/1T#M@K@I?BL/1T#Y@8>J9)U6]FT^^KX2!&'O`=_TU/B4S7N']TT8#]EXL:C3_/V"
M=0^N+@?(PCUG<,E%A8Q]#T"N*[[XL@?&N&<-!F19"2P'->W\#S!/!(9$.0``
`
end
-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2.0b3 on Wed 30 Dec 1998 - 10:17:41 EST