sane-backends: run (xinetd) saned as non-root

saned requires write access scanner USB bus for its process and
to usblp/bind in order to rebind multifunctional printers back
to usblp (for printing with p910nd).

A hotplug script monitor new USB devices for scanners. Scanners
are detected by searching /usr/share/sane/<vendor>-<backend>.usbid
for the device product_id.

The package saned creates user saned:scanners. Access is granted to
group scanners.

The default xinetd conf was updated to run as saned:scanner.

sane-daemon pkg now has a postinst trigger that runs udevtrigger for
granting perms where there are connected scanners during installation.

Existing hotplug scripts from hplip were removed. They were mostly
useless.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
This commit is contained in:
Luiz Angelo Daros de Luca
2019-06-01 03:30:23 -03:00
parent 9c901e1bd1
commit 794c950b32
5 changed files with 73 additions and 35 deletions
+12 -4
View File
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=hplip
PKG_VERSION:=3.19.12
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/hplip
@@ -74,6 +74,13 @@ CONFIGURE_ARGS += \
--disable-cups-drv-install \
--enable-lite-build
define Build/Install
mkdir -p $(PKG_INSTALL_DIR)/usr/share/sane
sed -n -e '/key="usb.product_id"/{s/.*int_outof="0x//;s/;0x/\n/g;s/".*//;p}' \
$(PKG_BUILD_DIR)/data/rules/20-hplip-devices.fdi | sort -u > \
$(PKG_INSTALL_DIR)/usr/share/sane/03f0-hplip.usbid
endef
define Package/hplip-common/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_BUILD_DIR)/.libs/libhpip.so* $(1)/usr/lib/
@@ -84,9 +91,6 @@ define Package/hplip-common/install
$(INSTALL_DIR) $(1)/usr/share/hplip/data/models/
$(CP) $(PKG_BUILD_DIR)/data/models/models.dat $(1)/usr/share/hplip/data/models/
$(INSTALL_DIR) $(1)/etc/hotplug.d/usb/
$(INSTALL_BIN) ./files/20-hplip $(1)/etc/hotplug.d/usb/
endef
define Package/hplip-sane/install
@@ -95,6 +99,10 @@ define Package/hplip-sane/install
$(INSTALL_DIR) $(1)/etc/sane.d/dll.d/
$(INSTALL_DATA) ./files/hplib.conf $(1)/etc/sane.d/dll.d/hplib
$(INSTALL_DIR) $(1)/usr/share/sane
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/sane/03f0-hplip.usbid \
$(1)/usr/share/sane/03f0-hplip.usbid
endef
define Package/hplip-common/conffiles
-20
View File
@@ -1,20 +0,0 @@
#!/bin/sh
# Copyright (C) 2009 OpenWrt.org
case "$ACTION" in
add)
# You have to figure out your PRODUCT id. Uncomment the line below,
# attach and detach your HP USB printer to find your id in /tmp/hplip.test.
# It will look like "Found 3f0/1717/100 on /proc/bus/usb/002/009"
# Replace 3f0/1717/100 below with your id.
#
# echo "Found $PRODUCT on $DEVICE" > /tmp/hplip.test
[ "$PRODUCT" = "3f0/1717/100" ] && chown nobody $DEVICE && chmod 666 $DEVICE
;;
remove)
# device is gone
;;
esac