Perplexing Pies
Perplexing Pies

Reputation: 113

Using WMI, is it possible to return the manufacturer chip ID (device type) for the connected USB device?

Using a WMI call, I was hoping to return the chip ID of the FTDI device. I'd like to detect a device regardless of the product or vendor ID.

I tried to pull a query for CIM_USBDevice, which finds devices but does not as far as I can tell have a value for the device type. As far as I can tell most other people used the device manager for a one-shot discovery or found a different payload piece to dictate their changes off of.

    public void findDevices()
    {
        string wmiQuery = "SELECT * FROM CIM_USBDevice";

        ManagementObjectSearcher searcher = new ManagementObjectSearcher(wmiQuery);

        List <ManagementObject> deviceObjects = new();

        foreach (ManagementObject device in deviceList.Get())
        {
            // Access properties of the USB device like DeviceID, PNPDeviceID, etc.
            string devID = device["Description"]?.ToString() ?? "Description field not included";
            string avail = device["Availability"]?.ToString() ?? "Availability field not included";
            string cmancode = device["ConfigManagerErrorCode"]?.ToString() ?? "ConfigError not included";
            string PNPDeviceID = device["PNPDeviceID"]?.ToString() ?? "PNPDeviceID not included";
            string Name = device["Name"]?.ToString() ?? "Name not included";
            string deviceID = device["DeviceID"]?.ToString() ?? "devID field not included";
        }`

It appears to be finding VID, PID, and the serial #. PNPDeviceID and DeviceID appear to be identical, and the FTXYZABC is not the correct device type.

USB\VID_4321&PID_1234\FTXYZABC

USB Composite Device

USB\VID_4321&PID_1234\FTXYZABC

Description: USB Serial Converter E

Availability field not included

Upvotes: 0

Views: 33

Answers (0)

Related Questions