[sane-devel] Could blacklisting USB devices make sense?

Johannes Meixner jsmeix at suse.de
Thu Apr 19 13:59:36 UTC 2012


Hello,

we (i.e. openSUSE) got a special issue report

https://bugzilla.novell.com/show_bug.cgi?id=701368

A particular USB mouse model gets disabled when finding USB devices
via libusb e.g. by running sane-find-scanner.


There is now the question whether or not it could make sense
if there was a config file for SANE where particular USB devices
could be blacklisted (by idVendor and/or idProduct and/or DeviceClass
and/or whatever else) so that SANE would leave such devices alone?

I think in general it could make sense to avoid issues
in particular exceptional cases.


Details:

As far as I understand what goes on (but I am not at all a USB expert)
in the SANE sources the sanei_usb_init function in sanei/sanei_usb.c
calls the libusb functions usb_init usb_find_busses usb_find_devices
before it loops through all of the busess and all of the devices
to find USB devices which are of interest for SANE:
-----------------------------------------------------------------------
sanei_usb_init
...
   DBG (4, "sanei_usb_init: Looking for libusb devices\n");
   usb_init ();
#ifdef DBG_LEVEL
   if (DBG_LEVEL > 4)
     usb_set_debug (255);
#endif /* DBG_LEVEL */

   usb_find_busses ();
   usb_find_devices ();

   /* Check for the matching device */
   for (bus = usb_get_busses (); bus; bus = bus->next)
     {
       for (dev = bus->devices; dev; dev = dev->next)
         {
-----------------------------------------------------------------------
As far as I see SANE works basically as described in
http://libusb.sourceforge.net/doc/examples-code.html

If in this particular case the USB mouse gets disabled when
the libusb functions usb_init usb_find_busses usb_find_devices
are called, blacklisting the USB mouse in SANE cannot help
because those libusb functions are not device specific.


Nevertheless I think in general it could make sense to avoid issues
in other exceptional cases if devices could be blacklisted in SANE.

Perhaps for USB and also for SCSI in files like
/etc/sane.d/sanei-usb.conf and /etc/sane.d/sanei-scsi.conf


What do you think?


Kind Regards
Johannes Meixner
-- 
SUSE LINUX Products GmbH -- Maxfeldstrasse 5 -- 90409 Nuernberg -- Germany
HRB 16746 (AG Nuernberg) GF: Jeff Hawn, Jennifer Guild, Felix Imendoerffer



More information about the sane-devel mailing list