From 011d0f9bacab126fb2ae09d29abdd6eb88f1333d Mon Sep 17 00:00:00 2001 From: Brandon Beck Date: Fri, 13 Mar 2020 19:26:54 -0500 Subject: [PATCH 1/2] Fix build on macOS. --- backend/pixma/pixma_bjnp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/pixma/pixma_bjnp.c b/backend/pixma/pixma_bjnp.c index 34ba918f2..fd41d5e96 100644 --- a/backend/pixma/pixma_bjnp.c +++ b/backend/pixma/pixma_bjnp.c @@ -109,6 +109,13 @@ #ifndef SSIZE_MAX # define SSIZE_MAX LONG_MAX #endif +#ifndef HOST_NAME_MAX +# ifdef _POSIX_HOST_NAME_MAX +# define HOST_NAME_MAX _POSIX_HOST_NAME_MAX +# else +# define HOST_NAME_MAX 255 +# endif +#endif /* static data */ static bjnp_device_t device[BJNP_NO_DEVICES]; From c88ba0dff246b19a817a35c88c2a62bf8524de3f Mon Sep 17 00:00:00 2001 From: Brandon Beck Date: Fri, 13 Mar 2020 17:54:51 -0500 Subject: [PATCH 2/2] Allow unconfigured USB scanners on macOS. Based on findings from Oliver Schwartz (https://alioth-lists.debian.net/pipermail/sane-devel/2012-June/029890.html) this change allows USB scanners to be unconfigured on macOS. This fixes the issue of scanners being unable to be discovered because they look to be not configured but end up getting configured later. --- sanei/sanei_usb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sanei/sanei_usb.c b/sanei/sanei_usb.c index db0f452ae..4bc0725e3 100644 --- a/sanei/sanei_usb.c +++ b/sanei/sanei_usb.c @@ -1848,6 +1848,11 @@ static void libusb_scan_devices(void) continue; } +/* macOS won't configure several USB scanners (i.e. ScanSnap 300M) because their + * descriptors are vendor specific. As a result the device will get configured + * later during sanei_usb_open making it safe to ignore the configuration check + * here on these platforms. */ +#if !defined(__APPLE__) if (config == 0) { DBG (1, @@ -1855,6 +1860,7 @@ static void libusb_scan_devices(void) vid, pid, busno, address); continue; } +#endif ret = libusb_get_config_descriptor (dev, 0, &config0); if (ret < 0) @@ -2574,11 +2580,17 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn) return SANE_STATUS_INVAL; } +/* macOS won't configure several USB scanners (i.e. ScanSnap 300M) because their + * descriptors are vendor specific. As a result the device will get configured + * later during sanei_usb_open making it safe to ignore the configuration check + * here on these platforms. */ +#if !defined(__APPLE__) if (config == 0) { DBG (1, "sanei_usb_open: device `%s' not configured?\n", devname); return SANE_STATUS_INVAL; } +#endif result = libusb_get_device_descriptor (dev, &desc); if (result < 0)