1141cc406Sopenharmony_ci#!/bin/sh 2141cc406Sopenharmony_ci# 3141cc406Sopenharmony_ci# This file is part of the SANE distribution. 4141cc406Sopenharmony_ci# Hotplug USB hook for SANE 5141cc406Sopenharmony_ci 6141cc406Sopenharmony_ciif [ "$ACTION" != "add" ]; then 7141cc406Sopenharmony_ci exit 0 8141cc406Sopenharmony_cifi 9141cc406Sopenharmony_ci 10141cc406Sopenharmony_ciDEVVID=$(printf %4s $(echo $PRODUCT | cut -d'/' -f1) | tr ' ' 0) 11141cc406Sopenharmony_ciDEVPID=$(printf %4s $(echo $PRODUCT | cut -d'/' -f2) | tr ' ' 0) 12141cc406Sopenharmony_ci 13141cc406Sopenharmony_ciDEVCONF=$(grep -i "^0x$DEVVID[[:space:]]\+0x$DEVPID" /etc/sane.d/hotplug/*.db 2> /dev/null) 14141cc406Sopenharmony_ci 15141cc406Sopenharmony_ciif [ $? != 0 ]; then 16141cc406Sopenharmony_ci exit 0 17141cc406Sopenharmony_cifi 18141cc406Sopenharmony_ci 19141cc406Sopenharmony_ciset $DEVCONF 20141cc406Sopenharmony_ci 21141cc406Sopenharmony_cichown $3 $DEVICE && chmod $4 $DEVICE 22141cc406Sopenharmony_ci 23141cc406Sopenharmony_ciif [ ! -z $5 -a -x $5 ]; then 24141cc406Sopenharmony_ci export DEVVID 25141cc406Sopenharmony_ci export DEVPID 26141cc406Sopenharmony_ci exec $5 27141cc406Sopenharmony_cifi 28141cc406Sopenharmony_ci 29141cc406Sopenharmony_ciexit 0 30