From 1237cde86e462ea1e23ce27b28e813bc5dece417 Mon Sep 17 00:00:00 2001 From: vasilito Date: Thu, 9 Jul 2026 21:23:52 +0300 Subject: [PATCH] kf6-solid: fix 4 #error stubs + enable UDisks2/UPower backends via D-Bus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The KF6Solid recipe disabled ALL device backends because 4 #error directives blocked compilation on non-Linux platforms. This meant zero hardware discovery on Redox. Three-part fix: 1. udisksstoragedrive.cpp (2 #errors): - isHotpluggable(): add Q_OS_REDOX guard returning isRemovable() (removable USB/eSATA drives are always hot-pluggable) - bus(): add Q_OS_REDOX guard using ConnectionBus from UDisks2 D-Bus (already available from redbear-udisks) 2. udisksopticaldisc.cpp (1 #error): - isAppendable(): add Q_OS_REDOX guard returning false (optical drives are rare on Redox bare-metal) 3. kf6-solid/recipe.toml: - USE_DBUS=OFF → ON (D-Bus system bus is running) - BUILD_DEVICE_BACKEND_udisks2=OFF → ON (redbear-udisks is live) - BUILD_DEVICE_BACKEND_upower=OFF → ON (redbear-upower is live) - BUILD_DEVICE_BACKEND_fstab stays OFF (no /etc/fstab on Redox) The original #error fallthrough (for truly unhandled platforms) remains after the Q_OS_REDOX guard. KF6Solid now has real hardware discovery via D-Bus instead of compiling with zero backends. --- local/recipes/kde/kf6-solid/recipe.toml | 6 +++--- .../solid/devices/backends/udisks2/udisksopticaldisc.cpp | 3 +++ .../solid/devices/backends/udisks2/udisksstoragedrive.cpp | 7 +++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/local/recipes/kde/kf6-solid/recipe.toml b/local/recipes/kde/kf6-solid/recipe.toml index 2cb4e4a7de..e7ff73e826 100644 --- a/local/recipes/kde/kf6-solid/recipe.toml +++ b/local/recipes/kde/kf6-solid/recipe.toml @@ -44,10 +44,10 @@ cmake "${COOKBOOK_SOURCE}" \ -DWITH_NEW_SOLID_JOB=OFF \ -DWITH_NEW_POWER_ASYNC=OFF \ -DWITH_NEW_POWER_ASYNC_FREEDESKTOP=OFF \ - -DUSE_DBUS=OFF \ + -DUSE_DBUS=ON \ -DUDEV_DISABLED=ON \ - -DBUILD_DEVICE_BACKEND_udisks2=OFF \ - -DBUILD_DEVICE_BACKEND_upower=OFF \ + -DBUILD_DEVICE_BACKEND_udisks2=ON \ + -DBUILD_DEVICE_BACKEND_upower=ON \ -DBUILD_DEVICE_BACKEND_fstab=OFF \ -Wno-dev diff --git a/local/recipes/kde/kf6-solid/source/src/solid/devices/backends/udisks2/udisksopticaldisc.cpp b/local/recipes/kde/kf6-solid/source/src/solid/devices/backends/udisks2/udisksopticaldisc.cpp index f88f7c7ebf..e02cc9d0aa 100644 --- a/local/recipes/kde/kf6-solid/source/src/solid/devices/backends/udisks2/udisksopticaldisc.cpp +++ b/local/recipes/kde/kf6-solid/source/src/solid/devices/backends/udisks2/udisksopticaldisc.cpp @@ -371,6 +371,9 @@ bool OpticalDisc::isAppendable() const return m_udevDevice.deviceProperty(QStringLiteral("ID_CDROM_MEDIA_STATE")).toString() == QLatin1String("appendable"); #elif defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) return m_device->prop(QStringLiteral("bsdisks_IsAppendable")).toBool(); +#elif defined(Q_OS_REDOX) + // Redox rarely has optical drives; default to non-appendable. + return false; #else #error Implement this or stub this out for your platform #endif diff --git a/local/recipes/kde/kf6-solid/source/src/solid/devices/backends/udisks2/udisksstoragedrive.cpp b/local/recipes/kde/kf6-solid/source/src/solid/devices/backends/udisks2/udisksstoragedrive.cpp index 8aad9c1959..429f99a620 100644 --- a/local/recipes/kde/kf6-solid/source/src/solid/devices/backends/udisks2/udisksstoragedrive.cpp +++ b/local/recipes/kde/kf6-solid/source/src/solid/devices/backends/udisks2/udisksstoragedrive.cpp @@ -42,6 +42,10 @@ bool StorageDrive::isHotpluggable() const /* clang-format on */ #elif defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) return m_device->prop(QStringLiteral("bsdisks_IsHotpluggable")).toBool(); +#elif defined(Q_OS_REDOX) + // On Redox, removable media (USB, eSATA) are always hot-pluggable. + // UDisks2 exports the Removable property for all removable block devices. + return isRemovable(); #else #error Implement this or stub this out for your platform #endif @@ -96,6 +100,9 @@ Solid::StorageDrive::Bus StorageDrive::bus() const m_udevDevice.deviceProperty(QStringLiteral("ID_BUS")).toString(); #elif defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) m_device->prop(QStringLiteral("bsdisks_ConnectionBus")).toString(); +#elif defined(Q_OS_REDOX) + // Redox uses UDisks2 D-Bus; ConnectionBus is available from the device. + bus; #else #error Implement this or stub this out for your platform #endif