Hi Julien,

The problem lies in libusb, it increased its block size from 4k to 16k
to improve performance of USB 2 in 0.1.10 and this broke libgphoto2[1],
so I got to learn about that stuff and tilted when Jerome told me
about his problem.

Also, I talked with Aurelien Jarno before I had a patch for libgphoto2
and he agreed to upload libusb 0.1.10 with 4k blocks to t-p-u, he did
it but I told release managers it was no longer necessary.

Well, please find the patch attached, it is based on the one used in
libgphoto2.


See you,

        Frederic

[1] #301945 and #308290.
diff -Naur sane-backends-1.0.15-orig/debian/patches/00list 
sane-backends-1.0.15-new/debian/patches/00list
--- sane-backends-1.0.15-orig/debian/patches/00list     2005-05-23 
20:20:54.000000000 +0200
+++ sane-backends-1.0.15-new/debian/patches/00list      2005-05-23 
20:20:36.000000000 +0200
@@ -17,3 +17,4 @@
 36_sane-find-scanner_message
 37_epson_usbids
 38_artec_e+48_conf
+39_libusb_0.1.10a
diff -Naur sane-backends-1.0.15-orig/debian/patches/39_libusb_0.1.10a.dpatch 
sane-backends-1.0.15-new/debian/patches/39_libusb_0.1.10a.dpatch
--- sane-backends-1.0.15-orig/debian/patches/39_libusb_0.1.10a.dpatch   
1970-01-01 01:00:00.000000000 +0100
+++ sane-backends-1.0.15-new/debian/patches/39_libusb_0.1.10a.dpatch    
2005-05-23 20:20:11.000000000 +0200
@@ -0,0 +1,82 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 39_libusb_0.1.10a.dpatch by  <[EMAIL PROTECTED]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
[EMAIL PROTECTED]@
+diff -urNad sane-backends-1.0.15/sanei/sanei_usb.c 
/tmp/dpep.0SqSn1/sane-backends-1.0.15/sanei/sanei_usb.c
+--- sane-backends-1.0.15/sanei/sanei_usb.c     2004-10-03 16:18:17.000000000 
+0200
++++ /tmp/dpep.0SqSn1/sane-backends-1.0.15/sanei/sanei_usb.c    2005-05-23 
20:19:30.000000000 +0200
+@@ -822,9 +822,32 @@
+ #ifdef HAVE_LIBUSB
+     {
+       if (devices[dn].bulk_in_ep)
+-      read_size = usb_bulk_read (devices[dn].libusb_handle,
+-                                 devices[dn].bulk_in_ep, (char *) buffer,
+-                                 (int) *size, libusb_timeout);
++        {
++          int nsize = *size, curread = 0, toread, result;
++          while (curread < nsize) {
++            toread = nsize - curread;
++            if (toread > 4096)
++              toread = 4096;
++          result = usb_bulk_read (devices[dn].libusb_handle,
++                                 devices[dn].bulk_in_ep, (char *) buffer + 
curread,
++                                 toread, libusb_timeout);
++            if (result == 0) {
++            result = usb_bulk_read (devices[dn].libusb_handle,
++                                 devices[dn].bulk_in_ep, (char *) buffer + 
curread,
++                                 toread, libusb_timeout);
++              if (result < 0) break;
++            }
++            if (result < 0) break;
++            curread += result;
++            if (result < toread)
++              break;
++          }
++          if (result > 0) {
++            read_size = curread;
++          } else {
++            read_size = -1;
++          }
++        }
+       else
+       {
+         DBG (1, "sanei_usb_read_bulk: can't read without a bulk-in "
+@@ -1036,9 +1059,32 @@
+ #ifdef HAVE_LIBUSB
+     {
+       if (devices[dn].int_in_ep)
+-      read_size = usb_bulk_read (devices[dn].libusb_handle,
+-                                 devices[dn].int_in_ep, (char *) buffer,
+-                                 (int) *size, libusb_timeout);
++        {
++          int nsize = *size, curread = 0, toread, result;
++          while (curread < nsize) {
++            toread = nsize - curread;
++            if (toread > 4096)
++              toread = 4096;
++          result = usb_bulk_read (devices[dn].libusb_handle,
++                                 devices[dn].int_in_ep, (char *) buffer + 
curread,
++                                 toread, libusb_timeout);
++            if (result == 0) {
++            result = usb_bulk_read (devices[dn].libusb_handle,
++                                 devices[dn].int_in_ep, (char *) buffer + 
curread,
++                                 toread, libusb_timeout);
++              if (result < 0) break;
++            }
++            if (result < 0) break;
++            curread += result;
++            if (result < toread)
++              break;
++          }
++          if (result > 0) {
++            read_size = curread;
++          } else {
++            read_size = -1;
++          }
++        }
+       else
+       {
+         DBG (1, "sanei_usb_read_int: can't read without an int "

Reply via email to