Bug 99109 - Hotplug gets confused if module loading visor module
Summary: Hotplug gets confused if module loading visor module
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: hotplug
Version: 8.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-07-14 17:46 UTC by Edward Grace
Modified: 2014-03-17 02:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-02-04 20:52:35 UTC
Embargoed:


Attachments (Terms of Use)

Description Edward Grace 2003-07-14 17:46:11 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030701

Description of problem:
The hotplug facility is unreliable if a problem occurs loading a module, in this
case "visor".  If something goes wrong, "visor" and "usbserial" remain loaded
preventing reliable operation the next time a hotplug operation is attempted.

As it stands there is no /etc/hotplug/usb/visor script by default, so what
happens is the visor and usb serial modules are loaded when the hotsync button
is pressed.  When this operation is finished they are not unloaded.  This
casuses the procedure to break next time around.  Each time, the "device ID" is
incremented by 1.



Version-Release number of selected component (if applicable):
hotplug-2002_04_01-13 kdepim-3.0.5a-1 kernel-2.4.18-14 pilot-link-0.11.8-1

How reproducible:
Always

Steps to Reproduce:
1. From fresh reboot, as root.
2. Push hotsync button.
3. Run "pilot-xfer -p /dev/usb/ttyUSB1 -l"
4. Wait for process to finish.
5. Repeat steps 2. - 4.
    

Actual Results:  After the first time the hotsync button is pressed, the correct
modules are loaded and pilot-xfer works as expected.  Once the transfer has
completed however the modules are not unloaded. The second time around, the
pilot-xfer program is unable to correctly talk to the visor and the modules are
reloaded.

Expected Results:  The dump from pilot-xfer should not be sensitive to the
number of times the hotsync button is pressed.  The modules should cleanly
unload when they have served their purpose.



Additional info:

As a work around I created the following script as /etc/hotplug/usb/visor, based
on similar problems reported on the web.


----cut-------
#! /bin/sh
#
# Visor hotplug script.  Generates a remover script to make sure that the visor
and usbserial
# modules are unloaded when the visor is unplugged.
#
# Ed Grace.
PATH=/usr/sbin:$PATH
export PATH

logger -t visor-hotplug-script "Entering script $0 for (ACTION: ${ACTION})..."

# We start all the stuff

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
        logger -t visor-hotplug-script  "Inside my first if statement...."
        modprobe visor
        modprobe usbserial
        # create a remover script
        if [ "X$REMOVER" != "X" ]
        then
                logger -t visor-hotplug-script  "Generating remover script
($REMOVER)..."
                mkdir -p /var/run/usb

                echo '' > $REMOVER
                echo '#!/bin/sh' >> $REMOVER
                echo 'PATH=/usr/sbin:$PATH' >> $REMOVER
                echo 'export PATH' >> $REMOVER
                echo 'echo "Entering script $0 for (ACTION: ${ACTION})..."' >>
$REMOVER
                echo 'logger -t visor-remover-script "unloading visor and
usbserial modules..." ' >> $REMOVER
                echo 'rmmod visor' >> $REMOVER
                echo 'rmmod usbserial' >> $REMOVER
                chmod +x $REMOVER
                logger -t visor-hotplug-script "...finished generating remover
script"
        else
                logger  -t visor-hotplug-script-error "...in the remover else? 
Does this make sense?"
        fi
else
        logger  -t visor-hotplug-script-error "In the else for $0.  Does this
make sense?"
fi

logger  -t visor-hotplug-script "hotplug script finished..."

exit 0
---paste------

When everything is behaving itself this seems to cure the problem, with the
created remover script correctly unloading the modules on disconnect.  

HOWEVER! If there is _any_ untoward error in the transfer, the same problem
occurs, the modules either do not finish getting inserted or are not removed.  
There is then no way to remove them, /sbin/rmmod bugs out saying that the
"resource is busy".  

When this happens there seems to be no way of restoring normality other than
re-booting!

I have already tried upgrading the kernel, to no effect.

Comment 1 Bill Nottingham 2003-07-14 18:42:06 UTC
Why would the modules need to be unloaded?

Comment 2 Edward Grace 2003-07-14 19:09:04 UTC
Hi, thanks for the rapid response.... 
 
In principle they probably don't. In practice however it seems empiricaly 
necessary, as  
displayed by the supplied "ACTION=REMOVE" workaround script.    
  
If they are not unloaded, for some reason pilot-xfer is unable to sucessfully  
talk to the visor. Could this be due to the device id incrementing?  
  
Either way it's sliced or diced there seems to be something going wrong....  
  
-ed  
  

Comment 3 Bill Nottingham 2005-02-04 20:52:35 UTC
Closing out bugs on older, no longer supported, releases. Apologies
for any lack of response. Please reopen if problems persist on more
current releases.



Note You need to log in before you can comment on or make changes to this bug.