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

scrcpy --tcpip doesn't setup a connection correctly when wireless debugging runs on a different port than 5555 #3591

Closed
2 tasks done
Nowaker opened this issue Nov 22, 2022 · 1 comment

Comments

@Nowaker
Copy link

Nowaker commented Nov 22, 2022

  • I have read the FAQ.
  • I have searched in existing issues.

Environment

  • OS: MacOS (but it's irrelevant)
  • scrcpy version: 1.24
  • installation method: brew
  • device model: OnePlus LE2125 (OnePlus 9 Pro)
  • Android version: 11

Describe the bug

Phone connected via USB, visible by ADB:

% adb devices
List of devices attached
8253bf5d	device

Running scrcpy --tcpip to do the heavy lifting ("It will automatically find the device IP address, enable TCP/IP mode, then connect to the device before starting") for me:

% scrcpy --tcpip
scrcpy 1.24 <https://github.com/Genymobile/scrcpy>
2022-11-22 16:27:00.398 scrcpy[42003:780512] INFO: Switching device 8253bf5d to TCP/IP...
2022-11-22 16:27:00.492 scrcpy[42003:780512] INFO: Connecting to 172.20.167.222:5555...
failed to connect to '172.20.167.222:5555': Connection refused
2022-11-22 16:27:01.236 scrcpy[42003:780512] ERROR: Could not connect to 172.20.167.222:5555
2022-11-22 16:27:01.237 scrcpy[42003:780511] ERROR: Server connection failed

... But it won't succeed because wireless debugging runs on a different port. I had to adb tcpip 5555 to change wireless debugging port to 5555 and only then would scrcpy --tcpip succeed.

Feature request

- It will automatically find the device IP address, enable TCP/IP mode, then connect to the device before starting
+ It will automatically find the device IP address, enable TCP/IP mode, find debugging port, then connect to the device before starting
rom1v added a commit that referenced this issue Nov 24, 2022
If the current adb port is not 5555 (typically it is 0 because it is not
in TCP/IP mode), --tcpip automatically executes (among other commands):

    adb tcpip 5555

In case adb was already listening on another port, this command forced
to listen on 5555, and the connection should still succeed.

But this reconfiguration might be inconvenient for the user. If adb is
already in TCP/IP mode and listens on another port, use that port
without reconfiguration.

Fixes #3591 <#3591>
@rom1v
Copy link
Collaborator

rom1v commented Nov 24, 2022

But it won't succeed because wireless debugging runs on a different port.

I'm surprised that it won't succeed, because in that case scrcpy executes adb tcpip 5555 beforehand. I don't understand why it does not work.

Anyway, I submitted a PR to use the current adb port if any: #3592.

Please review/test.

rom1v added a commit that referenced this issue Nov 24, 2022
If the current adb port is not 5555 (typically it is 0 because it is not
in TCP/IP mode), --tcpip automatically executes (among other commands):

    adb tcpip 5555

In case adb was already listening on another port, this command forced
to listen on 5555, and the connection should still succeed.

But this reconfiguration might be inconvenient for the user. If adb is
already in TCP/IP mode and listens on another port, use that port
without reconfiguration.

Fixes #3591 <#3591>
rom1v added a commit that referenced this issue Nov 24, 2022
If the current adb port is not 5555 (typically it is 0 because it is not
in TCP/IP mode), --tcpip automatically executes (among other commands):

    adb tcpip 5555

In case adb was already listening on another port, this command forced
to listen on 5555, and the connection should still succeed.

But this reconfiguration might be inconvenient for the user. If adb is
already in TCP/IP mode and listens on another port, use that port
without reconfiguration.

Fixes #3591 <#3591>
@rom1v rom1v closed this as completed in bd1deff Dec 22, 2022
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

No branches or pull requests

2 participants