[sane-devel] The never ending chronicle of the Mac OS X libusb port

Mattias Ellert mattias.ellert at tsl.uu.se
Wed Oct 5 18:04:58 UTC 2005

The never ending chronicle of the Mac OS X libusb port

Since I first started providing binary packages for libusb and sane  
for MacOS X in 2003, several people started to report problems with  
USB scanners that turned out to be related to problems in libusb.  
Over time, with the help of concerned users having various scanners  
providing logs, I managed to patch the bugs and gradually provide  
better and better versions of libusb. I have of course submitted my  
patches to the libusb developers, and the problems I have found have  
eventually been fixed also in the official code repository. The  
problems with libusb that have affected the sane drivers the most  
have been related to the handling of timeouts, that detected errors  
were not always propagated up to the caller as an error code, and  
problems with changing the usb configuration on a claimed device (the  
claim was lost).

Finally around April this year libusb had reached a state where it  
was mostly working and most of the bugs mentioned above had been  
fixed in the CVS repository. Unfortunately around the same time a new  
bug appeared in the libusb code that caused connected USB devices to  
be detected multiple times, and listed more than once when libusb was  
asked to return the list of attached devices. For each device only  
one of the contact strings were actually working, but of course that  
failed miserably in sane that relies on auto detection of usb devices.

The double counting was fixed in the CVS repository in September, and  
for a few minutes the CVS actually contained a fully working libusb  
for the first time I can recall. However, only 10 minutes after that  
the code was changed again in order to implement a feature request to  
accomodate timeouts for interrupt operations. This is probably a good  
thing, but unfortunately this change to the code made libusb break  
again. Thanks to numerous people that have sent me logfiles, and that  
have tested the patch I have created to fix the problem, I have now a  
working libusb package that can be downloaded from my website. Well,  
at least it doesn't have this bug... I have submitted the new patch  
to the developers of libusb, and hopefully it will end up in the  
official code soon. At the moment a checkout form the libusb CVS is  
however not working.

Best regards,

     Mattias Ellert


More information about the sane-devel mailing list