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

Need to access device's friendly name #11

Open
jporcher opened this issue Dec 7, 2022 · 7 comments
Open

Need to access device's friendly name #11

jporcher opened this issue Dec 7, 2022 · 7 comments

Comments

@jporcher
Copy link
Contributor

jporcher commented Dec 7, 2022

Under Windows, I need to access device's friendly name (SetupDiGetDeviceRegistryProperty with property SPDRP_FRIENDLYNAME).

This information is not part of libusbp::device. May it be added to the API? It's probably only available under Windows, I did not check. Would that be an acceptable pull request?

Else, can one retrieve the internal device handle from libusbp::device and later call SetupDiGetDeviceRegistryProperty?

@DavidEGrayson
Copy link
Member

DavidEGrayson commented Dec 7, 2022 via email

@jporcher
Copy link
Contributor Author

jporcher commented Dec 7, 2022

Sure, this can work. However, it would force to enumerate devices again as the API needs handles (OS IS as string won't help).

@jporcher
Copy link
Contributor Author

jporcher commented Dec 7, 2022

Actually, not sure it will work. get_os_id returns me "USB\VID_0403&PID_6001\AR0JFBPE" while SetupDiGetDeviceRegistryProperty with SPDRP_HARDWAREID returns "FTDIBUS\COMPORT&VID_0403&PID_6001". So it's hard to safely determine if that's the same device or not (while it is in my case)

@DavidEGrayson
Copy link
Member

DavidEGrayson commented Dec 7, 2022 via email

@jporcher
Copy link
Contributor Author

jporcher commented Dec 8, 2022

Hi again,

get_os_id() is "USB\VID_0403&PID_6001\AR0JFBPE"

SetupDiGetDeviceInstanceId gives "FTDIBUS\VID_0403+PID_6001+AR0JFBPEA\0000"
GetTextProperty/SPDRP_HARDWAREID gives "FTDIBUS\COMPORT&VID_0403&PID_6001"

So none fits. But this is maybe due to issue #10, looks like libusbp is pointing to "USB serial controller" while WindowsAPI is pointing to "USB serial port (COM8)". Then it's not surprising the names do not match.

@jporcher
Copy link
Contributor Author

jporcher commented Dec 8, 2022

Just tested with a non FTDI device, using SetupDiGetDeviceInstanceId works fine to identify the device while enumerating using SetupAPI.

@DavidEGrayson
Copy link
Member

DavidEGrayson commented Dec 8, 2022

A libusbp::device represents an actual physical device plugged into a USB port, not an interface/service provided by the device, so it is correct that the only libusbp::device there is "USB serial controller" (and the other nodes that are direct children of a USB hub).

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