通过VID \ PID获取usb-printer信息

时间:2018-05-16 13:23:43

标签: c# winapi wmi

我试图通过c#应用程序使用wmi查询获取usb-printer名称。 我使用this example。 结果是

Device ID: USB\VID_0B0B&PID_106E\5&18F54CB7&0&2, PNP Device ID: USB\VID_0B0B&PID_106E\5&18F54CB7&0&2, Description: USB Printing Support

这对我来说不适合,在Windows设备管理器中显示为DatamaST-3210。 之后,我尝试使用WmiExplorer获取数据

select * from Win32_PnPEntity

我得到2台设备:

instance of Win32_PnPEntity
{
    Caption = "USB Printing Support";
    ClassGuid = "{36fc9e60-c465-11cf-8056-444553540000}";
    CompatibleID = {"USB\\Class_07&SubClass_01&Prot_02", "USB\\Class_07&SubClass_01", "USB\\Class_07"};
    ConfigManagerErrorCode = 0;
    ConfigManagerUserConfig = FALSE;
    CreationClassName = "Win32_PnPEntity";
    Description = "USB Printing Support";
    DeviceID = "USB\\VID_0B0B&PID_106E\\5&18F54CB7&0&2";
    HardwareID = {"USB\\VID_0B0B&PID_106E&REV_0304", "USB\\VID_0B0B&PID_106E"};
    Manufacturer = "Microsoft";
    Name = "USB Printing Support";
    PNPDeviceID = "USB\\VID_0B0B&PID_106E\\5&18F54CB7&0&2";
    Service = "usbprint";
    SystemCreationClassName = "Win32_ComputerSystem";

};

instance of Win32_PnPEntity
{
    Caption = "DatamaxST-3210";
    ConfigManagerErrorCode = 0;
    ConfigManagerUserConfig = FALSE;
    CreationClassName = "Win32_PnPEntity";
    Description = "DatamaxST-3210";
    DeviceID = "USBPRINT\\DATAMAXST-3210\\6&93D5382&B&USB001";
    HardwareID = {"USBPRINT\\DatamaxST-3210A4C7", "DatamaxST-3210A4C7"};
    Name = "DatamaxST-3210";
    PNPDeviceID = "USBPRINT\\DATAMAXST-3210\\6&93D5382&B&USB001";
    Status = "OK";
    SystemCreationClassName = "Win32_ComputerSystem";
};

第一个具有DeviceID,其中包含我用于搜索的数据,但不包含Caption。第二个设备有正确的标题,没有关于他的视频\ pid的信息。

使用Windows设备管理我看到我的设备有父正确的视频/ pid。 我相信USBPRINT设备是USB \ VID _...

的孩子

那么,如何通过了解设备VID \ PID?

来获取USBPRINT设备名称

0 个答案:

没有答案