Jump to content
  • Advertisement
Sign in to follow this  
Zantagor

Listing USB Device on Windows

This topic is 4049 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Anyone has any insight on how to make a list of the available USB ports, and their connected devices in C++?

Share this post


Link to post
Share on other sites
Advertisement
This may not be the best way, but assuming you have the DDK installed you can use the Setup API to enumerate devices on the computer. First you'd use CM_Connect_Machine(), then CM_Locate_DevNode_Ex() to get the root device node. From the root device node you can use CM_Get_Child() and CM_Get_Sibling() (or their Ex versions) to enumerate the devices on the computer. From there you can probably use SetupDiGetDeviceRegistryProperty() to get the device IDs of the individual devices. USB device IDs generally look like USB\VID_v(4)&PID_d(4)&REV_r(4), where the (4)s are four digit identifiers for the vendor, product and revision respectively. However, some devices may not follow this pattern exactly. They should all still start with USB though.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!