Vivian River
Vivian River

Reputation: 32390

How to identify a USB device given its VID and PID

In the Windows Device Manager, I can look up the VID and PID of each USB device connected to my system. What is a good way to look up the vendor of the device using this information?

My motivation is that I want to deploy an application to my users that will identify all USB devices connected to their systems.

Upvotes: 17

Views: 54106

Answers (3)

not2qubit
not2qubit

Reputation: 16930

This question have (at least) 2 answers. First, it depends on if the USB device you want the info for, is already connected on your system or not. Id it is already connected with a driver, you should be able to find the info in the Class, FriendlyName, InstanceId or Manufacturer USB fields for Windows. These may be called something else on another OS.

If the device is not connected, and you just want the info for any VID/PID (USB device), you need to consult some online USB VID/PID database. Unfortunately there is not one unique (and free) place maintaining this database, so the number of available entries varies greatly.

Here is a list of somewhat ok DB's.


For Windows Powershell


# If your device is already installed/connected
(Get-PnpDevice -PresentOnly | Where-Object { $_.InstanceId -match '^USB\\'}) | Select-Object Status,
                @{n="VID:PID  IFn"; e={
                        $usb = '';
                        if ($_.InstanceId -match '.*VID_(?<vid>[0-9A-F]{4})') { $usb = $matches['vid'] };
                        if ($_.InstanceId -match '&PID_(?<pid>[0-9A-F]{4})')  { $usb += ':' + $matches['pid'] };
                        if ($_.InstanceId -match '&MI_(?<ifn>[0-9]{2}).*')    { $usb += ' ' + $matches['ifn'] };
                        "{0,-12}" -f ($usb)}},
        Class,FriendlyName,InstanceId,Manufacturer | Sort-Object -Property InstanceId | ft -AutoSize

# OUTPUT:
Status VID:PID  IFn Class     FriendlyName                   InstanceId                                    Manufacturer
------ ------------ -----     ------------                   ----------                                    ------------
OK                  USB       USB Root Hub (USB 3.0)         USB\ROOT_HUB30\4&1CDD8EC&0&0                  (Standard USB HUBs)
OK                  USB       USB Root Hub (USB 3.0)         USB\ROOT_HUB30\4&7B32CF2&0&0                  (Standard USB HUBs)
OK     048D:C987    HIDClass  USB Input Device               USB\VID_048D&PID_C987\5&21D1BAAE&0&9          (Standard system devices)

For Linux/Cygwin/MSYS

# If installed on Linux/MacOS:
lsusb

# If not installed, using an online USB DB...
function get_vid_pid_name () { 
   VP=$(echo $1 | tr ":" "-")      # <vid>:<pid>
   curl -s4Lk  "https://linux-hardware.org/index.php?id=usb:$VP" -A "lynx" | grep -iE "<tr><th>Name|Vendor</th>" -A2; 
}

# This output is readable but ugly as it contains some HTML and need to be parsed further. 

Other recommended tools are:

Upvotes: 0

Jeff
Jeff

Reputation: 141

Try this source it is what I use and it seems to be always up to date and very easy to use pcidatabase and it is an online search so you don't have to look through a list of numbers.

Upvotes: 3

Karl Bielefeldt
Karl Bielefeldt

Reputation: 49048

It's just one of those things you have to keep an updated list on, although having slightly outdated information wouldn't be terrible, since the most popular vendors have been around forever. Here's one source you could use that appears to be regularly updated.

Upvotes: 14

Related Questions