在 Windows 中以编程方式重新启动 USB 设备
我正在开发的一些软件需要 USB 设备(我作为串行端口与 USB 转 UART 桥进行交互)。
有时,计算机从休眠状态重新启动后,无法检测到该设备,并且我无法再通过串行端口写入或读取该设备。需要对设备进行读/写访问。
我不能依赖用户采取任何操作(物理或其他),因此我需要一种以编程方式重新启动设备的方法。
如何使用 .NET 框架在 Windows XP/Vista/7 中以编程方式重新启动 USB 设备?
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.
How should I approach restarting a USB device programatically in Windows XP/Vista/7 using the .NET framework?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 WDK(Windows 驱动程序工具包)。提供了大量源代码示例,但学习曲线很陡峭。
Devcon 是 MS 开发的程序出于演示目的,有时可以正常工作并执行您想要的操作。但请注意,这很奇怪且狂野。不管怎样,我们提供了源代码,所以如果你喜欢搞乱设备驱动程序,你可以推出你自己的“Devcon”代码。
来自 MS 站点:
DevCon (Devcon.exe),设备控制台,是一个命令行工具,显示
有关设备的详细信息。使用 DevCon,您可以搜索并
从命令行操作设备。 DevCon 启用、禁用、安装、
配置和删除本地计算机上的设备并显示详细信息
有关本地和远程计算机上的设备的信息。
呵呵
!
You could use the WDK (Windows Driver Kit). Lots of source code examples provided, but expect a steep learning curve.
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.
From the MS site:
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.
HTH!