简体   繁体   中英

Recycle USB port in C++

I need to simulate plug/unplug for USB device in C++ under Windows environment. I know the existence of this IOCTL

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. 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 . Out of the box you can use it on the command line to issue PnP or disable/enable requests to devices. The source code is also available , so you can use that as a start to get this functionality added to your environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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