Re: Takes really long -- hp-jdex does too

David Paschal (
Tue, 16 Nov 1999 02:24:28 -0800

> The call to the sane_open-function takes a tremendious long time - with my
> scanner, which is a mustek 12000(-something) on a ncr-SCSI-Card on a SuSE
> linux, it takes easily 10-15 seconds. In that period, the GUI hangs. I
> think, Oliver, you have a similar problem in XSane ?
> My question now is: What do others think, how does that work with other
> scanners (I didnt check it with more powerfull scanners yet) ? Is that only
> a problem with my cheap Mustek-scanner ? Has anybody a workaround ?

I ran into a similar problem while hacking the HP backend to support HP
OfficeJet MFPs connected to HP JetDirect print servers. The problem is that
when I close the network scan connection to the JetDirect, it keeps the scan
connection to the peripheral open for several more seconds. As a result, if
I try to reconnect to the JetDirect during this time, I get a "busy"
indication, and I have to delay and retry.

This was particularly problematic because I tend to get numerous
close-and-reopen request sequences in a row, and very quickly, which slowed
the GUI down to a crawl throughout operation! I think these frequent reopens
are due to somebody (perhaps the frontend?) wanting to do a SCSI TEST UNIT
READY operation on the scanner? This operation has no effect on non-SCSI
connections (which certainly is the case here), but the open and close still

For the time being, I solved this problem by caching the file descriptor I
get from the first open, faking out subsequent closes, and reusing the
cached file descriptor upon subsequent opens. This "solution" causes two
other problems, however: (1) Multiple MFPs cannot be specified in hp.conf,
since the connection to the first device will be recycled upon connection
attempts to subsequent devices. (2) Because the network connection to the
JetDirect is so persistent, the MFP is hogged by the xscanimage or xsane
user such that nobody else can scan on that device, for example through
JetDirect's web-scan feature.

If anybody has ideas on better ways to deal with this issue, I would
greatly appreciate hearing about them. Again, my web page is at

David Paschal

Source code, list archive, and docs:
To unsubscribe: echo unsubscribe sane-devel | mail