From kde-commits Wed Aug 20 21:05:30 2008 From: Matthias Kretz Date: Wed, 20 Aug 2008 21:05:30 +0000 To: kde-commits Subject: branches/KDE/4.1/kdelibs/solid/solid/backends/hal Message-Id: <1219266330.364182.17757.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=121926633905556 SVN commit 850151 by mkretz: backport: I didn't realize HalAudioInterface needed the fix for handling the incompatibility in HAL, too. Now, in order to find out what type of soundcard it is, don't look at the direct parent device object but the parent of the parent instead (for newer HAL only). Finally my USB device is detected as such again. M +13 -3 halaudiointerface.cpp --- branches/KDE/4.1/kdelibs/solid/solid/backends/hal/halaudiointerface.cpp #850150:850151 @@ -20,6 +20,7 @@ #include "halaudiointerface.h" #include "haldevice.h" +#include using namespace Solid::Backends::Hal; @@ -161,9 +162,18 @@ return m_soundcardType; } - if (! m_device->parentUdi().isEmpty()) - { - HalDevice parentDevice(m_device->parentUdi()); + QString parentUdi = m_device->parentUdi(); + if (!parentUdi.isEmpty()) { + QDBusInterface parentIface(QLatin1String("org.freedesktop.Hal"), m_device->parentUdi(), "org.freedesktop.Hal.Device", QDBusConnection::systemBus()); + const QDBusMessage &reply = parentIface.call("GetProperty", QLatin1String("info.subsystem")); + if (reply.type() != QDBusMessage::ReplyMessage && reply.errorName() == "org.freedesktop.Hal.NoSuchProperty") { + const QDBusMessage &reply2 = parentIface.call("GetProperty", QLatin1String("info.parent")); + if (reply2.type() == QDBusMessage::ReplyMessage) { + parentUdi = reply2.arguments().at(0).toString(); + } + } + + HalDevice parentDevice(parentUdi); QString productName = parentDevice.product(); QString deviceName = name(); if (productName.contains("headset", Qt::CaseInsensitive) ||