[sane-devel] Re: Sane backend sm3600 do not working

Julien BLACHE jb@jblache.org
Sat, 30 Apr 2005 14:16:04 +0200


--=-=-=

Marian Eichholz <marian.eichholz@freenet-ag.de> wrote:

>> "SANE_DEBUG_SM3600=255 scanimage -L"
>> ---cut here---
>> [sanei_debug] Setting debug level of sm3600 to 255.
>> [sm3600] SM3600 init
>> [sm3600] SM3600 version: 1000005
>
> Thats pretty much sparse. Is usbdevfs in place?

There's a bug in sane_init(), a misuse of usb_find_busses(). Patch
attached.

>From the libusb documentation:
---
usb_find_busses will find all of the busses on the system. Returns the
number of changes since previous call to this function (total of new
busses and busses removed).
---

JB.

-- 
Julien BLACHE                                   <http://www.jblache.org> 
<jb@jblache.org>                                  GPG KeyID 0xF5D65169


--=-=-=
Content-Disposition: attachment; filename=sm3600_usb.diff
Content-Description: sane_init libusb patch

Index: backend/sm3600.c
===================================================================
RCS file: /cvsroot/sane/sane-backends/backend/sm3600.c,v
retrieving revision 1.12
diff -u -r1.12 sm3600.c
--- backend/sm3600.c	15 Apr 2004 19:56:53 -0000	1.12
+++ backend/sm3600.c	30 Apr 2005 12:13:02 -0000
@@ -374,11 +374,12 @@
   pdevFirst=NULL;
 
   usb_init();
-  rc=usb_find_busses();
-  if (rc)
-    return SANE_STATUS_GOOD;
+  usb_find_busses();
+  if (!usb_busses)
+    return SANE_STATUS_IO_ERROR;
+
   usb_find_devices();
-  if (!usb_busses) return SANE_STATUS_IO_ERROR;
+
   iBus=0;
   DBG(DEBUG_INFO,"starting bus scan\n");
   for (pbus = usb_busses; pbus; pbus = pbus->next)

--=-=-=--