Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

input_capture portal Signals are not working #187

Closed
feschber opened this issue Jan 31, 2024 · 15 comments · Fixed by #199
Closed

input_capture portal Signals are not working #187

feschber opened this issue Jan 31, 2024 · 15 comments · Fixed by #199

Comments

@feschber
Copy link
Contributor

The receive_activate() / receive_deactivate() Streams on the input_capture portal never yield any Result.

I did some digging and could narrow it down a bit:

receive_activated calls signal("Activated") which yields a Stream that filter-maps on the result of msg.body::<Activated>().ok()

So I tried to replicated the body() call manually and it always throws the following error:

called `Result::unwrap()` on an `Err` value: Variant(Message("invalid type: character `o`, expected `v`, `a` or `(`"))

Which then of course results in the signal getting filtered by the filter_map call.

This error in body is originated from zvariant::from_slice_fds_for_dynamic_signature -> deserializer_for_signature -> ... -> deserialize_seq where it ultimately fails in zbus/zvariant/src/dbus/de.rs:347 because it does not expect an o.

@bilelmoussaoui
Copy link
Owner

I think the signature is wrong; so I would replicate the code outside of ashpd, use msg.body::<zvariant::Value>() an then call dbg!(value.value_signature()) and share the output?

@feschber
Copy link
Contributor Author

Thank you so much! I wanted to get back to this this week but I guess I don't have to!

When I checked the flatpak docs, I totally missed the missing () ...

@bilelmoussaoui
Copy link
Owner

No worries! the error message could have been better from zbus... Anyways, i will be doing a release shortly that includes this

@feschber
Copy link
Contributor Author

feschber commented Mar 1, 2024

Im now running into this issue:

thread 'main' panicked at /home/ferdinand/git/lan-mouse/src/backend/producer/libei.rs:122:30:
failed to deserialize body: Variant(PaddingNot0(1))

Do you have an example where you got this to work correctly?

@bilelmoussaoui
Copy link
Owner

That looks like a completely different issue. You would have to debug it yourself as I am not familiar with libei and don't have the time to dig into it now

@bilelmoussaoui bilelmoussaoui reopened this Mar 4, 2024
@feschber
Copy link
Contributor Author

feschber commented Mar 4, 2024

sorry I was a bit unclear but it's still kind of the same problem and I still can not receive the Activated signal because of it.
The signature now seems to get built correctly but parsing fails with this error message.
I will look into it and see what I can find.

@bilelmoussaoui
Copy link
Owner

If you have code I can easily run to test it, I would be happy to do some debugging.

@bilelmoussaoui
Copy link
Owner

Maybe @whot would have an idea?

@whot
Copy link
Contributor

whot commented Mar 6, 2024

The signature now seems to get built correctly but parsing fails with this error message.

which error message? The Variant(PaddingNot0)? It's a bit hard to guess without seeing the code you use to parse (this source doesn't have a line 120).

Probably worth checking with dbus-monitor to see what's being sent and comparing this to your parsing code.

@feschber
Copy link
Contributor Author

feschber commented Mar 6, 2024

one second

@feschber
Copy link
Contributor Author

feschber commented Mar 6, 2024

https://github.com/feschber/ashpd-mre

this is basically what I've tried so far.

@feschber
Copy link
Contributor Author

feschber commented Mar 6, 2024

In lan-mouse the libei-producer branch contains my attempts. (but with more irrelevant stuff)

@feschber
Copy link
Contributor Author

feschber commented Mar 6, 2024

[2024-03-06T23:26:25Z INFO  ashpd_mre] creating input capture session
[2024-03-06T23:26:27Z INFO  ashpd_mre] selecting zones
[2024-03-06T23:26:27Z INFO  ashpd_mre] Zones { zones: [Region(1440, 2560, 2560, 0), Region(2560, 1440, 0, 815)], zone_set: 0 }
[2024-03-06T23:26:27Z INFO  ashpd_mre] selecting barriers: [Barrier { barrier_id: 0, position: (2560, 0, 2560, 2559) }, Barrier { barrier_id: 1, position: (0, 815, 0, 2254) }]
[2024-03-06T23:26:27Z INFO  ashpd_mre] connect_to_eis
[2024-03-06T23:26:27Z INFO  ashpd_mre] enabling session
[2024-03-06T23:26:27Z INFO  ashpd_mre] receiving activation token ...
[2024-03-06T23:26:27Z INFO  ashpd_mre] Msg { type: Signal, sender: UniqueName(":1.58"), path: ObjectPath("/org/freedesktop/portal/desktop"), iface: InterfaceName("org.freedesktop.portal.InputCapture"), member: MemberName("Activated"), body: Signature("oa{sv}"), fds: [] }
thread 'main' panicked at src/main.rs:126:26:
failed to deserialize body: Variant(PaddingNot0(1))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

An activated signal is clearly arriving but the deserialization fails here (just updated the example to fix the logging)

@whot
Copy link
Contributor

whot commented Mar 6, 2024

I have no idea tbh, this looks like it's inside the dictionary deserialization but I don't know how this one works. From a quick look at input_capture.rs that bit looks correct, I don't know if you can somehow hook extra debug messages into the deserialization code to figure out what it's trying to do.

@feschber
Copy link
Contributor Author

found the culprit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants