Merge pull request #8851 from luizluca/sane-usblp
sane-backends: rebind printers to usblp after scan
This commit is contained in:
commit
e2d5f0b8ff
3 changed files with 30 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2006-2016 OpenWrt.org
|
# Copyright (C) 2006-2016 OpenWrt.org
|
||||||
# Copyright (C) 2017-2018 Luiz Angelo Daros de Luca <luizluca@gmail.com>
|
# Copyright (C) 2017-2019 Luiz Angelo Daros de Luca <luizluca@gmail.com>
|
||||||
#
|
#
|
||||||
# This is free software, licensed under the GNU General Public License v2.
|
# This is free software, licensed under the GNU General Public License v2.
|
||||||
# See /LICENSE for more information.
|
# See /LICENSE for more information.
|
||||||
|
@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=sane-backends
|
PKG_NAME:=sane-backends
|
||||||
PKG_VERSION:=1.0.27
|
PKG_VERSION:=1.0.27
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=http://fossies.org/linux/misc \
|
PKG_SOURCE_URL:=http://fossies.org/linux/misc \
|
||||||
https://alioth.debian.org/frs/download.php/file/4146/
|
https://alioth.debian.org/frs/download.php/file/4146/
|
||||||
|
@ -193,9 +193,11 @@ define Package/sane-daemon/install
|
||||||
$(INSTALL_DIR) $(1)/etc/sane.d
|
$(INSTALL_DIR) $(1)/etc/sane.d
|
||||||
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/saned.conf $(1)/etc/sane.d/
|
$(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/sane.d/saned.conf $(1)/etc/sane.d/
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
|
$(INSTALL_BIN) ./files/usr/sbin/saned $(1)/usr/sbin/saned
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/sane/
|
||||||
|
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/saned $(1)/usr/lib/sane/saned
|
||||||
$(INSTALL_DIR) $(1)/etc/xinetd.d
|
$(INSTALL_DIR) $(1)/etc/xinetd.d
|
||||||
$(CP) ./files/xinet.d_sane-port $(1)/etc/xinetd.d/sane-port
|
$(CP) ./files/etc/xinetd.d/sane-port $(1)/etc/xinetd.d/sane-port
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/sane-daemon/conffiles
|
define Package/sane-daemon/conffiles
|
||||||
|
|
24
utils/sane-backends/files/usr/sbin/saned
Executable file
24
utils/sane-backends/files/usr/sbin/saned
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
usblp_driver="/sys/bus/usb/drivers/usblp"
|
||||||
|
|
||||||
|
inuse=""
|
||||||
|
if [ -e /sys/bus/usb/devices ]; then
|
||||||
|
for usbdev_driver in /sys/bus/usb/devices/*/driver; do
|
||||||
|
[ -e "$usbdev_driver" ] || continue
|
||||||
|
[ "$(readlink -f "$usbdev_driver")" = "$usblp_driver" ] || continue
|
||||||
|
usbdev="${usbdev_driver%/*}"
|
||||||
|
inuse="$inuse ${usbdev##*/}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
/usr/lib/sane/saned "$@"
|
||||||
|
err=$?
|
||||||
|
|
||||||
|
for usbdev in $inuse; do
|
||||||
|
[ -e "/sys/bus/usb/devices/$usbdev/driver" ] && continue
|
||||||
|
logger -t saned "binding device $usbdev back to usblp..."
|
||||||
|
printf '%s' "$usbdev" > "$usblp_driver/bind"
|
||||||
|
done
|
||||||
|
|
||||||
|
exit $err
|
Loading…
Reference in a new issue