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

wip: integrate adb port forwarding #2451

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open

wip: integrate adb port forwarding #2451

wants to merge 36 commits into from

Conversation

E1int
Copy link

@E1int E1int commented Oct 9, 2024

This PR adds a toggle for wired connections in the "Edit connection" dialog. When enabled, ALVR manages the forwarding of the required ports using adb. If a system installation of adb is present, it will be used, falling back to downloading and installing a local copy otherwise.

Closes #567, closes #2349.

@E1int E1int marked this pull request as draft October 9, 2024 17:25
@zmerp
Copy link
Member

zmerp commented Oct 10, 2024

Why didn't you use mozdevice as you said initially?

@E1int
Copy link
Author

E1int commented Oct 10, 2024

I initially did but then I was told about the launcher using adb, which uses it through commands, so I thought we could avoid a dependency going the same route.
I can switch back to mozdevice, but we would still need to start the adb server with a command.

@zmerp
Copy link
Member

zmerp commented Oct 10, 2024

We should use the dependency if it reduces the amount of boilerplate

Copy link
Member

@zmerp zmerp left a comment

Choose a reason for hiding this comment

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

Is strum really needed? Also if you have to do this much amount of wrapping wouldn't it be better to use mozdevice?

@E1int
Copy link
Author

E1int commented Oct 10, 2024

No, strum is not strictly needed, I'll use a match then.

As for mozdevice, the parsing is very barebones: https://docs.rs/mozdevice/latest/src/mozdevice/lib.rs.html#93
I've also looked at how SharpAdbClient (the library that ADBForwarder uses) does it and decided against following the same approach: https://github.com/quamotion/madb/blob/master/SharpAdbClient/DeviceData.cs#L19

@vosk
Copy link

vosk commented Oct 11, 2024

@zmerp
Copy link
Member

zmerp commented Oct 11, 2024

There is also
https://docs.rs/adb_client/latest/adb_client/index.html

To be honest this one seems exactly what we need, and no need to download adb. It only implements the sockets part of the protocol, so it cannot be used for the launcher also.

@E1int
Copy link
Author

E1int commented Oct 11, 2024

That library needs an adb server to work, so the download is still needed: https://docs.rs/adb_client/latest/src/adb_client/server/adb_server.rs.html#52

@zmerp
Copy link
Member

zmerp commented Oct 11, 2024

Ah hm. In any case seems a good option

alvr/server_core/src/connection.rs Outdated Show resolved Hide resolved
alvr/adb/src/lib.rs Outdated Show resolved Hide resolved
alvr/adb/src/lib.rs Outdated Show resolved Hide resolved
alvr/adb/src/lib.rs Outdated Show resolved Hide resolved
alvr/adb/src/lib.rs Outdated Show resolved Hide resolved
alvr/server_core/src/connection.rs Outdated Show resolved Hide resolved
alvr/server_core/src/connection.rs Outdated Show resolved Hide resolved
@zmerp
Copy link
Member

zmerp commented Oct 15, 2024

This is shaping very nicely. let me know when it's ready for the final review

alvr/adb/src/lib.rs Outdated Show resolved Hide resolved
alvr/packets/src/lib.rs Outdated Show resolved Hide resolved
alvr/client_core/src/connection.rs Outdated Show resolved Hide resolved
@zmerp zmerp marked this pull request as ready for review October 20, 2024 22:52
Copy link
Member

@zmerp zmerp left a comment

Choose a reason for hiding this comment

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

I approved too soon. There are a few issues.

  • When wired mode is enabled, the trusted client keeps going to "Connecting" then "Disconnected" if there are no connected clients
  • The ADB download should show the download percentage. and show the total download size as MBs.

Looking at Infuse VR (commercial ALVR fork) I think it would make more sense to have a separate section to handle wired connections. we don't need to trust wired connections because both pc and headsets must be in the same place and managed by the same person.

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.

USB ADB Forwarder integration into the launcher Integrate ADB script for initiating a USB connection
3 participants