De-unplug USB device?

S

Stan Brown

This really isn't a
USB hardware designers newsgroup.
Straw man alert!

Of course it's not - and my question was not a hardware design
question. This is a Windows 7 newsgroup, and my question was a
Windows 7 question.

There's no shame in not knowing the answer, but it's not terribly
helpful to post something inaccurate with an air of certainty.
 
V

VanguardLH

Stan said:
Straw man alert!

Of course it's not - and my question was not a hardware design
question. This is a Windows 7 newsgroup, and my question was a
Windows 7 question.

There's no shame in not knowing the answer, but it's not terribly
helpful to post something inaccurate with an air of certainty.
Wow, you certainly feel burned from someone that made a suggestion.
Didn't realize you provide absolutely perfect assistance to everyone
requesting help from you.

Back to the issue without the emotionalism, I realized that I hadn't
thought about catastrophic recovery by resetting a device. When you
boot your computer, devices get reset to put them into a known state.
That's why you see your keyboard flash its lights when you boot up.
From Billw50's reply, I started to think that there might be a way but
rather drastic: reset the controller. Disabling and reenabling might do
that. As I see after reading the other subthreads, the same suggestions
were made about using Device Management and devcon so I wasn't alone.
However, neither were they claiming God-like knowledge to ensure their
suggestions would apply to you. They just offered suggestions in
earnest hoping to assist you in your problem.

From others that mentioned USB Safely Remove (payware), and because it
claims to start stopped devices, I looked more into that program. They
don't give a lot of information on how their product works but they do
make some claims about its usability. For example, at
http://safelyremove.com/help/ui_quickStopMenu.htm is mentioned "Return
stopped device back! if a device is stopped, but is not unplugged yet,
it will be displayed in the menu, but its icon will be red-crossed. Just
righ click on the device and it will be returned back into the system!"
They don't say how, they just make the claim. The USB specs do mention
clearing the configuration and resetting a hub but, again, if you had
actually bothered to read any of the specs then you, too, would have
realized how difficult it is to understand them. They aren't really
designed to answer specific end-user type of questions.

So you could go buy USB Safely Remove (after its trial expires) to
accomplish your desire to use software to get the hub to rediscover
still-present devices. That means leaving a program running in memory
so you can occasionally open its GUI to select the device and click
through the program to restart (rediscover) the device (but, as others
have suggested, it might result in rediscovering all devices on that
hub). Even if you're quick to move the mouse around and click through
the program, that's probably not faster than pulling out the device or
the cable for it and plugging it back in. The software solution doesn't
improve on efficiency on the actions to product the result you want.
However, the program, if you're willing to pay for it, has other handy
features you might like. I used to have the program (occasionally it's
given away) but only saved for later testing and use; however, I can't
find it anymore so I couldn't test using it to see if it was a solution
for your request (despite not really being a faster solution). From
some of the posts in their forums, it looks like if you assist them with
their product, like help in a language translation, that they'll reward
you with a free copy.

So it appears you have received several usable suggestions on your
desire for a software solution to rediscovering a detached but still-
present USB device. You could use Device Management, devcon, reboot the
host, buy some payware that resets the controller, or just unplug and
replug the device.
 
J

J. P. Gilliver (John)

In message <[email protected]>, VanguardLH <[email protected]>
writes:
[]
the program, that's probably not faster than pulling out the device or
the cable for it and plugging it back in. The software solution doesn't []
for your request (despite not really being a faster solution). From []
host, buy some payware that resets the controller, or just unplug and
replug the device.
Although I think the OP was just asking out of curiosity, there is also
the question of physical wear and tear on the plug and (particularly)
socket. Although, touch wood, I'd say for once the design does appear to
be quite durable in this respect; I just mention the matter as no-one
else seems to have.

