mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
solid: return QByteArray object from UdevQt::Device::subsystem()
it is handled as latin1 anyway Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
d69e5328dd
commit
35241fbc27
5 changed files with 20 additions and 20 deletions
|
@ -103,7 +103,7 @@ Solid::AudioInterface::SoundcardType UdevAudioInterfacePrivate::soundcardType()
|
|||
}
|
||||
else
|
||||
{
|
||||
QString busName = parentDevice.subsystem();
|
||||
QByteArray busName = parentDevice.subsystem();
|
||||
QString driverName = parentDevice.driver();
|
||||
if (busName == "ieee1394")
|
||||
{
|
||||
|
|
|
@ -75,7 +75,7 @@ QString UDevDevice::parentUdi() const
|
|||
// code in several places expects the parent to NOT be the actual parent (disk) device UDI even
|
||||
// for partitions but another device UDI related to this device, has to be fixed and verified
|
||||
// to work at some point
|
||||
if (m_device.subsystem() == QLatin1String("block") || idcdrom == 1) {
|
||||
if (m_device.subsystem() == "block" || idcdrom == 1) {
|
||||
return devicePath();
|
||||
}
|
||||
|
||||
|
@ -531,13 +531,13 @@ bool UDevDevice::queryDeviceInterface(const Solid::DeviceInterface::Type &type)
|
|||
case Solid::DeviceInterface::StorageAccess:
|
||||
case Solid::DeviceInterface::StorageDrive:
|
||||
case Solid::DeviceInterface::StorageVolume: {
|
||||
return m_device.subsystem() == QLatin1String("block");
|
||||
return m_device.subsystem() == "block";
|
||||
}
|
||||
|
||||
case Solid::DeviceInterface::AcAdapter: {
|
||||
const QString powersupplytype = deviceProperty("POWER_SUPPLY_TYPE").toLower();
|
||||
return (
|
||||
m_device.subsystem() == QLatin1String("power_supply")
|
||||
m_device.subsystem() == "power_supply"
|
||||
&& (powersupplytype == QLatin1String("mains")
|
||||
|| powersupplytype.contains(QLatin1String("ups")))
|
||||
);
|
||||
|
@ -545,7 +545,7 @@ bool UDevDevice::queryDeviceInterface(const Solid::DeviceInterface::Type &type)
|
|||
case Solid::DeviceInterface::Battery: {
|
||||
const QString powersupplytype = deviceProperty("POWER_SUPPLY_TYPE").toLower();
|
||||
return (
|
||||
m_device.subsystem() == QLatin1String("power_supply") &&
|
||||
m_device.subsystem() == "power_supply" &&
|
||||
(powersupplytype == QLatin1String("battery")
|
||||
|| powersupplytype.contains(QLatin1String("usb")))
|
||||
);
|
||||
|
@ -570,13 +570,13 @@ bool UDevDevice::queryDeviceInterface(const Solid::DeviceInterface::Type &type)
|
|||
return !deviceProperty("MAJOR").isEmpty();
|
||||
|
||||
case Solid::DeviceInterface::Video:
|
||||
return m_device.subsystem() == QLatin1String("video4linux");
|
||||
return m_device.subsystem() == "video4linux";
|
||||
|
||||
case Solid::DeviceInterface::AudioInterface:
|
||||
return m_device.subsystem() == QLatin1String("sound");
|
||||
return m_device.subsystem() == "sound";
|
||||
|
||||
case Solid::DeviceInterface::NetworkInterface:
|
||||
return m_device.subsystem() == QLatin1String("net");
|
||||
return m_device.subsystem() == "net";
|
||||
|
||||
case Solid::DeviceInterface::Button:
|
||||
return deviceProperty("ID_INPUT_KEY").toInt() == 1;
|
||||
|
|
|
@ -97,31 +97,31 @@ bool UDevManager::Private::checkOfInterest(const UdevQt::Device &device)
|
|||
qDebug() << "Subsystem:" << device.subsystem();
|
||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
|
||||
#endif
|
||||
if (device.subsystem() == QLatin1String("block")) {
|
||||
if (device.subsystem() == "block") {
|
||||
return !device.deviceProperty("ID_FS_TYPE").isEmpty();
|
||||
}
|
||||
|
||||
if (device.subsystem() == QLatin1String("power_supply")) {
|
||||
if (device.subsystem() == "power_supply") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (device.driver() == QLatin1String("processor")) {
|
||||
if (device.driver() == "processor") {
|
||||
// Linux ACPI reports processor slots, rather than processors.
|
||||
// Empty slots will not have a system device associated with them.
|
||||
QDir sysfsDir(device.sysfsPath());
|
||||
return (sysfsDir.exists("sysdev") || sysfsDir.exists("cpufreq") || sysfsDir.exists("topology/core_id"));
|
||||
}
|
||||
if (device.subsystem() == QLatin1String("sound") &&
|
||||
if (device.subsystem() == "sound" &&
|
||||
device.deviceProperty("SOUND_FORM_FACTOR") != "internal") {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (device.subsystem() == QLatin1String("pci")) {
|
||||
if (device.subsystem() == "pci") {
|
||||
const QString pciclass = device.deviceProperty("PCI_CLASS");
|
||||
return (pciclass == QLatin1String("30000")); // VGA controller
|
||||
}
|
||||
|
||||
if (device.subsystem() == QLatin1String("input")) {
|
||||
if (device.subsystem() == "input") {
|
||||
const QStringList deviceProperties = device.deviceProperties();
|
||||
// key
|
||||
if (device.deviceProperty("ID_INPUT_KEY").toInt() == 1
|
||||
|
@ -137,8 +137,8 @@ bool UDevManager::Private::checkOfInterest(const UdevQt::Device &device)
|
|||
return false;
|
||||
}
|
||||
|
||||
return device.subsystem() == QLatin1String("video4linux") ||
|
||||
device.subsystem() == QLatin1String("net") ||
|
||||
return device.subsystem() == "video4linux" ||
|
||||
device.subsystem() == "net" ||
|
||||
device.deviceProperty("ID_MEDIA_PLAYER").toInt() == 1 || // media-player-info recognized devices
|
||||
(device.deviceProperty("ID_GPHOTO2").toInt() == 1 && device.parent().deviceProperty("ID_GPHOTO2").toInt() != 1); // GPhoto2 cameras
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
Device &operator= (const Device &other);
|
||||
|
||||
bool isValid() const;
|
||||
QString subsystem() const;
|
||||
QByteArray subsystem() const;
|
||||
QString devType() const;
|
||||
QString name() const;
|
||||
QString sysfsPath() const;
|
||||
|
|
|
@ -69,12 +69,12 @@ bool Device::isValid() const
|
|||
return (m_device != nullptr);
|
||||
}
|
||||
|
||||
QString Device::subsystem() const
|
||||
QByteArray Device::subsystem() const
|
||||
{
|
||||
if (!m_device) {
|
||||
return QString();
|
||||
return QByteArray();
|
||||
}
|
||||
return QString::fromLatin1(udev_device_get_subsystem(m_device));
|
||||
return QByteArray(udev_device_get_subsystem(m_device));
|
||||
}
|
||||
|
||||
QString Device::devType() const
|
||||
|
|
Loading…
Add table
Reference in a new issue