[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-usb
Subject:    Re: Unmount USB device, then power down port. Does it work?
From:       "Simos Xenitellis" <simos.lists () googlemail ! com>
Date:       2008-03-06 19:39:22
Message-ID: 598e9210803061139o56751dbdue09ea10f80459796 () mail ! gmail ! com
[Download RAW message or body]

On Wed, Mar 5, 2008 at 6:55 PM, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Wed, 5 Mar 2008, Simos Xenitellis wrote:
>
>
> > > What are you trying to accomplish?  Is there some special reason you
>  > > want to power down the port?  What's wrong with leaving the port
>  > > powered?
>  > >
>  > It is for usability purposes; the user associates that in order to
>  > disconnect a device, they need to perform the disconnect operation. This
>  > disconnect operation has the visual(LED light)/sound(no more disk
>  > spinning) effect of powering down the device.
>
>  What you call a "disconnect operation" is really a port disable or a
>  port suspend.  It is not a port power-down.

Thanks for the clarification.

>  > > Do you realize that if a port is unpowered, the computer won't be able
>  > > to detect when you plug a new USB device into that port?
>  > >
>  > My understanding is that once you power-off a USB port, the port is
>  > unpowered. Until you disconnect that device and connect a new one. At
>  > that point the port is powered back again. Are there any gotchas in this?
>
>  Of course!  How does the computer know when to power the port back up
>  again?  If the port has no power, it can't detect when a new device is
>  connected.
>
>  With port disable or port suspend, this isn't a problem.

There are two options then.

>
>  > >> BTW, the wrong approach that I was thinking earlier was to send
>  > >> something like "sdparm --command=stop /dev/sdb". Apparently, not that
>  > >> many USB hubs pass this information to the disks.
>  > >>
>  > >
>  > > That's not right; hubs will pass commands straight through to the
>  > > device.  However stopping a disk is very different from powering-down
>  > > a port.
>  > >
>  > I see. I am not sure if the inability to send the STOP command is due to
>  > the type of disk enclosures I tested.
>
>  Could be.
>
>
>  > I suspect that the only way to park safely the heads of an external hard
>  > disk is by sending the the STOP command. Does powering down the port
>  > have the effect of parking the disk heads?
>
>  The two operations are completely separate; one doesn't have anything
>  to do with the other.
>
>  Currently there's no easy way to disable a port in a user program.  But
>  it is easy to suspend a port, provided your kernel was built with
>  CONFIG_USB_SUSPEND enabled.  All you have to do is:
>
>         echo suspend >/sys/bus/usb/devices/.../power/level
>
>  where you fill in the "..." with the pathname for the device you want
>  to suspend.

Typical distributions have this enabled in the kernel (such as Ubuntu).
This looks to be the way forward.

It might be an issue if other OSes have different interfaces for this.

Cheers,
Simos
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic