在Windows中以编程方式重新启动USB设备 [英] Programmatically restart USB device in Windows

查看:101
本文介绍了在Windows中以编程方式重新启动USB设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发的某些软件需要存在USB设备(我可以通过USB到UART的桥接器作为SerialPort与之交互).

Some software I am developing requires the presence of a USB device (which I interact with as a SerialPort, with a USB-to-UART bridge).

有时,从休眠状态重新启动计算机后,未检测到该设备,并且我无法再通过其串行端口写入或读取该设备.必须具有对该设备的读/写访问权限.

Sometimes, after a computer is being restarted from hibernation, the device is not being detected, and I can no longer write to, or read from, the device through its serial port. Having read/write access to the device is necessary.

我不能依靠用户采取任何措施(物理或其他方式),因此我需要一种以编程方式重新启动设备的方法.

I cannot rely on the user to take any action (physical or otherwise), so I need a way to restart the device programmatically.

在Windows XP/Vista/7中,如何使用.NET框架以编程方式重新启动USB设备?

推荐答案

您可以使用

You could use the WDK (Windows Driver Kit). Lots of source code examples provided, but expect a steep learning curve.

Devcon 是一个程序由MS开发的用于演示目的,有时可以正常工作并满足您的要求.但是请注意,这很奇怪而且很疯狂.无论如何,都提供了源代码,因此,如果您想弄乱设备驱动程序,可以滚动自己的"Devcon"代码.

Devcon is a program developed by MS for demonstration purposes that sometimes works and does what you want. But be aware that it is weird and wild. Anyway, the source code is provided, so if you like to mess with device drivers, you can roll your own "Devcon" code.

从MS网站:

DevCon(Devcon.exe),即设备控制台,是一个命令行工具,可显示有关设备的详细信息.使用DevCon,您可以搜索和从命令行操作设备.DevCon启用,禁用,安装,在本地计算机上配置和删除设备,并显示详细信息有关本地和远程计算机上的设备的信息.

HTH!

这篇关于在Windows中以编程方式重新启动USB设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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