Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get only USB devices not all the devices in the system

Grretings to all,

I get devices list from the system.

but i am not sure that if i want to get only the usb devices currently in the system means ,

What class i must specify in the below code ( DWORD Flags )

hDevInfo = SetupDiGetClassDevs(&GUID_DEVINTERFACE_USB_DEVICE,
                           0, // Enumerator
                           0,
                           DIGCF_PRESENT | DIGCF_INTERFACEDEVICE );
like image 583
user198725878 Avatar asked Nov 21 '25 18:11

user198725878


1 Answers

Consider using EnumerateHostController().

Examples

  • www.intel.com/intelpress/usb/examples/DUSBVC.PDF
  • github.com/Microsoft/Windows-driver-samples/blob/master/usb/usbview/enum.c

Additional info and a detailed discussion here.

like image 177
TheCodeArtist Avatar answered Nov 23 '25 06:11

TheCodeArtist



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!