Umberto,

> I would like to try this patch, how can I do?

You can add the patch to the homebrew formula (see the attached file). To do 
this, either use
brew edit sane-backends
or replace the file directly 
(/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/sane-backends.rb).

You need to install Xcode from the Apple app store to compile from source.

The compilation didn’t work for me out of the box because of a missing include 
file ‘jerror.h’. To fix this, I had to create another symlink:
cd /usr/local/include
ln -s ../Cellar/jpeg/9c/include/jerror.h

Then, run 
brew reinstall sane-backends -s


> Another thing: since the Mac recognize the USB Scanner already, would it be 
> possible to utilize the default macOS library for handling usb devices? So 
> configuring sane-backends with this instead of libusb. I’m just asking. I 
> tried searching something, I found old Apple Developer articles about it – 
> e.g. 
> https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/USBBook/USBIntro/USBIntro.html#//apple_ref/doc/uid/TP40002643-TPXREF101

There is not much benefit to gain - the beauty of libusb is that it provides a 
common interface to usb related tasks on every platform. The different 
behaviour concerning configuration of custom devices is not a libusb problem, 
it is just different behaviour of the underlying operation system. So 
circumventing libusb wouldn’t fix anything.

Kind regards,

Oliver

class SaneBackends < Formula
  desc "Backends for scanner access"
  homepage "http://www.sane-project.org/";
  url "https://mirrors.kernel.org/debian/pool/main/s/sane-backends/sane-backends_1.0.27.orig.tar.gz";
  mirror "https://fossies.org/linux/misc/sane-backends-1.0.27.tar.gz";
  sha256 "293747bf37275c424ebb2c833f8588601a60b2f9653945d5a3194875355e36c9"
  revision 5
  head "https://salsa.debian.org/debian/sane-backends.git";

  bottle do
    sha256 "19a5dd6aab043b2552e4ddb785c4f41c184019a7854e5bf28054ee809839a81f" => :mojave
    sha256 "7e17e4e13a6b9d4c532c3f4f498711c016c0c23331a25e9c4fe2543c1241bebf" => :high_sierra
    sha256 "c1c278d995f33f438ad6009ba4928157dd2ca74ec17a344a57b7af972c64e190" => :sierra
    sha256 "6073b7b25829eb031616894fe6ea5c34408fed9b42d3b421e6eba94d6cbbf948" => :el_capitan
  end

  depends_on "pkg-config" => :build
  depends_on "jpeg"
  depends_on "libpng"
  depends_on "libtiff"
  depends_on "libusb"
  depends_on "net-snmp"
  depends_on "openssl"

  patch :DATA
  def install
    system "./configure", "--disable-dependency-tracking",
                          "--prefix=#{prefix}",
                          "--localstatedir=#{var}",
                          "--without-gphoto2",
                          "--enable-local-backends",
                          "--with-usb=yes"

    # Remove for > 1.0.27
    # Workaround for bug in Makefile.am described here:
    # https://lists.alioth.debian.org/pipermail/sane-devel/2017-August/035576.html
    # It's already fixed in commit 519ff57.
    system "make"
    system "make", "install"
  end

  def post_install
    # Some drivers require a lockfile
    (var/"lock/sane").mkpath
  end

  test do
    assert_match prefix.to_s, shell_output("#{bin}/sane-config --prefix")
  end
end
__END__
diff --git a/sanei/sanei_usb.c b/sanei/sanei_usb.c
index e4b23dc..294c64b 100644
--- a/sanei/sanei_usb.c
+++ b/sanei/sanei_usb.c
@@ -936,7 +936,7 @@ static void libusb_scan_devices(void)
 	  DBG (1,
 	       "%s: device 0x%04x/0x%04x at %03d:%03d is not configured\n", __func__,
 	       vid, pid, busno, address);
-	  continue;
+	  /* continue; */
 	}

       ret = libusb_get_config_descriptor (dev, 0, &config0);
@@ -1640,7 +1640,7 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn)
       if (config == 0)
 	{
 	  DBG (1, "sanei_usb_open: device `%s' not configured?\n", devname);
-	  return SANE_STATUS_INVAL;
+	  /*return SANE_STATUS_INVAL; */
 	}

       result = libusb_get_device_descriptor (dev, &desc);
-- 
sane-devel mailing list: [email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
             to [email protected]

Reply via email to