Windows use iManufacturer/iProduct for manufacturer/description
On Windows, in order to make sure that devices can use the standard
built-in CDC device, but still be able to differentiate between one CDC
device to the next, it is necessary to report the iManufacturer and
iProduct strings back to the caller rather than the driver manufacturer
and description.
This change does two things:
1 - Makes the description and manufacturer reported by Qt the same on
Windows and Linux, so cross-platform software can rely on the same
behavior.
2 - Uses the iManufacturer string for reported manufacturer, and the
iProduct string for the description.
Windows makes this difficult, so the logic is a bit convoluted, but we
do the following:
- Make sure the device we're getting this info for is a USB device
- Walk up the device tree (past composite devices) until we find a USB
hub
- Get the port on that hub that our device uses.
- Use the combination of the hub and the port to fetch the iManufacturer
and iProduct strings.
[ChangeLog][Important Behavior Changes][Windows] Make Windows use USB
iManufacturer for the returned Manufacturer in
QSerialPortInfo::availablePorts() and USB iProduct for the the
returned description also in availablePorts(). This makes Windows and
Linux report the same information for both fields.
Fixes: QTBUG-128487
Pick-to: 6.8
Change-Id: I56c2dac29b1ff657bb645811c6f78b7d2c710b50
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>