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

[Question] How to use scrcpy via SSH tunneling? Readme is outdated. #1470

Closed
eric-kargo opened this issue Jun 4, 2020 · 7 comments
Closed
Labels

Comments

@eric-kargo
Copy link

Hi developers of scrcpy,

Thank you for developing this awesome tool. I have a problem when I tried to connect to my device with the following configuration:
Device ---USB--- Server ---WiFi--- Client

I tried the following steps:

  1. Run adb server on the server with the following command adb -a nodaemon server
  2. Run SSH with port forwarding from client to server with the following command
    ssh -CN -L5037:localhost:5037 -R27183:localhost:27183 <server ip address>
  3. Test connection on client with following command adb devices, it successfully listed the device on client machine.
  4. I was lost on this step, I tried the following command from README scrcpy --force-adb-forwrad and it doesn't work. I try again with the following command scrcpy --force-adb-forward and it doesn't work. I tried without any argument, just run the command scrcpy and it doesn't work.

Seems like the readme is outdated or the feature is no longer supported. If it is still supported, would you tell me how to do it? I will make a PR to update the readme if you want.

@rom1v
Copy link
Collaborator

rom1v commented Jun 4, 2020

I tried the following command from README scrcpy --force-adb-forwrad and it doesn't work.

If you pass --force-adb-forward, then you must pass -L27183:localhost:27183 instead of -R27183:localhost:27183.

I tried without any argument, just run the command scrcpy and it doesn't work.

What is the output?

@rom1v rom1v added the ssh label Jun 4, 2020
@herrenP
Copy link

herrenP commented Jun 6, 2020

I tried the following command from README scrcpy --force-adb-forwrad and it doesn't work.

If you pass --force-adb-forward, then you must pass -L27183:localhost:27183 instead of -R27183:localhost:27183.

I tried without any argument, just run the command scrcpy and it doesn't work.

What is the output?

Since I am not that experienced with port forwarding; in which cases are --force-adb-forward to be used? I have tried both reverse and forward and they both seem to work fine for me and I have the same or similar setup as OP.

@rom1v
Copy link
Collaborator

rom1v commented Jun 6, 2020

--force-adb-forward could be useful when remote port forwarding is not authorized (by default, it's often disabled for non-localhost address).

In addition, adb reverse does not work with adb connect before Android 9 or 10 (see #5), so a fortiori it does not work in that case via a ssh tunnel.

@eric-kargo
Copy link
Author

Hi @rom1v,

If you pass --force-adb-forward, then you must pass -L27183:localhost:27183 instead of -R27183:localhost:27183.

I tried again with -L argument, and run scrcpy --force-adb-forward and it outputs:
scrcpy: unknown option -- force-adb-forward

I tried without any argument, just run the command scrcpy and it doesn't work.

What is the output?

It will output the following text on terminal, and no other window to show device screen.

INFO: scrcpy 1.13 <https://github.com/Genymobile/scrcpy>
C:\Users\eric2\Documents\Eric\bin\scrcpy-win64-v1.13\scrcpy-server: 1 file pushed. 0.0 MB/s (27694 bytes in 0.812s)
[server] INFO: Device: Xiaomi Redmi Note 4 (Android 7.0)
java.io.FileNotFoundException: /data/system/theme_config/theme_compatibility.xml (No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:146)
        at java.io.FileInputStream.<init>(FileInputStream.java:99)
        at java.io.FileReader.<init>(FileReader.java:58)
        at miui.content.res.ThemeCompatibilityLoader.getVersion(SourceFile:108)
        at miui.content.res.ThemeCompatibilityLoader.getConfigDocumentTree(SourceFile:126)
        at miui.content.res.ThemeCompatibilityLoader.loadConfig(SourceFile:59)
        at miui.content.res.ThemeCompatibility.<clinit>(SourceFile:31)
        at miui.content.res.ThemeCompatibility.isThemeEnabled(SourceFile:111)
        at android.content.res.MiuiResourcesImpl.<clinit>(MiuiResourcesImpl.java:40)
        at android.content.res.Resources.<init>(Resources.java:253)
        at android.content.res.MiuiResources.<init>(MiuiResources.java:49)
        at android.content.res.Resources.getSystem(Resources.java:182)
        at android.app.LoadedApk.<init>(LoadedApk.java:205)
        at android.app.ContextImpl.createSystemContext(ContextImpl.java:2013)
        at android.app.ActivityThread.getSystemContext(ActivityThread.java:2137)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.genymobile.scrcpy.Workarounds.fillAppInfo(Workarounds.java:66)
        at com.genymobile.scrcpy.ScreenEncoder.streamScreen(ScreenEncoder.java:50)
        at com.genymobile.scrcpy.Server.scrcpy(Server.java:35)
        at com.genymobile.scrcpy.Server.main(Server.java:177)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:379)

Is ADB forward new feature? As you can see, I am using scrcpy v1.13 on Windows x64.

@rom1v
Copy link
Collaborator

rom1v commented Jun 8, 2020

Is ADB forward new feature? As you can see, I am using scrcpy v1.13 on Windows x64.

Yes, it has been added in v1.14: https://github.com/Genymobile/scrcpy/releases/tag/v1.14

@eric-kargo
Copy link
Author

So I just tested it again with scrcpy v1.14 and it works! Thanks @rom1v!

Shall I close this issue?

@rom1v rom1v closed this as completed Jun 9, 2020
@SuperKenVery
Copy link

Hi, what about this:

Computer --- Tailscale/MagiskSSH --- Device

Is it possible to transmit data over SSH, without using adb?

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

No branches or pull requests

4 participants