Skip to content

Add support for USB portal#25

Merged
Jacalz merged 12 commits into
rymdport:mainfrom
pojntfx:add-usb-portal
Mar 24, 2026
Merged

Add support for USB portal#25
Jacalz merged 12 commits into
rymdport:mainfrom
pojntfx:add-usb-portal

Conversation

@pojntfx

@pojntfx pojntfx commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Description:

This implements the USB portal (https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.Usb.html). I'm planning on using this - or better, a potential future serial port terminal - in https://codeberg.org/pojntfx/runway.

Adds all the methods and signals. Skipped the version property since no other portal in this repo implements it.

I've also added a little CLI, cmd/usb, to test it. The portal is really new, I could find no apps using it yet aside from my own experiments (given that libportal doesn't support it yet), so this was kind of necessary during testing. Feel free to remove it if it shouldn't be part of this repo (no other portals have something like it, so I'd understand).

Checklist:

  • Tests included - that's the usb command
  • Lint and formatter run with no errors
  • Tests all pass - didn't touch those

pojntfx added 11 commits March 20, 2026 22:59
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
…s` for the USB portal

Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
@pojntfx

pojntfx commented Mar 21, 2026

Copy link
Copy Markdown
Contributor Author

Sorry about the CI failures there - I was testing on Go 1.26 earlier locally. Should be all ready now.

@Jacalz Jacalz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this, I appreciate it very much. Haven't tested it locally yet but I added some notes inline :)

Comment thread cmd/usb/main.go Outdated
@@ -0,0 +1,132 @@
package main

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe this cmd command can be made into an example for the API docs in the usb package instead? I don't know exactly how Go handles that but I think you kind of make a test.

I've had some ideas about creating an app to test out the portals but never got around to it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

re:portal test app - yup, I was thinking of a similar thing. A CLI might be a tad more maintainable I'm thinking? Optimally there would be an OpenQA test suite against the portal spec using something like GNOME's implementation of the portals, but I digress

Good idea re:examples, never actually used that Go feature. Looks like this now in go doc:

Listing of examples in Go doc An example in particular opened in Go doc

Resolved via bd77c97

Comment thread internal/convert/basic.go
}

// UnixFDToUintptr is a fast converter from a dbus UnixFD to a uintptr.
func UnixFDToUintptr(input dbus.UnixFD) (uintptr, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems to be a copy of a similar function I added very recently on main. I think you want to remove this commit and rebase on main.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh yes, I did copy it, but mine is the other way around compared to main! It's a helper to get it converted the other way. See d00323e

Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>

@Jacalz Jacalz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perfect. Thank you so much :)

@Jacalz
Jacalz merged commit fcbaeb5 into rymdport:main Mar 24, 2026
3 checks passed
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.

2 participants