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

Add friendly_name field for usb device on windows #90

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anti-social
Copy link

@anti-social anti-social commented Nov 8, 2024

Sometimes it is useful to have this kind of information. For example using it I will have the ability to detect whether a device is a flight controller (friendly_name contains some substring like Betaflight, INav etc).

@kevinmehall
Copy link
Owner

On the devices I'm looking at, the friendly name is either the same as the already exposed product string descriptor, or not present. Do you know where this value is coming from on your devices if it differs from the product string?

@anti-social
Copy link
Author

Here is an example of device I work with:

0483:5740 - "Betaflight STM32F405 (COM3)", "Betaflight STM32F405"

But some people notified me that they have following output:

0483:5740 - "Betaflight STM32F405 (COM3)", "STM32F405"

So sometimes friendly name is the only way on Windows to get a point that a device is flashed with Betaflight.

@kevinmehall
Copy link
Owner

My question is where Windows is getting that string from -- ideally you'd have a cross-platform way to do this with knowledge of where it comes from instead of an under-documented Windows-only property that happens to include what you want.

Is it coming from the manufacturer string descriptor? Windows doesn't normally cache that when a device is plugged in, so it's not in DeviceInfo , but you can try the string_descriptors example which requests the manufacturer, product, and serial strings from the device.

Otherwise, if it's not coming from the device, it might depend on how the driver was installed on that particular computer.

@enbyted
Copy link

enbyted commented Feb 3, 2025

Friendly name in Windows (the DEVPKEY_Device_FriendlyName property) is coming from the registry.
For winusb driver it can be set with the resgistry descriptor in the MSOS descriptor. (of that I'm 95% sure - never tried it).

You can change it after the device is first inserted and it will be persisted (i.e. Windows will not change it back automatically). It's useful for when you have ex. 2 identical webcams plugged in - it's the only easy way of differentiating between the devices for the user.

I don't know how this is handled in other OSes.

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

Successfully merging this pull request may close these issues.

3 participants