salut,
dans le script hotplug verifie la precence de la variable $DEVICE lors de son lancement, mais celle ci n'est pas toujours donne. De plus comme elle ne sert a rien dans le script : UNPLUGSCRIPT=$REMOVER (pas la peine de refaire le boulot d'hotplug[1]) il suffit de remplacer le debut du script
# this script can only be called by hotplug (giving the $DEVICE param)
if [ -z $DEVICE ] ; then
       echo -e "$NO_PARAM_MSG"
       exit
fi

LAST_CHARS="${DEVPATH:`expr ${#DEVPATH} - 3`}"
if [ -z "$LAST_CHARS" ] || [ "x$LAST_CHARS" = "x1.0" ] ; then
       # script called when the modem will be unplugged
       mkdir -p /var/run/usb
       UNPLUGSCRIPT="/var/run/usb/`echo $DEVICE | sed 's/\//%/g'`"
       echo "#!/bin/bash" > $UNPLUGSCRIPT
       echo "${SBIN_DIR}/fctStopAdsl" >> $UNPLUGSCRIPT
       echo "rmmod eagle-usb" >> $UNPLUGSCRIPT
       echo "rm -f ${UNPLUGSCRIPT}" >> $UNPLUGSCRIPT
       chmod u+x $UNPLUGSCRIPT

par


# this script can only be called by hotplug (giving the $DEVPATH param)
if [ -z $DEVPATH ] ; then
       echo -e "$NO_PARAM_MSG"
       exit
fi

LAST_CHARS="${DEVPATH:`expr ${#DEVPATH} - 3`}"
if [ -z "$LAST_CHARS" ] || [ "x$LAST_CHARS" = "x1.0" ] ; then
       # script called when the modem will be unplugged
       mkdir -p /var/run/usb
       echo "#!/bin/bash" > $REMOVER
       echo "${SBIN_DIR}/fctStopAdsl" >> $REMOVER
       echo "rmmod eagle-usb" >> $REMOVER
       chmod u+x $REMOVER

On notera que le rmmod eagle-usb n'est pas tres sympa dans le cas de plusieurs modems...
Le rm du script est fait aussi par hotplug...


[1]
if [ "$DEVICE" = "" ]; then
 REMOVER=/var/run/usb/`echo "$INTERFACE/$PRODUCT/$TYPE" | sed -e 's;/;%;g'`
else
 REMOVER=/var/run/usb/`echo $DEVICE | sed -e 's;/;%;g'`
fi
export REMOVER

Reply via email to