[sane-devel] libusb - problems with open/close of device in backend?

Steven Palm n9yty@n9yty.com
Mon, 23 May 2005 11:12:58 -0500


Still working on the microtek2 backend stuff for libusb...

It seems that the odd issues I'm encountering will go away if I don't  
ever close the USB device. If I leave it open for the duration of the  
backend lifetime, scanimage -L will properly identify it. If I open  
and close it for each operation, I get timeouts trying to read  
responses, and if I increase the response size the scanner will send  
back a larger packet which seems to show that I miss the first block  
of data (32-bytes for this scanner).

Is this a problem anywhere else with the libusb stuff?

Is there harm in leaving the scanner open until sane_exit ?

At least for now doing this allows scanimage -L to find the scanner.   
That is good.  However, another glitch is cropping up when I try to  
send the system_status block back to the scanner... The USB log shows  
the transmission is without error, but after that point I get no more  
response from the scanner to the remaining commands. The odd thing  
is, I've not changed anything about the logic of what is being sent  
to the scanner, just sending it via libusb instead of writing to the  
fd of the linux kernel scanner driver. Oh well. :-)