Commit e672faca authored by Lamarque Souza's avatar Lamarque Souza
Browse files

Fill in vendor and model names using Solid's udev backend when possible.

REVIEW: 101270
(cherry picked from commit fdf93b29)
parent a944a097
......@@ -71,12 +71,15 @@ QString UDevDevice::vendor() const
vendor = m_device.deviceProperty("ID_VENDOR").toString().replace('_', " ");
} else if (queryDeviceInterface(Solid::DeviceInterface::NetworkInterface)) {
vendor = m_device.deviceProperty("ID_VENDOR_FROM_DATABASE").toString();
}
else if (queryDeviceInterface(Solid::DeviceInterface::AudioInterface)) {
} else if (queryDeviceInterface(Solid::DeviceInterface::AudioInterface)) {
if (m_device.parent().isValid()) {
vendor = m_device.parent().deviceProperty("ID_VENDOR_FROM_DATABASE").toString();
}
}
if (vendor.isEmpty()) {
vendor = m_device.deviceProperty("ID_VENDOR").toString().replace('_', ' ');
}
}
return vendor;
}
......@@ -111,6 +114,10 @@ QString UDevDevice::product() const
product.append(QLatin1String("USB Serial Port"));
}
}
if (product.isEmpty()) {
product = m_device.deviceProperty("ID_MODEL").toString().replace('_', ' ');
}
}
return product;
}
......
......@@ -191,7 +191,7 @@ QObject *UDevManager::createDevice(const QString &udi_)
}
const QString udi = udi_.right(udi_.size() - udiPrefix().size());
UdevQt::Device device = d->m_client->deviceBySysfsPath(udi);
if (d->isOfInterest(device)) {
if (d->isOfInterest(device) || QFile::exists(udi)) {
return new UDevDevice(device);
}
return 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment