kf6-solid: fix 4 #error stubs + enable UDisks2/UPower backends via D-Bus

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.
This commit is contained in:
2026-07-09 21:23:52 +03:00
parent 15018fb50d
commit 1237cde86e
3 changed files with 13 additions and 3 deletions
+3 -3
View File
@@ -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
@@ -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
@@ -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