mirror of
https://github.com/openwrt/packages.git
synced 2025-02-07 06:59:51 +00:00
- Migrate libusb dependency back to libsane (virtually all useful backends for OpenWrt would need it anyway) - Disabled new usb-record-replay feature (avoid libxml2 dep) - Disabled new escl backend (network-only backend are not too useful for OpenWrt and it requires libcurl, libnetsnmp, libavahi and libxml2) - Workaround sane-daemon/postinst installation on Imagebuild - Enabled backends kvs40xx and mustek_usb2 (fixed upstream) - Fix bigendian compilation (https://gitlab.com/sane-project/backends/-/merge_requests/329) - Fix missing std::round() for uclibc (https://gitlab.com/sane-project/backends/issues/237) - Fixes FS#2685: coldplug was running before usblp was loaded. Now it grants access do usblp when a device using it is plugged. Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
29 lines
836 B
Bash
Executable File
29 lines
836 B
Bash
Executable File
#!/bin/sh
|
|
|
|
[ "$ACTION" != "remove" ] || exit 0
|
|
|
|
SANE_GROUP=scanner
|
|
grep -q -E "^$SANE_GROUP:" /etc/group || exit 0
|
|
|
|
grant() {
|
|
echo "hotplug(usb/20-saned): Granting $1 to '$2' for group '$SANE_GROUP'" >/dev/kmsg
|
|
chgrp "$SANE_GROUP" "$2"
|
|
chmod "$1" "$2"
|
|
}
|
|
|
|
usblp_bind="/sys/bus/usb/drivers/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
|
|
|