2009/2/15 Julien BLACHE <jb at jblache.org>:
> Hi,
>
> The attached patch adds libusb-1.0 support to sanei_usb, in
> synchronous mode, so it's a simple port from the older API to the
> pretty similar new one.
>
> There is no spectacular performance improvement, though it is slightly
> faster on big scans and consumes less CPU (which is always good) due
> to the underlying non-blocking, asynchronous libusb.
>
> I'll commit to CVS later once I'll have the tools ported over too, but
> I'm posting the patch to get more eyes on the code.
>
> I have one question about sanei_usb_init(), as ISTR recent discussions
> about calling sanei_usb_init() several times. Is that allowed? If yes,
> there's a slight change that needs to be done (not reiniting libusb).

I've not had a chance to look at the code, but your memory is correct.
In order to detect when new devices are installed, a backend currently
needs to re-call sanei_usb_init during sane_get_devices. I would very
much like to see sanei_usb_init cut into two properly named functions-
one that calls the libusb init function, and one that scans the busses
for devices. An alternative approach would be to keep the single
function, but protect the libusb init call with a global. That is less
clear, but less code to change :)

> To test the patch: apply, run autoconf and autoheader, make sure you
> have libusb-1.0 installed properly and run configure. libusb-1.0 is
> preferred over libusb in this patch, so it'll pick it up. You can
> verify by grepping for USB on the generated Makefiles, and that should
> give you "USB_LIBS =  -lusb-1.0".

thanks!

allan
-- 
"The truth is an offense, but not a sin"

Reply via email to