Subject: Re: soft control of +5V at a USB hub port?
To: J Chapman Flack <email@example.com>
From: Terry Moore <firstname.lastname@example.org>
Date: 05/04/2005 16:57:15
One additional twist.
You probably should try to determine whether the scanner is looking for USB
traffic or for Vbus. When traffic stops on a given port for more than 3
milliseconds, the device is obliged to recognize a USB "Suspend"
state. Unplugging from the upstream port will often be recognized by
hardware as a suspend (but actually, it's more complex than this, so
there's no guarantee). However, it would be reasonable for your scanner to
power down in case of a USB suspend.
On the other hand, unplugging the cable will cause Vbus not to be driven by
the host. Again, depending on the design of the device, this may be
detected by the device's hardware. And this might cause the power-down
Depending on the design of the hub, it can be possible to selectively power
down ports. This would be essentially the same as powering down. However,
not all hubs support this. Many "root hubs" (the ports on your PC) don't
support this at all.
To figure this out, you could sacrifice a USB cable to science -- cut the
green and white wires (D+/D-) but not the red and black wires (Vbus/GND)
and see whether the scanner powers up when you plug it into a hub port.
Referring to Lennart's email:
If the numerical feature definitions in <dev/usb/usb.h> match the spec,
then I think that UHF_PORT_ENABLE controls the port's traffic, not its
power. If you disable the port, the device downstream will see no traffic;
however, Vbus is supposed to remain unchanged.
UHF_PORT_POWER controls port power. By the way, when power is turned off,
the hub will reset the "PORT_CONNECTION" bit (220.127.116.11.1.1), which might
cause the stack to try to start disconnect processing. Clearing PORT_POWER
also clears the PORT_ENABLE bit for the port. As others mentioned,
clearing PORT_POWER does not necessarily actually turn off power downstream.
At 09:25 AM 5/4/2005 -0500, J Chapman Flack wrote:
>Here's something I've been wondering for a while:
>I have a USB scanner. It gets its power from an independent wall wart,
>and it has no power switch. It does go into a powered-down mode when
>the computer is off, though, and I can make it do that by unplugging the
>USB cable. Apparently the scanner, even though it is independently powered,
>watches the +5V on the USB cable and powers down when that drops.
>I would like to be able to keep the scanner powered down the vast majority
>of the time when I am not using it at all. I have heard just enough about
>the inner workings of USB to wonder if it's possible on some or all USB hubs
>to command down the +5V on a particular port through software. Whether
>there's driver support is another question - right now I'm just curious if
>anyone who knows USB better than I do thinks the idea is even possible.