[sane-devel] [PATCH] sanei usb improvements

Olaf Meeuwissen olaf.meeuwissen at avasys.jp
Tue Mar 12 23:54:13 UTC 2013

Stef writes:

>      here is a cleaned-up patchset that splits device scanning logic 
> from sanei_usb_init(),
> add a sanei_usb_exit() to free allocated resources. I also brings some 
> fixes and improvements. It also add a test program to test the changes done:

Thanks for taking the trouble of cleaning up.

> 0001-split-device-scanning-logic-from-sanei_usb_init.patch :
>      split device scanning from init in a new sanei_usb_scan_devices(). 
> This function is still called by sanei_usb_init() to preserve current 
> behaviour. sanei_usb_scan_devices() is split in smaller functions 
> (instead a big one) dedicated to a particular scanning method.
> 0002-correct-debug-messages.patch :
>      change debug messages since code some code has moved.
> 0003-add-sanei_usb_exit-function-create-a-sanei_usb_exit-.patch :
>      create an sanei_usb_exit() function that free resources when the 
> backend give up on
> using USB.

These look fine to me.

> 0004-convert-genesys-backend-to-use-new-sanei_usb-functio.patch :
>      convert the genesys backend to use the new functions.
> 0005-improve-missing-test-logic.patch :
>      simplify some test on missing devices
> 0006-unused-and-reassigned-values-fixes.patch :
>      fix some unused and reassigned values detected by cppcheck.
> 0007-white-space-cleanup.patch :
>      white space cleanup
> 0008-rewrite-sanei_usb_get_vendor_product-rewrite-sanei_u.patch :
>      rewrite sanei_usb_get_vendor_product with the same logic used in 
> sanei_usb_get_vendor_product_byname.

Personally I don't really care much about these but on skimming them
they appear to be okay.

> 0009-fix-memleak-when-reusing-an-already-stored-device.patch :
>      fix a memleak when not storing an already detected device.
> 0010-don-t-use-kernel-device-when-libusb-is-available.patch :
>      use kernel device only when libusb isn't available.


> 0011-add-testsuite-sanei-for-sanei-test-programs.patch :
>      add testsuite/sanei/sanei_usb_test.c program

I'm definitely in favour of adding tests, especially if they do not
require access to a device.  FWIW, you should add a copyright and
license blurb to the test program and you want to change the copyright
claim of the automake file for the testsuite.  I doubt Chris was
prescient and wrote that for you way back in 2009 ;-)

Hope this helps,
Olaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION
FSF Associate Member #1962               Help support software freedom

More information about the sane-devel mailing list