Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Power off USB device with batch

2,456 views
Skip to first unread message

te...@testnospam.nl

unread,
Nov 7, 2011, 12:55:11 PM11/7/11
to
Is it possible to power off a device via a batch file?

I have this USB microscope that, is turned on when I boot my Windows
XP PC.

Is there a way to disable the power to that specific port so the LED's
in the microscope are dimmed?

I have Devcon on my PC but when I try to disable the device it still
gets power (the LEDs keep burning).

What I tought was to by default disable the power to the USB port, and
when I open the software for the microscope, enable the power back?

When I have a batch file that enables the power and after that open
the microscope's software things would be better.

Devcon found this: USB\VID_19B4&PID_0101\CELESTRON_DIGITAL_MICROSCOPE
for the USB port.

Any ideas?

foxidrive

unread,
Nov 7, 2011, 2:40:44 PM11/7/11
to
Stick some bluetack over the offending LED? :)

You'd need to disable the USB port, not the microscope.

--
Regards,
Mic

te...@testnospam.nl

unread,
Nov 7, 2011, 3:02:16 PM11/7/11
to
Thank you, but how would I do that?

foxidrive

unread,
Nov 7, 2011, 3:14:30 PM11/7/11
to
What is this? International Top posting day? ;)


You'd need to use devcon and iterate your list of USB port hardware and disable one at a time, until you figure out which one the microscope is connected to.

I haven't done it myself, I'm surmising what should work.



--
Regards,
Mic

Andy

unread,
Nov 7, 2011, 6:36:22 PM11/7/11
to
Try this.

@echo off
cls
echo.
echo.
echo Disabling the microscope.
echo.
echo.
devcon disable =USB\VID_19B4&PID_0101\CELESTRON_DIGITAL_MICROSCOPE

Petr Laznovsky

unread,
Nov 8, 2011, 5:27:45 PM11/8/11
to
This only stop device driver service, he need to shutdown USB port to
stop powering device.

L.

te...@testnospam.nl

unread,
Nov 9, 2011, 12:51:49 AM11/9/11
to
Any idea how I can do this?

Todd Vargo

unread,
Nov 9, 2011, 6:49:18 AM11/9/11
to
<te...@testnospam.nl> wrote:
> Any idea how I can do this?

Contact the manufacturer.

foxidrive

unread,
Nov 9, 2011, 7:28:12 AM11/9/11
to
> On Tue, 08 Nov 2011 23:27:45 +0100, Petr Laznovsky
> <nob...@nowhere.com> wrote:
>
>> On 8.11.2011 0:36, Andy wrote:
>>> On Nov 7, 11:55 am, t...@testnospam.nl wrote:
>>>> Is it possible to power off a device via a batch file?
>>>>
>>>> I have this USB microscope that, is turned on when I boot my Windows
>>>> XP PC.
>>>>
>>>> Is there a way to disable the power to that specific port so the LED's
>>>> in the microscope are dimmed?
>>>>
>>>> I have Devcon on my PC but when I try to disable the device it still
>>>> gets power (the LEDs keep burning).
>>>>
>>>> What I tought was to by default disable the power to the USB port, and
>>>> when I open the software for the microscope, enable the power back?

Caveat: I have not tested this.


Type this command:

devcon hwids USB\ROOT_HUB*|findstr "^USB"


It gives me a list like this for example on my machine:

USB\ROOT_HUB\4&14E368E2&0
USB\ROOT_HUB\4&22DCF096&0
USB\ROOT_HUB\4&25712375&0
USB\ROOT_HUB\4&2B98EF05&0
USB\ROOT_HUB\4&3AE06BE8&0
USB\ROOT_HUB\4&6427700&0
USB\ROOT_HUB20\4&1828FFF1&0
USB\ROOT_HUB20\4&5E0D3C3&0



Now use each line above that you find from your machine, in a command like this (with the first one from my machine as an example)

devcon disable "USB\ROOT_HUB\4&14E368E2&0"

and see if the Microscope LED goes out.
*If it doesn't then use the same command but replace disable with enable* to turn that port back on, like this example.

devcon enable "USB\ROOT_HUB\4&14E368E2&0"


Once you find the port that disables the microscope then you can put that command in a batch file to disable and enable it.




*BE AWARE* that during testing your USB mouse and keyboard and USB hubs and other USB devices may be disabled.





--
Regards,
Mic

kemp...@gmail.com

unread,
Dec 7, 2017, 5:30:07 PM12/7/17
to
Did you ever figure this out? I am trying to do something similar, and I can disable the USB camera for the microscope but the light isn't going out.

John Gray

unread,
Dec 8, 2017, 3:16:29 PM12/8/17
to
See if USBDeview http://www.nirsoft.net/utils/usb_devices_view.html by Nir Sofer has anything that will assist you. Note that some of the parameters for the command line version are by no means obvious...

JJ

unread,
Dec 9, 2017, 8:39:54 AM12/9/17
to
On Thu, 7 Dec 2017 14:30:05 -0800 (PST), kemp...@gmail.com wrote:
>
> Did you ever figure this out? I am trying to do something similar, and I
> can disable the USB camera for the microscope but the light isn't going
> out.

Try using power management to control the USB device. Note: some USB devices
support full power management, partial (e.g. no power off, only low power
mode), or none at all. e.g. USB input devices such as keyboard and mouse,
can't be powered off. Some may have no support at all in order to make them
cheaper for consumers.
0 new messages