简体   繁体   English

回收C ++中的USB端口

[英]Recycle USB port in C++

I need to simulate plug/unplug for USB device in C++ under Windows environment. 我需要在Windows环境下模拟C ++中USB设备的插入/拔出。 I know the existence of this IOCTL 我知道这个IOCTL的存在

http://msdn.microsoft.com/en-us/library/windows/hardware/ff537243(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/hardware/ff537243(v=vs.85).aspx

(IOCTL_INTERNAL_USB_CYCLE_PORT) which indeed is what I am looking for, but I don't know how to use. (IOCTL_INTERNAL_USB_CYCLE_PORT)确实是我想要的,但是我不知道如何使用。 Is there anyone which can tell me who I can find an example or share some lines of code in order to help me, please! 请问有人可以告诉我谁可以找到示例或共享一些代码行来帮助我!

Thanks in advance. 提前致谢。

Since you are in User Mode land and using C++ I'd recommend looking at the devcon sample . 由于您是在用户模式下使用C ++的人,因此建议您查看devcon示例 Out of the box you can use it on the command line to issue PnP or disable/enable requests to devices. 开箱即用,您可以在命令行上使用它来发出PnP或禁用/启用对设备的请求。 The source code is also available , so you can use that as a start to get this functionality added to your environment. 源代码也可用 ,因此您可以以此为起点将此功能添加到您的环境中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM