docs: Update lessons learned with D-Bus and QDBus API fixes
This commit updates the lessons learned document to include details about the D-Bus connection issues encountered when running the wayland_poc executable on the host. It covers the fixes for method name mismatches (PickSource to SelectSources), argument type mismatches (string to QDBusObjectPath), and QDBusMessage API versioning. This provides a more complete record of the debugging process for the xdg-desktop-portal interaction.
This commit is contained in:
parent
e760af9f43
commit
65b153eb50
@ -46,19 +46,25 @@ This document summarizes the key challenges, debugging steps, and solutions enco
|
||||
* **New Strategy:** Isolate the `xdg-desktop-portal` interaction using Qt's `QDBus` module, completely bypassing direct PipeWire session manager header includes.
|
||||
* **`wayland_poc.cpp` Refactoring:** Simplified `wayland_poc.cpp` to *only* handle the `QDBus` interaction to get the `pipewire_node_id`. Removed all PipeWire stream creation/processing logic.
|
||||
* **QDBus API Challenges:**
|
||||
* **`QDBusMessage::callMethod` vs `createMethodCall`:** Discovered `createMethodCall` is the correct static method for creating method call messages in Qt 5.15.
|
||||
* **`QDBusMessage` constructor:** Found that the direct constructor `QDBusMessage("service", "path", ...)` is the correct way to initialize `QDBusMessage` for method calls in the specific Qt5 version in Ubuntu.
|
||||
* **`QDBusMessage::createMethodCall` vs `createMethod`:** Discovered `createMethodCall` is the correct static method for creating method call messages in Qt 5.15.
|
||||
* **`QDBusMessage` constructor:** Found that the direct constructor `QDBusMessage("service", "path", "interface", "method");` is the correct way to initialize `QDBusMessage` for method calls in the specific Qt5 version in Ubuntu.
|
||||
* **`QDBusPendingCall` conversion:** Ensured `sessionBus.asyncCall(message)` is used, which returns `QDBusPendingCall`.
|
||||
* **Successful Compilation:** The simplified `wayland_poc.cpp` (QDBus-only) compiled successfully in the Ubuntu Docker container with Clang. This is a major breakthrough, confirming that the `QDBus` approach for `xdg-desktop-portal` interaction is viable.
|
||||
|
||||
## 7. Runtime Challenges (D-Bus Connection)
|
||||
|
||||
* **Problem:** Running the compiled `wayland_poc` executable (from Docker) on the host failed with `Failed to connect to D-Bus session bus.`.
|
||||
* **Reason:** Docker containers are isolated and do not have direct access to the host's D-Bus session bus by default. Environment variables (`DBUS_SESSION_BUS_ADDRESS`, `XDG_RUNTIME_DIR`) and volume mounts (`/tmp/.X11-unix`, `$XDG_RUNTIME_DIR`) are needed.
|
||||
* **Current Status:** The `docker run` command with D-Bus access parameters is provided to the user for execution on their host. The problem is now with the user executing the command correctly and the D-Bus connection working on their host.
|
||||
* **Problem:** Running the compiled `wayland_poc` executable (from Docker) on the host failed with `Failed to connect to D-Bus session bus.`
|
||||
* **Reason:** Docker containers are isolated and do not have direct access to the host's D-Bus session bus by default. Environment variables (`DBUS_SESSION_BUS_ADDRESS`, `XDG_RUNTIME_DIR`, `DISPLAY`, `WAYLAND_DISPLAY`) and volume mounts (`/tmp/.X11-unix`, `$XDG_RUNTIME_DIR`) are needed.
|
||||
* **Further Problem:** Even with correct `docker run` parameters, the `wayland_poc` on the host failed with `D-Bus call to xdg-desktop-portal failed: "Invalid session"`.
|
||||
* **Diagnosis:** This error indicates `xdg-desktop-portal` is not recognizing the session context. It's often related to `XDG_SESSION_ID`, `XDG_SESSION_TYPE`, or `XDG_CURRENT_DESKTOP` not being correctly propagated or interpreted.
|
||||
* **Method Name Mismatch:** The `wayland_poc` was initially calling `PickSource` on `org.freedesktop.portal.ScreenCast`, but the correct method name is `SelectSources`.
|
||||
* **Fix:** Changed method call from `PickSource` to `SelectSources` in `wayland_poc.cpp`.
|
||||
* **Argument Type Mismatch:** The `SelectSources` method expects an object path (`o`) for the `parent_window` argument, but `wayland_poc` was sending an empty string (`s`).
|
||||
* **Fix:** Changed the first argument to `QDBusObjectPath("/")` in `wayland_poc.cpp`.
|
||||
* **Current Status:** The `wayland_poc` executable now compiles successfully. The D-Bus connection issue (`Failed to connect to D-Bus session bus.` or `Invalid session`) is still occurring when run on the host, indicating a persistent runtime environment issue with D-Bus access from the application.
|
||||
|
||||
## 8. Next Steps
|
||||
|
||||
* **Verify `wayland_poc` execution on host:** The user needs to run the `wayland_poc` executable on their host with the provided `docker run` command (or directly if copied out) and confirm if the `xdg-desktop-portal` dialog appears and a PipeWire node ID is printed.
|
||||
* **Verify `wayland_poc` execution on host:** The user needs to run the `wayland_poc` executable on their host with the provided `docker run` command (or directly if copied out) and confirm if the `xdg-desktop-portal` dialog appears and a PipeWire node ID is printed. The current D-Bus connection failure needs to be resolved.
|
||||
* **Integrate:** If successful, the next phase will involve integrating the `QDBus` based `xdg-desktop-portal` interaction with the core PipeWire stream capture logic (from `tutorial5.c`) into the main Hyperion grabber.
|
||||
* **Persistent `session-manager.h`:** The original `session-manager.h` compilation issue remains unresolved for direct PipeWire session manager API usage. The `QDBus` approach is a workaround. If direct PipeWire session manager API interaction is ever needed, this issue would need further, likely local, investigation.
|
||||
Loading…
x
Reference in New Issue
Block a user