[udev] Read property on UdevDevice

remotes/origin/Plasma/5.4
Martin Gräßlin 11 years ago
parent 2a64755b76
commit cf27a056b8
  1. 17
      udev.cpp
  2. 2
      udev.h

@ -189,4 +189,21 @@ int UdevDevice::sysNum() const
return QByteArray(udev_device_get_sysnum(m_device)).toInt();
}
const char *UdevDevice::property(const char *key)
{
if (!m_device) {
return nullptr;
}
return udev_device_get_property_value(m_device, key);
}
bool UdevDevice::hasProperty(const char *key, const char *value)
{
const char *p = property(key);
if (!p) {
return false;
}
return qstrcmp(p, value) == 0;
}
}

@ -37,6 +37,8 @@ public:
udev_device *getParentWithSubsystemDevType(const char *subsystem, const char *devtype = nullptr) const;
const char *devNode();
int sysNum() const;
const char *property(const char *key);
bool hasProperty(const char *key, const char *value);
operator udev_device*() const {
return m_device;

Loading…
Cancel
Save