On Wed, 31 Jan 2007, Joe Wells wrote:

> Thanks very much for your advice, Alan!
> 
> Alan Stern <[EMAIL PROTECTED]> writes:
> 
> > On Wed, 31 Jan 2007, Joe Wells wrote:
> >
> >> I want to simulate the effect of unplugging a USB device and
> >> plugging it back in without having to physically unplug it.  Is it
> >> possible to "unplug" a USB device by software actions alone?  If
> >> so, could someone please tell me how?
> >
> > It depends on exactly what you want to simulate.
> 
> I have a piece of hardware that works reliably when I unplug it from
> the USB port and remove associated kernel modules between every two
> openings of the device file.  It works unreliably when I don't follow
> this procedure.  (Yes, obviously something is buggy, but which piece
> of hardware or software has the bug is unclear and I have a procedure
> that works.)

Okay... but finding and fixing the bug might let you use a much simpler 
procedure.

> > For example, unplugging a USB device will interrupt the +5 V power
> > it receives from the bus.  With most PC systems, the USB hardware
> > does not permit you to do this in software.
> 
> How would I find out if I can turn off the power to the USB port in
> software?  If it could be done on a particular computer, which
> software actions would do it?

I was speaking conservatively.  As far as I know, _no_ personal computer
systems allow you to turn off the power to the USB bus, without shutting
down the entire computer.  Some brands of USB hub do allow it; see the 
description on this web page:

        http://www.gniibe.org/ac-power-by-usb/ac-power-control.html

> > Other aspects of replugging (in particular, the device reset it
> > causes) can indeed be carried out in software.
> >
> >> In case it matters, I am only using one USB device, so resetting
> >> the entire USB subsystem would not be a problem for me.
> >
> > In that case it would be enough to unload the USB controller driver
> > and then load it back.  For instance, "rmmod ohci-hcd ; modprobe
> > ohci-hcd".  The actual driver to use will depend on your system and
> > on the USB device in question; check the system log to find out.
> 
> If I run "lsmod | egrep 'hci|usb'", I get this output:
> 
>   usbserial              29992  2 keyspan_pda,keyspan
>   hsfusbcd2              59352  0
>   hsfserial              21444  6 
> hsfusbcd2,hsfmc97sis,hsfmc97ati,hsfmc97ali,hsfmc97via,hsfpcibasic2
>   hsfengine            1312916  7 
> hsfusbcd2,hsfmc97sis,hsfmc97ati,hsfmc97ali,hsfmc97via,hsfpcibasic2,hsfserial
>   hsfosspec              88680  8 
> hsfusbcd2,hsfmc97sis,hsfmc97ati,hsfmc97ali,hsfmc97via,hsfpcibasic2,hsfserial,hsfengine
>   hsfsoar                85704  6 
> hsfusbcd2,hsfmc97sis,hsfmc97ati,hsfmc97ali,hsfmc97via,hsfpcibasic2
>   hci_usb                14292  2
>   bluetooth              44068  7 rfcomm,l2cap,hci_usb
>   ohci1394               31856  0
>   ieee1394              299544  2 sbp2,ohci1394
>   ehci_hcd               30152  0
>   uhci_hcd               21260  0
>   usbcore               117312  9 
> keyspan_pda,keyspan,usbserial,hsfusbcd2,hsfosspec,hci_usb,ehci_hcd,uhci_hcd
> 
> Which of these modules should go?  I'm guessing that ohci1394 is my
> USB controller driver (see my lspci output quoted from previous
> message below), but it is not clear to me.

No, ohci1394 is a Firewire driver.  "Firewire" is Apple's name for the 
technology which is more generally available in the IEEE-1394 
specification.

>  Would I need also to
> remove usbcore?  (If I need to remove usbcore, then I would need to
> understand what all of the hsf* modules are doing, because they would
> need to be unloaded first.)  What about ehci_hcd and uhci_hcd?

You don't need to remove usbcore.  You do need to remove either or both of
ehci-hcd and uhci-hcd, depending on what bus speed your USB device runs 
at.

Alan Stern


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Linux-usb-users@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to