diff --git a/lessons_learned.md b/lessons_learned.md index 16d5b97..fa66c46 100644 --- a/lessons_learned.md +++ b/lessons_learned.md @@ -108,6 +108,11 @@ This document summarizes the key challenges, debugging steps, and solutions enco * **Diagnosis:** The `xdg-desktop-portal` API for `CreateSession` had changed, and the `handlePath`, `sessionPath`, and `applicationName` arguments were no longer expected. * **Fix:** Modified the `CreateSession` call in `wayland_poc.cpp` to only send an empty `QVariantMap` as its argument. +* **D-Bus `CreateSession` "Missing token" Error:** + * **Problem:** After fixing the `CreateSession` signature, the call failed with a "Missing token" error. + * **Diagnosis:** The `CreateSession` method, while expecting a single dictionary of options, also requires a `handle_token` within that dictionary. + * **Fix:** Added a `handle_token` to the `QVariantMap` passed to the `CreateSession` call in `wayland_poc.cpp`. + * **New Runtime Error: "Remote peer disconnected"** * **Problem:** After successfully building and copying `wayland_poc` to the host, running it resulted in "D-Bus call to SelectSources failed: "Remote peer disconnected"". * **Diagnosis:** This indicates a problem with the D-Bus connection itself, rather than a rejection from the portal. Possible causes include incorrect D-Bus environment variables on the host, `xdg-desktop-portal` not running, or permission issues. diff --git a/wayland_poc.cpp b/wayland_poc.cpp index 7d53193..2665d3f 100644 --- a/wayland_poc.cpp +++ b/wayland_poc.cpp @@ -145,7 +145,9 @@ int main(int argc, char *argv[]) { QDBusObjectPath sessionPath("/org/freedesktop/portal/session/12345/screencast_sess_1"); // Add arguments: handle, session_handle, app_id, options - message << QVariantMap(); // Empty options map + QVariantMap options; + options.insert("handle_token", QUuid::createUuid().toString(QUuid::WithoutBraces)); // Add handle_token + message << options; // Empty options map QDBusPendingCall pendingCall = sessionBus.asyncCall(message); QDBusPendingCallWatcher *mainWatcher = new QDBusPendingCallWatcher(pendingCall);