+ if (device->connection_id().length() > 0)
+ parts.push_back("("+device->connection_id()+")");
+
+ for (size_t i = 0; i < parts.size(); i++)
+ {
+ if (parts[i].length() > 0)
+ {
+ if (i != 0)
+ s << " ";
+ s << parts[i];
+ }
+ }
+
+ full_names_[device] = s.str();
+
+ // Next, build the display name. It only contains fields as required.
+ bool multiple_dev = false;
+
+ // If we can find another device with the same model/vendor then
+ // we have at least two such devices and need to distinguish them.
+ if (hardware_device)
+ multiple_dev = any_of(devices_.begin(), devices_.end(),
+ [&](shared_ptr<HardwareDevice> dev) {
+ return (dev->vendor() == hardware_device->vendor() &&
+ dev->model() == hardware_device->model()) &&
+ dev != hardware_device;
+ } );
+
+ s.str("");
+ parts.clear();
+ parts = {device->vendor(), device->model()};
+
+ if (multiple_dev) {
+ parts.push_back(device->version());
+ parts.push_back(device->serial_number());
+
+ if ((device->serial_number().length() == 0) &&
+ (device->connection_id().length() > 0))
+ parts.push_back("("+device->connection_id()+")");
+ }
+