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

2012-04-19 Thread Johannes Meixner

Hello,

On Apr 19 10:11 m. allan noah wrote (excerpt):
> This in interesting. If you have the user compile a simple test
> program which just calls the 3 libusb functions, does his mouse stop?
> If so, there is nothing that can be done in sane.

Yes, as I wrote in my initial mail, if this is the case,
blacklisting in SANE cannot help in this particular case.

For me this particular issue was only a trigger to think about
whether or not blacklisting devices could make sense at all
to be prepared to avoid other problematic cases.

For example:

Assume there are several USB devices connected
with USB device class 255 "Vendor Specific Class"
but only one of them is a scanner.

As far as I understand the check_libusb_device function
in tools/sane-find-scanner.c it runs check_usb_chip
for all USB devices with class 255.

Assume some particular USB devices with class 255
(which are no scanners) do not like what check_usb_chip does.

Then it should help in this case if USB devices could be
blacklisted in SANE so that sane-find-scanner would not
run check_usb_chip on them.


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



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

2012-04-19 Thread Johannes Meixner

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



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

2012-04-19 Thread m. allan noah
This in interesting. If you have the user compile a simple test
program which just calls the 3 libusb functions, does his mouse stop?
If so, there is nothing that can be done in sane.

allan