[clue-tech] USB drive unplugging.

David Anselmi anselmi at anselmi.us
Mon Apr 4 18:23:12 MDT 2005


How do I get the LED on my USB drive to go out before I unplug it 
(Debian Sarge, FWIW)?

I used to plug in the drive and then run a script to load modules and 
mount the drive.  Then that script would unmount the drive and remove 
all the modules.  When I went to unplug the drive the LED was off, 
cluing me that it was safe.

Now I've upgraded to a 2.6 kernel[1] and udev[2].  That's cool because 
now the drive doesn't change device nodes just by replugging it.  And I 
know how to get a consistent name even if I start plugging in other 
things that might take the node it usually gets.  But since the USB 
driver stuff "just works" now it seems silly to load/unload modules by hand.

I notice that the stack looks like this:

usb_storage
uhci_hcd
usbcore

and removing the uhci_hcd module is the one that makes the light go off. 
  I suppose that if I had other stuff plugged in I wouldn't want to 
remove that module.

Dave



More information about the clue-tech mailing list