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

USB Portal #210

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

USB Portal #210

wants to merge 4 commits into from

Conversation

hfiguiere
Copy link
Contributor

This is a draft, needs a lot of cleanup. Also the portal hasn't landed yet.

But I'm using this to exercise / test the USB portal.

@hfiguiere hfiguiere force-pushed the usb-portal branch 3 times, most recently from fced97d to ecb8189 Compare May 20, 2024 02:33
@hfiguiere
Copy link
Contributor Author

Currently includes a revert for #208

@hfiguiere hfiguiere force-pushed the usb-portal branch 3 times, most recently from 4d81103 to de86287 Compare May 20, 2024 03:10
@hfiguiere
Copy link
Contributor Author

The build failure is because it needs a flatpak version that isn't available.

src/desktop/usb.rs Outdated Show resolved Hide resolved
src/desktop/usb.rs Outdated Show resolved Hide resolved
src/desktop/usb.rs Outdated Show resolved Hide resolved
src/desktop/usb.rs Outdated Show resolved Hide resolved
src/desktop/usb.rs Show resolved Hide resolved
ashpd-demo/src/portals/desktop/usb.rs Outdated Show resolved Hide resolved
#[strong]
page,
async move {
let usb = UsbProxy::new().await.unwrap();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the proxy around

ashpd-demo/src/portals/desktop/usb.rs Outdated Show resolved Hide resolved
ashpd-demo/src/portals/desktop/usb.rs Outdated Show resolved Hide resolved

pub(super) async fn stop_session(&self) -> anyhow::Result<()> {
if let Some(session) = self.session.lock().await.take() {
session.close().await?;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should switch the buttons state

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is done by the non-imp version which is the one called from the UI.

@hfiguiere hfiguiere force-pushed the usb-portal branch 3 times, most recently from 3aee673 to 9146631 Compare November 23, 2024 07:33
@hfiguiere hfiguiere force-pushed the usb-portal branch 2 times, most recently from 7eadba8 to 7697720 Compare December 7, 2024 03:06
Signed-off-by: Hubert Figuière <[email protected]>
This allow running the release build.

Signed-off-by: Hubert Figuière <[email protected]>
@@ -13,6 +13,8 @@
"--share=ipc",
"--socket=wayland",
"--device=dri",
"--own-name=com.belmoussaoui.ashpd.demo",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this needed? Isn't this only to own names for app ids which don't match the app id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use this build using fenv, and that allow to build and run the non "Devel" version. It's not required for this PR per see (hint it's still in draft).

<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<style>
<class name="linked" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In think the consensus is that we want to avoid linked buttons whenever possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link (to the documentation) ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is none, ask in the #design:gnome.org room if you would like more context.

ashpd-demo/src/portals/desktop/usb.rs Outdated Show resolved Hide resolved
ashpd-demo/src/portals/desktop/usb.rs Outdated Show resolved Hide resolved
pub struct UsbDevice {
parent: Option<String>,
readable: Option<bool>,
/// Device is writable. Default is false.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an option, please document None. Ditto for readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Default is false". I thought this was clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

documented readable. (cf the D-Bus xml)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does None mean? How is it different from false? Why would you get one over the other?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it's the a{sv} from D-Bus. As per the D-Bus interface it can be omitted so it has to be omittable here.

@hfiguiere hfiguiere force-pushed the usb-portal branch 3 times, most recently from 85d3611 to 15d92c9 Compare December 7, 2024 17:54
@@ -50,14 +62,15 @@
{
"name": "ashpd-demo",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rather have a change that puts the manifest in ./ and see if that helps? :)

ashpd-demo/src/portals/desktop/usb.rs Show resolved Hide resolved
ashpd-demo/src/portals/desktop/usb.rs Show resolved Hide resolved
src/desktop/request.rs Outdated Show resolved Hide resolved
src/desktop/usb.rs Outdated Show resolved Hide resolved
#[zvariant(signature = "dict")]
struct AcquiredDevice {
success: bool,
fd: Option<OwnedFd>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if success = true, do we always receive an fd or not? or if the success = true and fd = None, there are no more fds to acquire?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If success is true we expect the fd, otherwise the error is set.

This doesn't preclude other devices to be successfully acquired.

src/desktop/usb.rs Outdated Show resolved Hide resolved
src/desktop/usb.rs Outdated Show resolved Hide resolved
src/desktop/usb.rs Outdated Show resolved Hide resolved
}

/// Device to acquire
pub struct Device(pub String /* ID */, pub bool /* writable */);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a constructor/getters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the getters have been added but aren't used. Maybe I should just omit them as the struct is only constructed (added a new)

src/desktop/usb.rs Show resolved Hide resolved
Signed-off-by: Hubert Figuière <[email protected]>
- Added UI for USB
- Added rusb to the crates.
- Added libusb to the manifest.

Signed-off-by: Hubert Figuière <[email protected]>
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 this pull request may close these issues.

3 participants