在 Windows 上的软件中关闭 USB 设备 [英] Power off an USB device in software on Windows

查看:26
本文介绍了在 Windows 上的软件中关闭 USB 设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过 Windows 上的软件重启 USB 设备.

I would like to power cycle an USB device through software on Windows.

我正在开发一个小型 USB 电源微控制器.该芯片将在电源循环时恢复到本机行为并允许下载代码.由于我的代码会在出现问题时使设备崩溃——使其忽略所有 USB 命令——我必须从系统中拔出设备.

I am doing development on a small USB power microcontroller. This chip will revert to native behavior on a power cycle and allow a code download. Since my code will crash the device when things go wrong -- making it ignore all USB commands -- I have to physically unplug the device from the system.

我想远程进行开发,而不必亲自到场.

I want to do development remotely, and not have to be physically present.

到目前为止,我已经尝试使用devcon"来禁用部分 USB 堆栈.虽然这会将集线器带入 D3(应该关闭电源!),但仍有电源供应给设备.

So far I have tried using "devcon" to disable portions of the USB stack. While this takes the hubs into D3 (should be powered off!), there is still power being supplied to the device.

是否有任何预先存在的解决方案或 SetupAPI 技巧可能会有所帮助?

Are there any preexisting solutions or SetupAPI tricks that might help?

推荐答案

某些 USB 集线器能够关闭其下游设备的电源.

Some USB hubs have the ability to turn power off to its downstream devices.

是否可以从 Ubuntu 为 USB 集线器上的端口供电?"https://askubuntu.com/questions/149242/is-it-possible-to-power-up-ports-on-a-usb-hub-from-ubuntu其中指向 hub-ctrl.c 的一些 c 源代码

"Is it possible to power up ports on a USB hub from Ubuntu?" https://askubuntu.com/questions/149242/is-it-possible-to-power-up-ports-on-a-usb-hub-from-ubuntu Which points to some c source for hub-ctrl.c

参见:http://www.gniibe.org/development/ac-power-control-by-USB-hub/index

我用 Dream-Cheeky USB LED 装置在 Ubuntu 上测试了这个,它似乎确实关闭了电源 - 尽管再次打开时,设备记住了(!)它的 LED 开/关状态???- 当我拔下并重新插入 LED 的 USB 导线时,这并没有发生...

I tested this on Ubuntu with a Dream-Cheeky USB LED unit, and it did seem to turn the power off - although when turned on again, the device had remembered (!) its LED on/off state ??? - This did not happen when I unplugged and repluged the USB lead to the LED...

好像有人考虑过为 Windows 编译这个,但我找不到结果,抱歉.

It looks like someone has looked at compiling this for Windows, but I could not find the result, sorry.

这篇关于在 Windows 上的软件中关闭 USB 设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