PDA

View Full Version : HAL & qdbus introspection & InvalidSignature error



juannm
23rd January 2009, 17:29
Hello! I have a little problem with the usage of the introspection XML file generated by HAL and the QDBusAbstractInterface::callWithArgumentList() method, but don't know exactly whether is a Qt problem or a HAL one, let me explain the scenario:

- first, obtain the XML introspection from the "org.freedesktop.Hal.Manager" D-Bus interface:

$ qdbus --system org.freedesktop.Hal /org/freedesktop/Hal/Manager org.freedesktop.DBus.Introspectable.Introspect > Hal.Manager.xml

- second, use the XML file to obtain a C++ Qt class proxy in order to have an easy way of using the various methods of the Hal.Manager interface:

$ qdbusxml2cpp -c QHalManagerInterface -N -p QHalManagerInterface Hal.Manager.xml org.freedesktop.Hal.Manager
This generates the cpp and h files for the class "QHalManagerInterface". Now it's time to use this class in our code.

- third, integrate the generated class in the code: create an instance of QHalManagerInterface, and call any of its methods. For example:


QHalManagerInterface* iface;
QDBusConnection system = QDBusConnection::systemBus();
if (system.isConnected()) {
iface = new QHalManagerInterface("org.freedesktop.Hal", "/org/freedesktop/Hal/Manager", system, this);
if (iface && iface->isValid()) {
/* We see in the auto-generated QHalManagerInterface.h that the method
* GetAllDevices() returns a QDBusReply<QList<QDBusObjectPath> > */
QDBusReply<QList<QDBusObjectPath> > reply = iface->GetAllDevices();
if (reply.isValid()) {
foreach(QDBusObjectPath udi, reply.value()) {
qDebug() << "Found the device:" << udi.path();
}
}
else {
qDebug() << QString("D-Bus error: %1: %2").arg(reply.error.name()).arg(reply.error.message( ));
}
}
}


Then you obtain the following in the console:

D-Bus error: org.freedesktop.DBus.Error.InvalidSignature: Unexpected reply signature: got "no signature", expected "" (QList<QDBusObjectPath>)

BUT, it all works by changing the type of return of the GetAllDevices() method, from QDBusReply<QList<QDBusObjectPath> > to QDBusReply<QStringList>.

So maybe QDBusReply is failing to adapt the signature of the "org.freedesktop.Hal.Manager.GetAllDevices" (which HAL claims to be "ao", an "array of objectpaths"), or maybe the problem is HAL claiming the method interface as "ao" but then expecting to be "as" at runtime?

juannm
3rd February 2009, 13:00
Any thoughts about this?
Currently I'm just editing the XML, and changing the "ao" ("array of objectpaths) parameter occurences with "as" (arry of strings). After that, all works as expected.

juannm
6th February 2009, 18:59
Well ok, it seems to be a bug in HAL, I think this bug report is about the same problem as the one I described:

http://www.qtsoftware.com/developer/task-tracker/index_html?method=entry&id=190546