diff --git a/utils/sane-backends/Makefile b/utils/sane-backends/Makefile index 8b547ad1dd..8f0a03a0db 100644 --- a/utils/sane-backends/Makefile +++ b/utils/sane-backends/Makefile @@ -1,6 +1,6 @@ # # Copyright (C) 2006-2016 OpenWrt.org -# Copyright (C) 2017-2019 Luiz Angelo Daros de Luca +# Copyright (C) 2017-2020 Luiz Angelo Daros de Luca # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -9,11 +9,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=sane-backends -PKG_VERSION:=1.0.28 -PKG_RELEASE:=2 +PKG_VERSION:=1.0.29 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://gitlab.com/sane-project/backends/uploads/9e718daff347826f4cfe21126c8d5091/ -PKG_HASH:=31260f3f72d82ac1661c62c5a4468410b89fb2b4a811dabbfcc0350c1346de03 +PKG_SOURCE_URL:=https://gitlab.com/sane-project/backends/uploads/54f858b20a364fc35d820df935a86478 +PKG_HASH:=aa027b4e5f59849cd41b8c26d54584cf31fffd986049019be6ad4140e11ea8ed PKG_MAINTAINER:=Luiz Angelo Daros de Luca PKG_LICENSE:=GPL-2.0 GPL-2.0-or-later PKG_LICENSE_FILES:=COPYING LICENSE @@ -136,13 +136,19 @@ endef # Run hotplug to grant access to existing scanners define Package/sane-daemon/postinst #!/bin/sh -udevtrigger +# We only need udevtrigger to have the magic work without +# rebooting on a real system. In ImageBuilder or +# the like, the boot process will call udevtrigger. +if [ -z "$${IPKG_INSTROOT}" ]; then + udevtrigger +fi endef define Package/libsane $(call Package/sane-backends/Default) SECTION:=libs CATEGORY:=Libraries + DEPENDS+=+libusb-1.0 TITLE+= (libraries) endef @@ -171,6 +177,7 @@ CONFIGURE_ARGS+= \ --without-snmp \ --disable-avahi \ --disable-locking \ + --without-usb-record-replay \ # ./configure does not even try to detect mmap if crosscompiling CONFIGURE_VARS+= \ @@ -314,6 +321,7 @@ $(eval $(call SaneBackend,epjitsu,Epson-based Fujitsu USB scanners,+libusb-1.0)) $(eval $(call SaneBackend,epson,EPSON scanners,+libusb-1.0)) $(eval $(call SaneBackend,epsonds,EPSON scanners,+libjpeg +libusb-1.0)) #### $(eval $(call SaneBackend,epson2,EPSON scanners,+libusb-1.0)) +#$(eval $(call SaneBackend,escl,AirScan/eSCL devices,+libcurl +libxml2 +libnetsnmp +libavahi)) $(eval $(call SaneBackend,fujitsu,Fujitsu flatbed and ADF scanners,+libusb-1.0)) $(eval $(call SaneBackend,genesys,GL646 GL841 GL843 GL847 and GL124 based USB flatbed scanners,+libstdcpp +libusb-1.0)) $(eval $(call SaneBackend,gphoto2,digital cameras supported by gphoto2,+libjpeg +libgphoto2)) @@ -333,8 +341,7 @@ $(eval $(call SaneBackend,kodak,big Kodak flatbed and ADF scanners,+libusb-1.0)) $(eval $(call SaneBackend,kodakaio,Kodak aio printer / scanners,+libusb-1.0)) $(eval $(call SaneBackend,kvs1025,Panasonic KV-S102xC USB ADF scanners,+libusb-1.0)) $(eval $(call SaneBackend,kvs20xx,Panasonic KV-S20xxC USB/SCSI ADF scanners,+libusb-1.0)) -# https://gitlab.com/sane-project/backends/issues/153 -#$(eval $(call SaneBackend,kvs40xx,Panasonic KV-S40xxC USB/SCSI ADF scanners,+libpthread +libusb-1.0)) +$(eval $(call SaneBackend,kvs40xx,Panasonic KV-S40xxC USB/SCSI ADF scanners,+libpthread +libusb-1.0)) $(eval $(call SaneBackend,leo,LEO Technologies scanners)) $(eval $(call SaneBackend,lexmark,Lexmark X1100/X1200 Series scanners,+libusb-1.0)) $(eval $(call SaneBackend,ma1509,Mustek BearPaw 1200F USB scanner,+libusb-1.0)) @@ -346,8 +353,7 @@ $(eval $(call SaneBackend,mustek,Mustek SCSI flatbed scanners and some other dev # Depends on libieee1284 #$(eval $(call SaneBackend,mustek_pp,Mustek parallel port flatbed scanners,+libieee1284)) $(eval $(call SaneBackend,mustek_usb,Mustek USB flatbed scanners,+libusb-1.0)) -# https://gitlab.com/sane-project/backends/issues/153 -#$(eval $(call SaneBackend,mustek_usb2,SQ113 based USB flatbed scanners,+libpthread +libusb-1.0)) +$(eval $(call SaneBackend,mustek_usb2,SQ113 based USB flatbed scanners,+libpthread +libusb-1.0)) $(eval $(call SaneBackend,nec,NEC scanners)) $(eval $(call SaneBackend,net,network backend)) $(eval $(call SaneBackend,niash,scanners based on the NIASH chipset,+libusb-1.0)) diff --git a/utils/sane-backends/files/saned.hotplug b/utils/sane-backends/files/saned.hotplug index 42d35ad961..470cf4ffe2 100755 --- a/utils/sane-backends/files/saned.hotplug +++ b/utils/sane-backends/files/saned.hotplug @@ -1,27 +1,28 @@ #!/bin/sh -[ "$ACTION" = "add" ] || exit 0 -[ "$DEVTYPE" = "usb_device" ] || exit 0 +[ "$ACTION" != "remove" ] || exit 0 SANE_GROUP=scanner grep -q -E "^$SANE_GROUP:" /etc/group || exit 0 -# Filter SANE known devices -vendor_product="${PRODUCT%/*}" -vendorid="$(printf '%04x' "0x0${vendor_product%/*}")" -productid="$(printf '%04x' "0x0${vendor_product#*/}")" -grep -s -x -F -q "$productid" "/usr/share/sane/$vendorid"-*.usbid || exit 0 - grant() { - logger -t "hotplug(usb/20-saned)" "Granting $1 to '$2' for group '$SANE_GROUP'" + echo "hotplug(usb/20-saned): Granting $1 to '$2' for group '$SANE_GROUP'" >/dev/kmsg chgrp "$SANE_GROUP" "$2" chmod "$1" "$2" } -# Needed by script /usr/bin/saned to rebind USB devices back to usblp after use usblp_bind="/sys/bus/usb/drivers/usblp/bind" -if [ -e "$usblp_bind" ]; then - grant g+w "$usblp_bind" +if [ "$DEVTYPE" = "usb_device" ]; then + # Filter SANE known devices + vendor_product="${PRODUCT%/*}" + vendorid="$(printf '%04x' "0x0${vendor_product%/*}")" + productid="$(printf '%04x' "0x0${vendor_product#*/}")" + grep -s -x -F -q "$productid" "/usr/share/sane/$vendorid"-*.usbid || exit 0 + grant g+rw "/dev/$DEVNAME" +elif [ "$DEVTYPE" = "usb_interface" ] && [ "$DRIVER" = 'usblp' ]; then + # Needed by script /usr/bin/saned to rebind USB devices back to usblp after use + if [ -e "$usblp_bind" ]; then + grant g+w "$usblp_bind" + fi fi -grant g+rw "/dev/$DEVNAME" diff --git a/utils/sane-backends/patches/002-remove-uneeded.patch b/utils/sane-backends/patches/002-remove-uneeded.patch index 0a8f2a883d..5613e732e0 100644 --- a/utils/sane-backends/patches/002-remove-uneeded.patch +++ b/utils/sane-backends/patches/002-remove-uneeded.patch @@ -1,11 +1,11 @@ --- a/Makefile.in +++ b/Makefile.in -@@ -442,7 +442,7 @@ target_alias = @target_alias@ +@@ -448,7 +448,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = include lib sanei backend frontend tools doc po testsuite +SUBDIRS = include lib sanei backend frontend DIST_SUBDIRS = include lib sanei backend frontend tools doc po japi testsuite - dist_doc_DATA = AUTHORS ChangeLog COPYING LICENSE NEWS PROBLEMS PROJECTS \ - README README.aix README.beos README.darwin README.djpeg README.freebsd \ + dist_doc_DATA = AUTHORS COPYING LICENSE NEWS PROBLEMS PROJECTS README \ + README.aix README.beos README.darwin README.djpeg \ diff --git a/utils/sane-backends/patches/100-fix-bigendian.patch b/utils/sane-backends/patches/100-fix-bigendian.patch new file mode 100644 index 0000000000..6363d143f4 --- /dev/null +++ b/utils/sane-backends/patches/100-fix-bigendian.patch @@ -0,0 +1,21 @@ +From e1934720c687ed8c6125c75ac658f55b4e1513ce Mon Sep 17 00:00:00 2001 +From: Luiz Angelo Daros de Luca +Date: Sun, 2 Feb 2020 21:19:15 -0300 +Subject: [PATCH] genesys: fix bigendian build + +Signed-off-by: Luiz Angelo Daros de Luca +--- + backend/genesys/low.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/backend/genesys/low.cpp ++++ b/backend/genesys/low.cpp +@@ -539,7 +539,7 @@ Image read_unshuffled_image_from_scanner + } + + #ifdef WORDS_BIGENDIAN +- if (depth == 16) { ++ if (session.params.depth == 16) { + dev->pipeline.push_node(); + } + #endif diff --git a/utils/sane-backends/patches/101-fix_uclibc_std_rand.patch b/utils/sane-backends/patches/101-fix_uclibc_std_rand.patch new file mode 100644 index 0000000000..89594d43fa --- /dev/null +++ b/utils/sane-backends/patches/101-fix_uclibc_std_rand.patch @@ -0,0 +1,16 @@ +https://gitlab.com/sane-project/backends/issues/237 + +--- a/backend/genesys/image_pipeline.cpp ++++ b/backend/genesys/image_pipeline.cpp +@@ -703,7 +703,11 @@ bool ImagePipelineNodeCalibrate::get_nex + + float value_f = static_cast(value) / max_value; + value_f = (value_f - offset_[curr_calib_i]) * multiplier_[curr_calib_i]; ++#if defined(__UCLIBC__) ++ value_f = round(value_f * max_value); ++#else + value_f = std::round(value_f * max_value); ++#endif + value = clamp(static_cast(value_f), 0, max_value); + set_raw_channel_to_row(out_data, x, ch, value, format); +