Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB exact description need to include. #18

Closed
spark6-dev opened this issue Sep 8, 2021 · 2 comments
Closed

USB exact description need to include. #18

spark6-dev opened this issue Sep 8, 2021 · 2 comments

Comments

@spark6-dev
Copy link

spark6-dev commented Sep 8, 2021

Actually most of the device doesn't have any product name or vendor name. but still, vendors added some information inside the "Bus reported device description"

Some of the devices only included the vendor and product information, but in most of the cases these values will be default ones like the product: "USB Input Device", vendor: "Standard System device".

Solution recommended

If possible we can include the "Bus reported device description" into the below query.

 using ManagementObjectSearcher Win32_PnPEntity = new ManagementObjectSearcher($"SELECT Caption, ClassGuid, Description, DeviceID, Manufacturer FROM Win32_PnPEntity WHERE DeviceID LIKE '%{serial}%'");

This is the right method to identify the name for the devices most of the other keys are default ones so we are unable to find the exact devices.

This "Bus reported device description" can be set by the USB device, for instance

Some references.

public static DEVPROPKEY DEVPKEY_Device_BusReportedDeviceDesc = new DEVPROPKEY() { Fmtid = new Guid(0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2), Pid = 4 };
 usbDevice.BusReportedDeviceDescription = usbDevice.GetPropertyValue(UsbDeviceWinApi.DevicePropertyKeys.DEVPKEY_Device_BusReportedDeviceDesc) as String;
@Jinjinov
Copy link
Owner

Jinjinov commented Sep 8, 2021

I searched for a solution, but I only found one possible answer that could be used with WMI:

https://stackoverflow.com/a/59282440/4675770

As you can see, others are using native Windows libraries with [DllImport]:

https://stackoverflow.com/a/36616242/4675770

and that method is not compatible with WMI which is used in Usb.Events

I will try to find a way to make it work with WMI.

Do you have any suggestions on how to make it work with WMI?

EDIT: this one is in C++ https://stackoverflow.com/a/3439805/4675770

Is your example from here? https://github.com/vurdalakov/usbdevices

@Jinjinov
Copy link
Owner

@spark6-dev

I found a solution: https://github.com/Jinjinov/Usb.Events/tree/master/Usb.Events.Example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants