6

我正在开发的某些软件需要存在 USB 设备(我作为 SerialPort 与之交互,带有 USB 到 UART 桥接器)。

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

我不能依赖用户采取任何行动(物理或其他方式),所以我需要一种以编程方式重新启动设备的方法。

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

4

1 回答 1

8

您可以使用WDK(Windows 驱动程序工具包)。提供了大量源代码示例,但预计学习曲线会很陡峭。

Devcon是由 MS 开发的一个程序,用于演示目的,它有时可以工作并做你想做的事。但请注意,这很奇怪而且很狂野。无论如何,提供了源代码,所以如果你喜欢弄乱设备驱动程序,你可以滚动你自己的“Devcon”代码。

从 MS 网站:

DevCon (Devcon.exe), the Device Console, is a command-line tool that displays detailed information about devices. Using DevCon, you can search for and manipulate devices from the command line. DevCon enables, disables, installs, configures, and removes devices on the local computer and displays detailed information about devices on local and remote computers.

于 2010-06-30T05:15:32.933 回答