2005-02-21 21:00:57 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# This file is part of the SANE distribution.
|
|
|
|
# Hotplug USB hook for SANE
|
|
|
|
|
|
|
|
if [ "$ACTION" != "add" ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
DEVVID=$(printf %4s $(echo $PRODUCT | cut -d'/' -f1) | tr ' ' 0)
|
|
|
|
DEVPID=$(printf %4s $(echo $PRODUCT | cut -d'/' -f2) | tr ' ' 0)
|
|
|
|
|
2005-02-28 12:51:56 +00:00
|
|
|
DEVCONF=$(grep -i ^0x$DEVVID[[:space:]]0x$DEVPID /etc/sane.d/hotplug/*.db 2> /dev/null)
|
2005-02-21 21:00:57 +00:00
|
|
|
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
set $DEVCONF
|
|
|
|
|
|
|
|
chown $3 $DEVICE && chmod $4 $DEVICE
|
|
|
|
|
|
|
|
if [ ! -z $5 -a -x $5 ]; then
|
|
|
|
export DEVVID
|
|
|
|
export DEVPID
|
|
|
|
exec $5
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|