SUMMARY Bluetooth tray applet sometimes doesn't show any devices even if KCM does. Restarting plasmashell makes it work fine. There doesn't seem to be anything directly relevant in Plasmashell logs. STEPS TO REPRODUCE I'm not exactly sure what causes this, I'll try some experiments (turning it off and on) and see if anything consistent emerges. SOFTWARE/OS VERSIONS Operating System: Fedora Linux 39 KDE Plasma Version: 5.81.80 KDE Frameworks Version: 5.245.0 Qt Version: 6.6.0 Kernel Version: 6.5.11-300.fc39.x86_64 (64-bit) Graphics Platform: Wayland Processors: 12 × AMD Ryzen 5 5625U with Radeon Graphics Memory: 7.1 GiB of RAM Graphics Processor: AMD Radeon Graphics
Observation: when this happens and Bluetooth is off at that moment, I don't see the enable switch. I just see the enable button.
OK, I can reproduce it consistently by waking my laptop from suspend (close lid and reopen).
Interestingly it doesn't seem to affect plasmawindowed.
Observing output with kf.bluez debug logs turned on: For plasmawindowed (where it works), the output goes like: kf.bluezqt: Rfkill global state changed: BluezQt::Rfkill::Unblocked kf.bluezqt: Setting usable adapter QSharedPointer(BluezQt::Adapter(0xf5b5b0)) <sleep> kf.bluezqt: Rfkill global state changed: BluezQt::Rfkill::Unblocked kf.bluezqt: Setting usable adapter QSharedPointer(QObject(0x0)) kf.bluezqt: Unhandled property change "org.bluez.Adapter1" QMap(("Class", QVariant(uint, 0))("Discovering", QVariant(bool, false))("PowerState", QVariant(QString, "on"))("Powered", QVariant(bool, false))) QList() kf.bluezqt: Setting usable adapter QSharedPointer(BluezQt::Adapter(0x14ba950)) Notice how a non-null adapter was set. For KCM (where it doesn't), the output is: kf.bluezqt: Rfkill global state changed: BluezQt::Rfkill::Unblocked kf.bluezqt: Setting usable adapter QSharedPointer(BluezQt::Adapter(0x25b8b40)) qt.dbus.integration: Could not connect "org.freedesktop.DBus.ObjectManager" to "InterfacesAdded" <sleep> kf.bluezqt: Rfkill global state changed: BluezQt::Rfkill::Unblocked kf.bluezqt: Setting usable adapter QSharedPointer(QObject(0x0)) kf.bluezqt: Unhandled property change "org.bluez.Adapter1" QMap(("Pairable", QVariant(bool, true))) QList() kf.bluezqt: Unhandled property change "org.bluez.Adapter1" QMap(("UUIDs", QVariant(QStringList, QList("0000110e-0000-1000-8000-00805f9b34fb", "0000111f-0000-1000-8000-00805f9b34fb", "00001200-0000-1000-8000-00805f9b34fb", "00001132-0000-1000-8000-00805f9b34fb", "00001133-0000-1000-8000-00805f9b34fb", "0000110c-0000-1000-8000-00805f9b34fb", "00001800-0000-1000-8000-00805f9b34fb", "0000112f-0000-1000-8000-00805f9b34fb", "00001801-0000-1000-8000-00805f9b34fb", "00001106-0000-1000-8000-00805f9b34fb", "0000180a-0000-1000-8000-00805f9b34fb", "00001104-0000-1000-8000-00805f9b34fb", "0000111e-0000-1000-8000-00805f9b34fb", "00001105-0000-1000-8000-00805f9b34fb", "00005005-0000-1000-8000-0002ee000001")))) QList() [lots more lines] A non-null adapter was never set again. I wonder if `qt.dbus.integration: Could not connect "org.freedesktop.DBus.ObjectManager" to "InterfacesAdded"` is relevant at all?
Found a "fix", but it's too strange. Connecting to the signal like this works: void ManagerPrivate::interfacesAdded2(const QDBusObjectPath &objectPath, const QMap<QString, QMap<QString, QVariant>> &interfaces); // ... QDBusConnection::systemBus().connect(QStringLiteral("org.bluez"), QStringLiteral("/"), QStringLiteral("org.freedesktop.DBus.ObjectManager"), QStringLiteral("InterfacesAdded"), this, SLOT(interfacesAdded2(QDBusObjectPath, QMap<QString, QMap<QString, QVariant>>))); But not if I use a method with QVariantMapMap in the signature, even though QVariantMapMap is typedef'd to be exactly that. It's already Q_DECLARE_METATYPE'd as well. And for some reason the same QVariantMapMap connect call works in plasmawindowed but not plasmashell or systemsettings. What could possibly be different?
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/bluez-qt/-/merge_requests/55
Git commit 3c60d9e3db6f9d236f1e6a166303f51cc6374119 by Bharadwaj Raju. Committed on 15/02/2024 at 10:48. Pushed by bharadwaj-raju into branch 'master'. Fix connecting to org.freedesktop.DBus.ObjectManager InterfacesAdded The metatype also needs to be qRegisterMetaType'd in addition to qDBusRegisterMetaType and Q_DECLARE_METATYPE. I still don't know why it worked in plasmawindowed though… M +1 -0 src/manager_p.cpp https://invent.kde.org/frameworks/bluez-qt/-/commit/3c60d9e3db6f9d236f1e6a166303f51cc6374119