SOURCES: kde4-kdebase-workspace-solid-bluetooth.patch (NEW) - fix solid blu...

shadzik shadzik at pld-linux.org
Wed Feb 4 14:27:34 CET 2009


Author: shadzik                      Date: Wed Feb  4 13:27:34 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fix solid bluetooth to get kbluetooth4 working

---- Files affected:
SOURCES:
   kde4-kdebase-workspace-solid-bluetooth.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/kde4-kdebase-workspace-solid-bluetooth.patch
diff -u /dev/null SOURCES/kde4-kdebase-workspace-solid-bluetooth.patch:1.1
--- /dev/null	Wed Feb  4 14:27:35 2009
+++ SOURCES/kde4-kdebase-workspace-solid-bluetooth.patch	Wed Feb  4 14:27:29 2009
@@ -0,0 +1,1210 @@
+--- bluez-bluetoothinterface.cpp	(.../branches/KDE/4.2/kdebase/workspace/solid/bluez)	(revision 912529)
++++ solid/bluez/bluez-bluetoothinterface.cpp	(.../trunk/KDE/kdebase/workspace/solid/bluez)	(revision 912529)
+@@ -25,6 +25,7 @@
+ #include <solid/control/bluetoothinterface.h>
+ 
+ #include "bluez-bluetoothremotedevice.h"
++#include "bluez-bluetoothinputdevice.h"
+ #include <KDebug>
+ 
+ 
+@@ -43,6 +44,7 @@
+     QString objectPath;
+ 
+     QMap<QString, BluezBluetoothRemoteDevice *> devices;
++    QMap<QString, BluezBluetoothInputDevice *> inputDevices;
+ };
+ 
+ 
+@@ -56,23 +58,6 @@
+                                    objectPath, \
+                                    "org.bluez.Adapter", \
+                                    signal, this, SLOT(slot));
+-/*  
+-    connectInterfaceToThis("ModeChanged", slotModeChanged(const QString &));
+-    connectInterfaceToThis("DiscoverableTimeoutChanged", slotDiscoverableTimeoutChanged(int));
+-    connectInterfaceToThis("MinorClassChanged", slotMinorClassChanged(const QString &));
+-    connectInterfaceToThis("NameChanged", slotNameChanged(const QString &));
+-    connectInterfaceToThis("DiscoveryStarted", slotDiscoveryStarted());
+-    connectInterfaceToThis("DiscoveryCompleted", slotDiscoveryCompleted());
+-    connectInterfaceToThis("RemoteDeviceDisappeared", slotRemoteDeviceDisappeared(const QString &));
+-    connectInterfaceToThis("RemoteDeviceFound", slotRemoteDeviceFound(const QString &, uint, short));
+-    connectInterfaceToThis("RemoteNameUpdated", slotRemoteNameUpdated(const QString &, const QString &));
+-    connectInterfaceToThis("RemoteDeviceConnected", slotRemoteDeviceConnected(const QString &));
+-    connectInterfaceToThis("RemoteDeviceDisconnected", slotRemoteDeviceDisconnected(const QString &));
+-    connectInterfaceToThis("TrustAdded", slotTrustAdded(const QString &));
+-    connectInterfaceToThis("TrustRemoved", slotTrustRemoved(const QString &));
+-    connectInterfaceToThis("BondingCreated", slotBondingCreated(const QString &));
+-    connectInterfaceToThis("BondingRemoved", slotBondingRemoved(const QString &));
+-*/
+ 
+     connectInterfaceToThis("PropertyChanged", slotPropertyChanged(const QString &, const QVariant &));
+     connectInterfaceToThis("DeviceCreated", slotDeviceCreated(const QDBusObjectPath &));
+@@ -98,21 +83,14 @@
+     d->iface.call("CancelDeviceCreation",addr);
+ }
+ 
+-QString BluezBluetoothInterface::createDevice(const QString &addr) const
++void BluezBluetoothInterface::createDevice(const QString &addr) const
+ {
+-    QDBusObjectPath path = objectReply("CreateDevice",addr);
+-    return path.path();
++    d->iface.call("CreateDevice",addr);
+ }
+ 
+-QString BluezBluetoothInterface::createPairedDevice(const QString &addr, const QString &agentUBI, const QString &capab) const
++void BluezBluetoothInterface::createPairedDevice(const QString &addr, const QString &agentUBI, const QString &capab) const
+ {
+-    QDBusReply< QDBusObjectPath > reply;
+-    reply = d->iface.call("CreatePairedDevice",addr,agentUBI,capab);
+-
+-    if (!reply.isValid()) {
+-        return QString();
+-    }
+-    return reply.value().path();
++    d->iface.call("CreatePairedDevice",addr,qVariantFromValue(QDBusObjectPath(agentUBI)),capab);
+ }
+ 
+ QString BluezBluetoothInterface::findDevice(const QString &addr) const
+@@ -147,7 +125,7 @@
+ 
+ void BluezBluetoothInterface::registerAgent(const QString &agentUBI, const QString &capab)
+ {
+-    d->iface.call("RegisterAgent",agentUBI,capab);
++    d->iface.call("RegisterAgent",qVariantFromValue(QDBusObjectPath(agentUBI)),capab);
+ }
+ 
+ void BluezBluetoothInterface::releaseSession()
+@@ -157,7 +135,7 @@
+ 
+ void BluezBluetoothInterface::removeDevice(const QString &deviceUBI )
+ {
+-    d->iface.call("RemoveDevice",deviceUBI);
++    d->iface.call("RemoveDevice",qVariantFromValue(QDBusObjectPath(deviceUBI)));
+ }
+ 
+ void BluezBluetoothInterface::requestSession()
+@@ -183,305 +161,20 @@
+ 
+ void BluezBluetoothInterface::unregisterAgent(const QString &agentUBI)
+ {
+-    d->iface.call("UnregisterAgent",agentUBI);
++    d->iface.call("UnregisterAgent",qVariantFromValue(QDBusObjectPath(agentUBI)));
+ }
+ 
+ 
+ 
+-/*
+-
+-QString BluezBluetoothInterface::address() const
++void BluezBluetoothInterface::slotDeviceCreated(const QDBusObjectPath &path)
+ {
+-    return stringReply("GetAddress");
+-}
++    kDebug() << "device created";
+ 
+-QString BluezBluetoothInterface::version() const
+-{
+-    return stringReply("GetVersion");
+-}
+-
+-QString BluezBluetoothInterface::revision() const
+-{
+-    return stringReply("GetRevision");
+-}
+-
+-QString BluezBluetoothInterface::manufacturer() const
+-{
+-    return stringReply("GetManufacturer");
+-}
+-
+-QString BluezBluetoothInterface::company() const
+-{
+-    return stringReply("GetCompany");
+-}
+-
+-Solid::Control::BluetoothInterface::Mode BluezBluetoothInterface::mode() const
+-{
+-    QString theMode = stringReply("GetMode");
+-    Solid::Control::BluetoothInterface::Mode modeEnum;
+-    if (theMode == "connectable")
+-    {
+-        modeEnum = Solid::Control::BluetoothInterface::Connectable;
++    if (!d->devices.contains(path.path())) {
++        BluezBluetoothRemoteDevice* bluetoothRemoteDev = new BluezBluetoothRemoteDevice(path.path());
++        d->devices.insert(path.path(), bluetoothRemoteDev);
+     }
+-    else if (theMode == "discoverable")
+-    {
+-        modeEnum = Solid::Control::BluetoothInterface::Discoverable;
+-    } else {
+-        Q_ASSERT(theMode == "off");
+-        modeEnum = Solid::Control::BluetoothInterface::Off;
+-    }
+-    return modeEnum;
+-}
+ 
+-int BluezBluetoothInterface::discoverableTimeout() const
+-{
+-    QDBusReply< uint > timeout = d->iface.call("GetDiscoverableTimeout");
+-    if (timeout.isValid()) {
+-        return timeout.value();
+-    }
+-
+-    return -1;
+-}
+-
+-bool BluezBluetoothInterface::isDiscoverable() const
+-{
+-    return boolReply("IsDiscoverable");
+-}
+-
+-QStringList BluezBluetoothInterface::listConnections() const
+-{
+-    QStringList list = listReply("ListConnections");
+-    for (int i = 0; i < list.size(); i++) {
+-        list[i] = ubi() + '/' + list[i];
+-    }
+-    return list;
+-}
+-
+-QString BluezBluetoothInterface::majorClass() const
+-{
+-    return stringReply("GetMajorClass");
+-}
+-
+-QStringList BluezBluetoothInterface::listAvailableMinorClasses() const
+-{
+-    return listReply("ListAvailableMinorClasses");
+-}
+-
+-QString BluezBluetoothInterface::minorClass() const
+-{
+-    return stringReply("GetMinorClass");
+-}
+-
+-QStringList BluezBluetoothInterface::serviceClasses() const
+-{
+-    return listReply("GetServiceClasses");
+-}
+-
+-QString BluezBluetoothInterface::name() const
+-{
+-    return stringReply("GetName");
+-}
+-
+-QString BluezBluetoothInterface::getRemoteName(const QString &mac)
+-{
+-    return stringReply("GetRemoteName",mac);
+-}
+-
+-bool BluezBluetoothInterface::isTrusted(const QString &mac)
+-{
+-   return boolReply("IsTrusted",mac);
+-}
+-
+-QStringList BluezBluetoothInterface::listBondings() const
+-{
+-    return listReply("ListBondings");
+-}
+-
+-bool BluezBluetoothInterface::isPeriodicDiscoveryActive() const
+-{
+-    return boolReply("IsPeriodicDiscovery");
+-}
+-
+-bool BluezBluetoothInterface::isPeriodicDiscoveryNameResolvingActive() const
+-{
+-    return boolReply("IsPeriodicDiscoveryNameResolving");
+-}
+-
+-QStringList BluezBluetoothInterface::listRemoteDevices() const
+-{
+-    QStringList list = listReply("ListRemoteDevices");
+-    for (int i = 0; i < list.size(); i++) {
+-        list[i] = ubi() + '/' + list[i];
+-    }
+-    return list;
+-}
+-
+-QStringList BluezBluetoothInterface::listRecentRemoteDevices(const QDateTime &) const
+-{
+-    return listReply("ListRecentRemoteDevices");
+-}
+-
+-void BluezBluetoothInterface::setMode(const Solid::Control::BluetoothInterface::Mode mode)
+-{
+-    QString modeString;
+-    switch(mode)
+-    {
+-    case Solid::Control::BluetoothInterface::Off:
+-        modeString = "off";
+-        break;
+-    case Solid::Control::BluetoothInterface::Discoverable:
+-        modeString = "discoverable";
+-        break;
+-    case Solid::Control::BluetoothInterface::Connectable:
+-        modeString = "connectable";
+-        break;
+-    }
+-    d->iface.call("SetMode", modeString);
+-}
+-
+-void BluezBluetoothInterface::setDiscoverableTimeout(int timeout)
+-{
+-    d->iface.call("SetDiscoverableTimeout", (uint)timeout);
+-}
+-
+-void BluezBluetoothInterface::setMinorClass(const QString &minorClass)
+-{
+-    d->iface.call("SetMinorClass", minorClass);
+-}
+-
+-void BluezBluetoothInterface::setName(const QString &name)
+-{
+-    d->iface.call("SetName", name);
+-}
+-
+-void BluezBluetoothInterface::discoverDevices()
+-{
+-    d->iface.call("DiscoverDevices");
+-}
+-
+-void BluezBluetoothInterface::discoverDevicesWithoutNameResolving()
+-{
+-    d->iface.call("DiscoverDevicesWithoutNameResolving");
+-}
+-
+-void BluezBluetoothInterface::cancelDiscovery()
+-{
+-    d->iface.call("CancelDiscovery");
+-}
+-
+-void BluezBluetoothInterface::startPeriodicDiscovery()
+-{
+-    d->iface.call("StartPeriodicDiscovery");
+-}
+-
+-void BluezBluetoothInterface::stopPeriodicDiscovery()
+-{
+-    d->iface.call("StopPeriodicDiscovery");
+-}
+-
+-void BluezBluetoothInterface::setPeriodicDiscoveryNameResolving(bool nameResolving)
+-{
+-    d->iface.call("SetPeriodicDiscoveryNameResolving", nameResolving);
+-}
+-
+-void BluezBluetoothInterface::setTrusted(const QString& mac)
+-{
+-    d->iface.call("SetTrusted", mac);
+-}
+-
+-void BluezBluetoothInterface::removeTrust(const QString& mac)
+-{
+-    d->iface.call("RemoveTrust", mac);
+-}
+-
+-*/
+-
+-
+-
+-/*
+-
+-void BluezBluetoothInterface::slotModeChanged(const Solid::Control::BluetoothInterface::Mode mode)
+-{
+-    emit modeChanged(mode);
+-}
+-
+-void BluezBluetoothInterface::slotDiscoverableTimeoutChanged(int timeout)
+-{
+-    emit discoverableTimeoutChanged(timeout);
+-}
+-
+-void BluezBluetoothInterface::slotMinorClassChanged(const QString &minorClass)
+-{
+-    emit minorClassChanged(minorClass);
+-}
+-
+-void BluezBluetoothInterface::slotNameChanged(const QString &name)
+-{
+-    emit nameChanged(name);
+-}
+-
+-void BluezBluetoothInterface::slotDiscoveryStarted()
+-{
+-    emit discoveryStarted();
+-}
+-
+-void BluezBluetoothInterface::slotDiscoveryCompleted()
+-{
+-    emit discoveryCompleted();
+-}
+-
+-void BluezBluetoothInterface::slotRemoteDeviceFound(const QString &address, uint deviceClass, short rssi)
+-{
+-    QString remoteubi = QString("%1/%2").arg(ubi()).arg(address);
+-    emit remoteDeviceFound(remoteubi, deviceClass, rssi);
+-}
+-
+-void BluezBluetoothInterface::slotRemoteDeviceDisappeared(const QString &address)
+-{
+-    QString remoteubi = QString("%1/%2").arg(ubi()).arg(address);
+-    emit remoteDeviceDisappeared(remoteubi);
+-}
+-
+-void BluezBluetoothInterface::slotRemoteNameUpdated(const QString &address, const QString& name)
+-{
+-   emit remoteNameUpdated(address,name);
+-}
+-
+-void BluezBluetoothInterface::slotRemoteDeviceConnected(const QString &address)
+-{
+-   emit remoteDeviceConnected(address);
+-}
+-
+-void BluezBluetoothInterface::slotRemoteDeviceDisconnected(const QString &address)
+-{
+-   emit remoteDeviceDisconnected(address);
+-}
+-
+-void BluezBluetoothInterface::slotTrustAdded(const QString &address)
+-{
+-   emit trustAdded(address);
+-}
+-
+-void BluezBluetoothInterface::slotTrustRemoved(const QString &address)
+-{
+-   emit trustRemoved(address);
+-}
+-
+-void BluezBluetoothInterface::slotBondingCreated(const QString &address)
+-{
+-   emit bondingCreated(address);
+-}
+-
+-void BluezBluetoothInterface::slotBondingRemoved(const QString &address)
+-{
+-   emit bondingRemoved(address);
+-}
+-
+-*/
+-
+-void BluezBluetoothInterface::slotDeviceCreated(const QDBusObjectPath &path)
+-{
+-    kDebug() << "device created";
+     emit deviceCreated(path.path());
+ }
+ 
+@@ -523,7 +216,20 @@
+     return bluetoothInterface;
+ }
+ 
++QObject *BluezBluetoothInterface::createBluetoothInputDevice(const QString &ubi)
++{
++    BluezBluetoothInputDevice *bluetoothInputDev;
++    if (d->inputDevices.contains(ubi)) {
++        bluetoothInputDev = d->inputDevices[ubi];
++    } else {
++        bluetoothInputDev = new BluezBluetoothInputDevice(ubi);
++        d->inputDevices.insert(ubi, bluetoothInputDev);
++    }
++    return bluetoothInputDev;
++}
+ 
++
++
+ /******************* DBus Calls *******************************/
+ 
+ QStringList BluezBluetoothInterface::listReply(const QString &method) const
+@@ -574,10 +280,13 @@
+ 
+     if (param.isEmpty())
+ 	    reply = d->iface.call(method);
+-    else
++    else {
++            qDebug() << "ObjectReply calling: " << method << " " << param;
+ 	    reply = d->iface.call(method, param);
++    }
+ 	    	
+     if (reply.isValid()) {
++        qDebug() << "ObjectReply Valid? "<<  reply.value().path();
+         return reply.value();
+     }
+ 
+Index: bluez-bluetoothinterface.h
+===================================================================
+--- bluez-bluetoothinterface.h	(.../branches/KDE/4.2/kdebase/workspace/solid/bluez)	(revision 912529)
++++ solid/bluez/bluez-bluetoothinterface.h	(.../trunk/KDE/kdebase/workspace/solid/bluez)	(revision 912529)
+@@ -27,6 +27,7 @@
+ #include <QtDBus>
+ #include <QDBusVariant>
+ #include <QDBusObjectPath>
++#include <QString>
+ 
+ #include <solid/control/ifaces/bluetoothinterface.h>
+ 
+@@ -42,34 +43,11 @@
+     BluezBluetoothInterface(const QString  & objectPath);
+     virtual ~BluezBluetoothInterface();
+     QString ubi() const;
+-/*
+-    QString address() const;
+-    QString version() const;
+-    QString revision() const;
+-    QString manufacturer() const;
+-    QString company() const;
+-    Solid::Control::BluetoothInterface::Mode mode() const;
+-    int discoverableTimeout() const;
+-    bool isDiscoverable() const;
+-    QStringList listConnections() const;
+-    QString majorClass() const;
+-    QStringList listAvailableMinorClasses() const;
+-    QString minorClass() const;
+-    QStringList serviceClasses() const;
+-    QString name() const;
+-    QStringList listBondings() const;
+-    bool isPeriodicDiscoveryActive() const;
+-    bool isPeriodicDiscoveryNameResolvingActive() const;
+-    QStringList listRemoteDevices() const;
+-    QStringList listRecentRemoteDevices(const QDateTime &) const;
+-    QString getRemoteName(const QString &);
+-    bool isTrusted(const QString &);
+-
+-*/    
++    
+     QObject *createBluetoothRemoteDevice(const QString &);
+-
+-    QString createDevice(const QString &) const;
+-    QString createPairedDevice(const QString &,const QString &,const QString &) const;
++    QObject *createBluetoothInputDevice(const QString &);
++    void createDevice(const QString &) const;
++    void createPairedDevice(const QString &,const QString &,const QString &) const;
+     QString findDevice(const QString &) const;
+     QMap< QString, QVariant > getProperties() const;
+     QStringList listDevices() const;
+@@ -87,36 +65,6 @@
+     void stopDiscovery();
+     void unregisterAgent(const QString &);
+ 
+-/*
+-    void setMode(const Solid::Control::BluetoothInterface::Mode);
+-    void setDiscoverableTimeout(int);
+-    void setMinorClass(const QString &);
+-    void setName(const QString &);
+-    void discoverDevices();
+-    void discoverDevicesWithoutNameResolving();
+-    void cancelDiscovery();
+-    void startPeriodicDiscovery();
+-    void stopPeriodicDiscovery();
+-    void setPeriodicDiscoveryNameResolving(bool);
+-    void setTrusted(const QString &);
+-    void removeTrust(const QString &);
+-
+-    void slotModeChanged(const Solid::Control::BluetoothInterface::Mode mode);
+-    void slotDiscoverableTimeoutChanged(int timeout);
+-    void slotMinorClassChanged(const QString &minor);
+-    void slotNameChanged(const QString &name);
+-    void slotDiscoveryStarted();
+-    void slotDiscoveryCompleted();
+-    void slotRemoteDeviceFound(const QString &ubi, uint deviceClass, short rssi);
+-    void slotRemoteDeviceDisappeared(const QString &ubi);
+-    void slotRemoteNameUpdated(const QString &, const QString &);
+-    void slotRemoteDeviceConnected(const QString&);
+-    void slotRemoteDeviceDisconnected(const QString&);
+-    void slotTrustAdded(const QString&);
+-    void slotTrustRemoved(const QString&);
+-    void slotBondingCreated(const QString&);
+-    void slotBondingRemoved(const QString&);
+-*/    
+     void slotDeviceCreated(const QDBusObjectPath &);
+     void slotDeviceDisappeared(const QString &);
+     void slotDeviceFound(const QString &, const QMap< QString, QVariant > &);
+Index: bluez-bluetoothmanager.cpp
+===================================================================
+--- bluez-bluetoothmanager.cpp	(.../branches/KDE/4.2/kdebase/workspace/solid/bluez)	(revision 912529)
++++ solid/bluez/bluez-bluetoothmanager.cpp	(.../trunk/KDE/kdebase/workspace/solid/bluez)	(revision 912529)
+@@ -104,6 +104,7 @@
+ 
+ QString BluezBluetoothManager::defaultInterface() const
+ {
++    kDebug() << "Calling Backend Default Interface";
+     QDBusReply< QDBusObjectPath > path = d->manager.call("DefaultAdapter");
+     if (!path.isValid())
+         return QString();
+@@ -132,6 +133,16 @@
+     return bluetoothInterface;
+ }
+ 
++void BluezBluetoothManager::removeInterface(const QString& ubi)
++{
++
++    if (d->interfaces.contains(ubi)) {
++        kDebug() << "Removing Interface" << ubi;
++        BluezBluetoothInterface * bluetoothInterface = d->interfaces.take(ubi);
++        bluetoothInterface = 0;
++    }
++}
++
+ /*
+ KJob *BluezBluetoothManager::setupInputDevice(const QString &ubi)
+ {
+Index: bluez-bluetoothremotedevice.cpp
+===================================================================
+--- bluez-bluetoothremotedevice.cpp	(.../branches/KDE/4.2/kdebase/workspace/solid/bluez)	(revision 912529)
++++ solid/bluez/bluez-bluetoothremotedevice.cpp	(.../trunk/KDE/kdebase/workspace/solid/bluez)	(revision 912529)
+@@ -42,6 +42,7 @@
+ 	m_adapter = m_objectPath.left(objectPath.size() - 18);
+ 	m_address = m_objectPath.right(17);
+ 
++        kdDebug() << "Connecting to ObjectPath: " << objectPath;
+ 
+ 	device = new QDBusInterface("org.bluez", objectPath,
+ 				    "org.bluez.Device", QDBusConnection::systemBus());
+@@ -79,7 +80,7 @@
+ 
+ void BluezBluetoothRemoteDevice::setProperty(const QString &name, const QVariant &value)
+ {
+-    device->call("SetProperty",name,value);
++    device->call("SetProperty",name,qVariantFromValue(QDBusVariant(value)));
+ }
+ 
+ void BluezBluetoothRemoteDevice::discoverServices(const QString& pattern) const
+Index: bluez-bluetoothmanager.h
+===================================================================
+--- bluez-bluetoothmanager.h	(.../branches/KDE/4.2/kdebase/workspace/solid/bluez)	(revision 912529)
++++ solid/bluez/bluez-bluetoothmanager.h	(.../trunk/KDE/kdebase/workspace/solid/bluez)	(revision 912529)
+@@ -43,6 +43,7 @@
+     virtual ~BluezBluetoothManager();
+     QStringList bluetoothInterfaces() const;
+     QObject * createInterface(const QString &);
++    void removeInterface(const QString& ubi);
+ //  QStringList bluetoothInputDevices() const;
+     QString defaultInterface() const;
+     QString findInterface(const QString &) const;
+diff -Nur -x '[^b][^l]*' -x .svn 4_2libsControl/bluetoothinputdevice.cpp kdebase/workspace/libs/solid/control/bluetoothinputdevice.cpp
+--- 4_2libsControl/bluetoothinputdevice.cpp	2009-01-17 17:51:33.000000000 +0100
++++ libs/solid/control/bluetoothinputdevice.cpp	2009-01-14 21:06:47.000000000 +0100
+@@ -91,8 +91,8 @@
+     FrontendObjectPrivate::setBackendObject(object);
+ 
+     if (object) {
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list