(I rather doubt _any_ of the software solutions are going to be actually
_quicker_ than a physical unplug/replug, except where it's round the
back or otherwise inaccessible.)
--
J. P. Gilliver. UMRA: 1960/<1985 MB++G.5AL-IS-P--Ch++(p)Ar@T0H+Sh0!:`)DNAf

.... current law enforcement approaches to stem the flow of drugs only manage
to seize about one per cent of the drug imports... - Professor David Nutt (31
July-6 August 2010)
 
V

VanguardLH

Gene said:
I use Uwe Sieber's removedrive, and its output implies that remounting
in place is possible. I have E-mailed him, and when I have a
response, I will follow up.
Thanks for that. I remember seeing "uwe-sieber" mentioned over in the
alt.comp.freeware group but never looked at his tools. Going back to
the safelyremove.com site, I found:

Return stopped device back! if a device is stopped, but is not
unplugged yet, it will be displayed in the menu, but its icon will be
red-crossed. Just righ click on the device and it will be returned
back into the system!"

So the USB Safely Remove product claims to rediscover a still-present
but detached (a logic state) device. They don't describe how they
perform that action but I suspect they reset the device, the same as
what happens when you boot and a reset gets sent to the devices to put
them into a known state.

Paul's reply quotes a comment from the Sieber site about having to
revert state by using devcon as a command-line tool (versus using the
Device Management GUI tool). Other than disabling the [root] hub (USB
controller) and then reenabling (which means the device also gets
reset), I'm not sure what other functions in devcon could make the hub
go [re]discover the devices still physically attached to it.

devcon does have a 'restart' command but I don't know what it really
does different than doing 'disable' followed by 'enable'. Running
"devcon help restart" only gives the terse output of "Restarts devices
that match the specific hardware or instance ID." The Device Management
GUI tool doesn't have a 'restart' function, just enable/disable of a
device. From reading posts in forums by driver authors for USB devices,
it appears "devcon restart <id>" resets the device. Resetting a USB hub
means it needs to rediscover any devices still physically attached but
would affect all devices attached to that hub.

Although Sieber's comment mentioned by Paul mentions using devcon to
restart the USB hub, I found the following article which mentions doing
the hardware rescan:

http://digital.ni.com/public.nsf/allkb/1D120A90884C25AF862573A700602459

Using either the Device Management GUI tool or devcon, you remove the
device and then perform a rescan to find new hardware. I suspect part
of finding and setting up the newly discovered hardware would be to
reset it to put it into a known state. When new hardware is found,
you'll notice the balloons telling you new hardware found and more about
setting it up. As the first respondent, Andy had mentioned using the
hardware rescan method so he got the OP halfway there. Removing the
device before the scan was the rest of the trick. The OP got a driver
error message but it's unclear if the OP removed the device before
rescanning for it.

While there looks to be software solutions the OP requested to
rediscover a still-present device, they all look to affect ALL devices
connected to the hub that gets reset. So those software solutions don't
fully comply with the OP's desire to rediscover just the one device he
logically detached but didn't physically remove. It's possible that
resetting the hub could affect his other USB devices in ways he doesn't
want. Would the driver as the interface between OS and device get
confused while performing some function but during which the device
temporarily disappeared because the hub to which it is connected got
reset? You get the one device rediscovered but perhaps the other
devices that were still attached do something "bad" when they were
working but got reset in the middle of their work. Guess that depends
on whether or not the driver was written to recover from such
catastrophic state change. What happens when you reset/restart a USB
hub to which was attached a printer that had traffic going to it? Would
you lose your whole print job or does the loss of commands result in
garbled output?

So far, the methods mentioned here (and elsewhere by reference) don't
look like they reestablish configuration for just one device but affects
all devices connected to the hub that got reset. You save one device
but perhaps negatively affect others with a reset the devices or their
drivers don't expect.
 
V

VanguardLH

J. P. Gilliver (John) said:
In message <[email protected]>, VanguardLH <[email protected]>
writes:
[]
the program, that's probably not faster than pulling out the device or
the cable for it and plugging it back in. The software solution doesn't []
for your request (despite not really being a faster solution). From []
host, buy some payware that resets the controller, or just unplug and
replug the device.
Although I think the OP was just asking out of curiosity, there is also
the question of physical wear and tear on the plug and (particularly)
socket. Although, touch wood, I'd say for once the design does appear to
be quite durable in this respect; I just mention the matter as no-one
else seems to have.

(I rather doubt _any_ of the software solutions are going to be actually
_quicker_ than a physical unplug/replug, except where it's round the
back or otherwise inaccessible.)
True, as I've seen users literally rape the connectors. To be honest, I
always keep a couple spares for my keyboard since I too often pound on
it (mostly during games) but that is easy to replace. Replacing a USB
port in a desktop is a easier than in a laptop or netbook. Your reasons
are valid but the OP never mentioned those concerns.
 
P

Paul

VanguardLH said:
devcon does have a 'restart' command but I don't know what it really
does different than doing 'disable' followed by 'enable'.
Forget it. I just tested this, and if you do

devcon restart deviceinstance

the deviceinstance no longer exists.

(To list the device instances, while the USB key is present,
you can try devcon hwids usb* . That's where I got my instance name
from.)

I was able to "restart" the device instance while it was present.
But issuing the exact same command, just after doing a Safely
Remove using the icon, the command then fails, because it
no longer knows about that instance.

To test it, I'd need some identifier that still exists, and
I don't know what that would be. The thing is effectively
no longer on the bus.

That was a PITA to do as well, because the KB article on the MS
site, doesn't have an X64 version of devcon. So I had to dig up
a copy of WDK for Windows 7 and get an x64 version of devcon from
there. And it still didn't help.

If you want your own devcon, x64 version, you download GRMWDK,
look in the WDM folder, look for "setuptools_x64fre_cab001.cab"
and in there is a "_devcon.exe_00000" file. Extract and rename
as you wish. You can try "devcon.exe help" to test it in
a Command Prompt window. I can tell it's x64, because now
that I'm back in front of my WinXP x32 machine, that version
of devcon won't run :)

Paul
 
V

VanguardLH

Paul said:
Forget it. I just tested this, and if you do

devcon restart deviceinstance

the deviceinstance no longer exists.

(To list the device instances, while the USB key is present,
you can try devcon hwids usb* . That's where I got my instance name
from.)

I was able to "restart" the device instance while it was present.
But issuing the exact same command, just after doing a Safely
Remove using the icon, the command then fails, because it
no longer knows about that instance.

To test it, I'd need some identifier that still exists, and
I don't know what that would be. The thing is effectively
no longer on the bus.

That was a PITA to do as well, because the KB article on the MS
site, doesn't have an X64 version of devcon. So I had to dig up
a copy of WDK for Windows 7 and get an x64 version of devcon from
there. And it still didn't help.

If you want your own devcon, x64 version, you download GRMWDK,
look in the WDM folder, look for "setuptools_x64fre_cab001.cab"
and in there is a "_devcon.exe_00000" file. Extract and rename
as you wish. You can try "devcon.exe help" to test it in
a Command Prompt window. I can tell it's x64, because now
that I'm back in front of my WinXP x32 machine, that version
of devcon won't run :)

Paul
From online searching and hitting forums where coders were asking about
how to write up drivers for USB, some there claimed that the 'restart'
only unloads and reloads the driver for the device and does not issue a
reset signal to the device. It seems you would be reloading the driver
while the device was in an unknown state.
 
B

BillW50

VanguardLH said:
True, as I've seen users literally rape the connectors. To be honest,
I
always keep a couple spares for my keyboard since I too often pound on
it (mostly during games) but that is easy to replace. Replacing a USB
port in a desktop is a easier than in a laptop or netbook. Your
reasons
are valid but the OP never mentioned those concerns.
I buy those short 6 inch USB extensions. And I use them not for extra
length, but when I plan on plugging and unplugging from an USB port a
lot. Thus not much wear on the laptop side, just mostly on the cheap
extension cable. I call them plug savers. ;-)
 
B

BillW50

J. P. Gilliver (John) said:
Although I think the OP was just asking out of curiosity, there is
also the question of physical wear and tear on the plug and
(particularly) socket. Although, touch wood, I'd say for once the
design does appear to be quite durable in this respect; I just mention
the matter as no-one else seems to have.
Nobody has mentioned about some USB devices that has their own power
supply and I never have to do the reconnect thing with them. For example
my 3.5 inch external hard drives. As I just safely remove them and kill
the power on the external drive.

When I want them back, turn the power on the external and it is back
online once again. And I never use software or ever touch the USB cables
and you can do this all day if you would like.

So somehow when the device loses power, it works the same as unplugging
and plugging the USB plug once again. So this doesn't sound too
complicated to me to design a short USB extension cable to effectively
do the very same thing. Maybe something as simple as a switch on the USB
5v line.
(I rather doubt _any_ of the software solutions are going to be
actually _quicker_ than a physical unplug/replug, except where it's
round the back or otherwise inaccessible.)
I dunno... USB Safely Remove (USBSR) and Zentimo works very well here.
;-)
 
B

BillW50

VanguardLH said:
If the reattach of the device works for you then perhaps it depends on
what hardware you have inside your box. For Dave and I, for example,
Nirsoft's USBdevView didn't work to reattach the device (to initiate
the handshaking needed for resend the presentation data from the
device to identify itself).
I would be interested to know if USB Safely Remove (USBSR) or Zentimo
works in this case?
I figure the author of Nirsoft's tools has more inside info than we
do. He's been producing hack tools for quite awhile. In his USBdevView
program, you can right-click on a device (with Connected=Yes state) to
select Disconnect it. There is no Connect or Reconnect entry in this
context menu. You can see a device that is not connected because its
definition remains in the enumeration data in the registry.
Right-click on a Connected=No item in the list and notice there is no
Connect or Reconnect function.

For a connected device (Connect=Yes), you can use the software tools
to disconnect that device. For a non-connected device (Connect=No), it
doesn't make sense to reconnect it with software because you nor the
OS even knows if there is a physical device present in a USB port.
It's not just "not connected" but it is also "not present". Presence
is establish through the physical act of connection which initiates
the handshaking to present the device.
Both USBSR and Zentimo know it is there, but disconnected. I don't know
how it figures this out? And if you physically remove the USB cable, it
knows this as well and can inform you about both.
Try an experiement. If you have a USB flash drive, plug it into a USB
port. Wait until the handshaking has completed for the device to
present itself so the OS knows how to identify the device type. Do
something to ensure the device is available, like use Windows Explorer
to look at whatever files are on the USB flash drive. Leave the device
plugged into the USB port. Use Nirsoft's USBdevView to disconnect the
device: right-click on the USB flash drive and select Disconnect
Selected Devices, or select the device and hit F9 (to do the same
thing). You now have a device that is still physically plugged into
the port but its state is detached (or disconnected). Detached devices
are unknown devices. You should now see Connected=No for that device.
Right-click on that same device again. Notice there is no context menu
entry to [re]connect that device.
I don't use Nirsoft's USBdevView, but both USBSR/Zentimo does this just
fine. You can keep this up all day if you would like too without ever
disconnecting and reconnecting the USB cable.
When I use Microsoft's USB Device Viewer, and after using Nirsoft's
USBdevView or Windows Safely Remove wizard to disconnect the USB flash
drive, the "USB Mass Storage Device" entry for the USB flash drive
changes. A yellowed exclamation icon appears to the left of the
device's entry in the tree list. The error is "No string descriptor".
Once detached, the presentation data will have to get resent to ensure
the device is defined to the OS. So both utilities show the device as
disconnected or detached. Neither one will let you reattach a detached
device. If it's not these 2 utilities you use, what other software do
you use to reattach a detached device?

From these two USB utilities, from what I saw from scanning the USB
specs, and what else I have read, software can detach a device
(because that's using the driver-side interface to the controller) but
attaching it requires hardware initiation (from the device-side of the
controller).
USBSR/Zentimo seems to handle this just fine. They also show devices
that I have disabled through the Device Manager like the FireWire. As it
shows these as disconnected just like those from the USB with Safely
Remove. As it shows them listed with a big red X to let you know they
are disconnected.
We would be interested to know what software you use to reattached a
detached USB device that was left in the USB port after it got
detached.
USBSR/Zentimo
 
A

Andy Burns

BillW50 said:
Nobody has mentioned about some USB devices that has their own power
supply and I never have to do the reconnect thing with them. For example
my 3.5 inch external hard drives. As I just safely remove them and kill
the power on the external drive.
And on a similar note, WinXP used to physically power down USB devices
when you safe-removed them, Win7 leaves them powered.
 
B

BillW50

Andy Burns said:
And on a similar note, WinXP used to physically power down USB devices
when you safe-removed them, Win7 leaves them powered.
True although USBSR/Zentimo will restore this XP function to Windows
Vista/7 too if you want it too. And I think it makes more sense to do so
than not.
 
G

Gene Wirchenko

Gene said:
[snip]
We would be interested to know what software you use to reattached a
detached USB device that was left in the USB port after it got detached.
Hello, I am part of the "We". I use Uwe Sieber's removedrive,
and its output implies that remounting in place is possible. I have
E-mailed him, and when I have a response, I will follow up.
There is a section already on the site.
Which he pointed me to:
http://www.uwe-sieber.de/drivetools_e.html#restart

[snip]

Sincerely,

Gene Wirchenko
 
B

BillW50

VanguardLH said:
. Going back to the safelyremove.com site, I found:

Return stopped device back! if a device is stopped, but is not
unplugged yet, it will be displayed in the menu, but its icon will be
red-crossed. Just righ click on the device and it will be returned
back into the system!"

So the USB Safely Remove product claims to rediscover a still-present
but detached (a logic state) device. They don't describe how they
perform that action but I suspect they reset the device, the same as
what happens when you boot and a reset gets sent to the devices to put
them into a known state.
Actually in the help file, it explains it restarts the hub (not an
individual device). Although I believe the terminology reset and restart
is the same thing in this case.
. While there looks to be software solutions the OP requested to
rediscover a still-present device, they all look to affect ALL devices
connected to the hub that gets reset. So those software solutions
don't fully comply with the OP's desire to rediscover just the one
device he logically detached but didn't physically remove. It's
possible that resetting the hub could affect his other USB devices in
ways he doesn't want. Would the driver as the interface between OS and
device get confused while performing some function but during which
the device temporarily disappeared because the hub to which it is
connected got reset? You get the one device rediscovered but perhaps
the other devices that were still attached do something "bad" when
they were working but got reset in the middle of their work. Guess
that depends on whether or not the driver was written to recover from
such catastrophic state change. What happens when you reset/restart a
USB hub to which was attached a printer that had traffic going to it?
Would you lose your whole print job or does the loss of commands
result in garbled output?

So far, the methods mentioned here (and elsewhere by reference) don't
look like they reestablish configuration for just one device but
affects all devices connected to the hub that got reset. You save one
device but perhaps negatively affect others with a reset the devices
or their drivers don't expect.
I've been playing with Zentimo with stopping a device (same as safely
remove) and returning back a device. And USBSR and Zentimo will stop and
warn you if restarting the hub would cause problems. As it lists
processes that has the other device(s) locked for some reason. So you
have a choice to close applications, etc. manually and to try again. Or
to use the Forced Return (button). Now and only now is anything at risk
on the locked drives on this hub. And it also warns you of this risk.

And while playing around, it seems to me that it doesn't matter for any
other non-drive USB devices on the hub during a hub restart. Sure they
disconnect for a second or two, but I haven't seen any long term side
effects from this process yet. Although my USB tuner might not like that
too much while recording a show.

Now when there is another drive connected to the hub and it also has
running process(es) accessing this other device. then restarting the hub
could be a problem. And even when I ignore the warnings and try a forced
return on this Windows 7 machine, it hasn't worked. The reason it looks
to me is that Zentimo won't restart the hub if it can't stop the
processes which locked the other drive. Thus why I think it fails in
this case.

USBSR and Zentimo will tell you what processes are preventing a device
from being stopped (unlike Windows itself). Although sometimes it
doesn't know. I am taking a stab in the dark guessing here, but it might
have to due with a ring 0 process if there is such a thing. Crystal Rich
explains it differently. As they claim it is due to a bug within Windows
itself. The same problem happens with returning back a device with
USBSR/Zentimo.

I am having trouble returning back an USB card reader I am testing with.
Other USB drives are returning. And this card reader, Zentimo is saying
that the following processes are stopping this card reader from
returning:

Svchost.exe
Csrss.exe
KHALMNPR.exe (part of Logitech's SetPoint)

I have no idea why Logitech's mouse driver has a process locking
something due to the card reader and preventing the USB hub to be
restarted.
 
J

J. P. Gilliver (John)

In message <[email protected]>, BillW50 <[email protected]>
writes:
[]
I buy those short 6 inch USB extensions. And I use them not for extra
length, but when I plan on plugging and unplugging from an USB port a
lot. Thus not much wear on the laptop side, just mostly on the cheap
extension cable. I call them plug savers. ;-)
Where do you get them? I have in the past seen USB items in poundshops
(generic name in UK for shops where everything's a pound or less, or 99p
or less), often with such a lead supplied with - sometimes hubs, novelty
lights, etcetera. I've often thought this is probably cheaper than
buying the lead on its own! OK, it might have been something like an
unpowered USB1.1 hub, or similarly negligible-worth device, but who
cares - the lead will be OK.

I haven't _noticed_ them as much of late, but they may still be around;
I haven't been into poundshops much.
 
B

BillW50

J. P. Gilliver (John) said:
In message <[email protected]>, BillW50 <[email protected]>
writes:
[]
I buy those short 6 inch USB extensions. And I use them not for extra
length, but when I plan on plugging and unplugging from an USB port a
lot. Thus not much wear on the laptop side, just mostly on the cheap
extension cable. I call them plug savers. ;-)
Where do you get them? I have in the past seen USB items in poundshops
(generic name in UK for shops where everything's a pound or less, or
99p or less), often with such a lead supplied with - sometimes hubs,
novelty lights, etcetera. I've often thought this is probably cheaper
than buying the lead on its own! OK, it might have been something like
an unpowered USB1.1 hub, or similarly negligible-worth device, but who
cares - the lead will be OK.

I haven't _noticed_ them as much of late, but they may still be
around; I haven't been into poundshops much.
Hehehe poundshops... that sounds funny being from the US. As in the US
that means something else entirely. And you might have guessed, we call
them dollar stores here. Decades ago (when things were cheaper) they
used to be called dime stores. ;-)

Anyway yes, those short USB extension cables can be tough to find.
Although I got mine on the Internet at www.Microbarn.com.

USB 2.0 Extension Cable A/M to A/F, 6 inches, Blue
http://www.microbarn.com/details.aspx?rid=102660
 
C

choro

I buy those short 6 inch USB extensions. And I use them not for extra
length, but when I plan on plugging and unplugging from an USB port a
lot. Thus not much wear on the laptop side, just mostly on the cheap
extension cable. I call them plug savers. ;-)
Very clever. This clever dick here does exactly the same. But
particularly useful ploy to use with items with mini-USB inputs on such
things as 2 1/2 inch external hard disks. I just use a standard USB
extension cable in connection with the short USB to mini-USB cable. If
any connection is to go wrong it will be one or the other of the cables,
cheap enough to replace.
-- choro
 
A

Andy Burns

choro said:
This clever dick here does exactly the same. But
particularly useful ploy to use with items with mini-USB inputs on such
things as 2 1/2 inch external hard disks. I just use a standard USB
extension cable in connection with the short USB to mini-USB cable. If
any connection is to go wrong it will be one or the other of the cables,
cheap enough to replace.
For mini-USB I don't know, but micro-USB are actually rated for more
insertion cycles than normal-USB.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top