Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. USB PNP

USB PNP

Scheduled Pinned Locked Moved C#
questioncomtutorial
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rudy net
    wrote on last edited by
    #1

    How can I search for a USB PNP ID? For example, when you run "msinfo32.exe" and then expand "Components/USB", it lists all the USB devices as well as their "PNP Device ID". I tried using This Code[^]; however, it doesn't list my USB device, although it does work properly by detecting the mouse and some other devices. One thing I noticed is that all the devices that the code above finds start with "HID" in the msinfo32.exe "PNP Device ID"; however, my device starts with USB. My device id is: USB\VID_0403&PID_6001. -- modified at 20:26 Saturday 13th May, 2006

    R 1 Reply Last reply
    0
    • R rudy net

      How can I search for a USB PNP ID? For example, when you run "msinfo32.exe" and then expand "Components/USB", it lists all the USB devices as well as their "PNP Device ID". I tried using This Code[^]; however, it doesn't list my USB device, although it does work properly by detecting the mouse and some other devices. One thing I noticed is that all the devices that the code above finds start with "HID" in the msinfo32.exe "PNP Device ID"; however, my device starts with USB. My device id is: USB\VID_0403&PID_6001. -- modified at 20:26 Saturday 13th May, 2006

      R Offline
      R Offline
      rudy net
      wrote on last edited by
      #2

      I figured it out by using ManagementObjectSearcher class. Wow! This class is really powerful if you ever need to figure out anything from your hardware. Here is the code: string device = "Win32_USBHub"; ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * from " + device); foreach(ManagementObject mo in searcher.Get()) { Trace.WriteLine(mo.GetPropertyValue("Name")+" "+ mo.GetPropertyValue("PNPDeviceID")); } Note that there are a ton of hardware classes available from here[^]. Each class has several variables that can be accessed using the GetPropertyValue method.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups