RADLib
RADical C++ application framework

RADDisplay reports display backend capabilities without requiring libdrm. It enumerates DRM connector sysfs entries, framebuffer nodes, backlight devices, Wayland/X11 environment availability, and simple orientation names.

The main entry point is RADDisplay::DisplayManager. It is constructed with an optional DisplayPaths, so real hardware, test fixtures, and custom embedded roots all share one code path. DisplayManager::capabilities() returns a DisplayCapabilities struct with the drm, framebuffer, wayland, x11, and backlight flags describing what the backend exposes.

DisplayManager::displays() lists DRM connectors and framebuffer nodes as DisplayInfo records (name, path, status, mode), for example a connector named card0-HDMI-A-1 or a framebuffer named fb0. DisplayManager::backlights() returns BacklightInfo records that include the current and maximum brightness values.

DisplayManager::setBacklightBrightness() writes only the selected backlight sysfs brightness file and reports failures through an optional error string. Orientation is expressed with the Orientation enum (Landscape0, Portrait90, Landscape180, Portrait270); the static DisplayManager::orientationName() converts a value into a compositor/backend-friendly string.

Core features:

  • DRM connector and framebuffer enumeration without libdrm.
  • Backlight discovery and guarded brightness writes.
  • Wayland/X11 environment and capability detection.
  • Orientation name helpers for compositors and backends.
  • Injectable DisplayPaths for tests and embedded roots.

Example:

auto caps = manager.capabilities();
if (caps.backlight) {
for (const auto& backlight : manager.backlights()) {
// Set each panel to half of its reported maximum brightness.
std::string error;
if (!manager.setBacklightBrightness(
backlight.name, backlight.maxBrightness / 2, &error)) {
RADLOG_WARNING("display") << "backlight write failed: " << error;
}
}
}
for (const auto& display : manager.displays()) {
RADLOG_INFO("display") << display.name << " " << display.status;
}
#define RADLOG_INFO(category)
Logs with RADLogging at info level.
Definition: RADLogging.h:112
#define RADLOG_WARNING(category)
Logs with RADLogging at warning level.
Definition: RADLogging.h:114
Display discovery and control helpers.
Definition: RADDisplay.h:81
bool setBacklightBrightness(const std::string &name, int brightness, std::string *error=nullptr) const
Writes brightness to a backlight device.
std::vector< DisplayInfo > displays() const
Lists DRM connectors and framebuffer nodes.
std::vector< BacklightInfo > backlights() const
Lists backlight devices.
DisplayCapabilities capabilities() const
Returns display backend capability flags.