Is it possible to connect to scrcpy through ethernet connection only without: rooting the phone, using wifi or having a usb connection to pc

Search This thread

ptstr

Senior Member
Apr 10, 2022
54
3
Hello,

I got the following phone:

Moto G Pure | 2021 | 2-Day battery | Unlocked | Made for US by Motorola | 3/32GB | 13MP Camera | Deep Indigo

https://www.amazon.com/gp/product/B09BTB5MKT/

The phone charger port is usb c. It has an Android 11 installed.

Assumptions:

-I got a 2-1 dongle that allows to have an ethernet connection and charger at the same time.

-Phone is not rooted.

-Wifi is disabled (since I'm using ethernet) so assume no adb over wifi setting can be used.

-Phone charger is not connected to the pc usb so assume no adb over usb setting can be used.

How can I enable adb over ethernet so I could launch scrcpy on the same local network to access the phone screen/sending adb commands through command line as needed?

I found a similar post about this from 2018 on xda: https://forum.xda-developers.com/t/scrcpy-connection-help.3791716/

OP ended up ending writing the following update:

EDIT - problem solved: adb over ethernet instead of usb or wifi.

connected my android (galaxy view) to my network (ethernet) using the otg usb port and now, combined with the "adb over ethernet" app from the play store that i just discovered, the adb connection between my android and pc functions just as if they were connected by a usb cable, no more having to first connect the usb to get wifi to kick in, only to have to repeat this process again and again.


But when I tried to download "adb over ethernet" app, I noticed that it says that it requires root so I can't really use it?

A more recent comment on that post from 2022, someone said:

For others who find this in a search, you can get scrcpy to open up (and then kill the console to get it out of the way) on Android up to Android 11 using the "--tcpip=192.168.0.2:5555" option, but there's new capabilities in Android 12 now that eliminate totally the need for the initial USB connection.

In Android 12 you can also use scrcpy completely over Wi-Fi without first establishing the adb connection over USB like you need to do with Android 11.

There are new commands in the Android 12 Developer options to enable everything to be done over Wi-Fi which I've been using since May.


So it seems like the first option here (OP) is to root your phone and the second option (comment) is to upgrade your Android OS to version 12, which eliminates the need for a USB cable to enable adb debugging, but is there a way I could be able to connect to scrcpy on my Android 11 through the ethernet connection only without upgrading the Android version or rooting the phone?

When I currently try to run it this is the error I get (when only ethernet is connected, no wifi or usb connection to pc):

C:\scrcpy>scrcpy.exe
scrcpy 1.25 <https://github.com/Genymobile/scrcpy>
ERROR: Could not find any ADB device
ERROR: Server connection failed

Alternatively, can I enable adb over wifi in Android 11 so I could connect through scrpcy and without worrying that I might need to approve adb debugging in the small popup window that shows on the phone each time (or that shows periodically. In other words can that message be completely eliminated without rooting?). I do see under settings, developer options a setting called "Wireless debugging" (in addition to existing setting "USB debugging" which I had enabled when I used a direct USB connection the pc). So after enabling Wireless debugging, it asked me if I want to allow ADB debugging every time when my phone is connected to my local wifi network, I said yes. Now when I run scrcpy the following way using the local ip of my phone that was received by the wifi, I get the following error (IP was censored - this is only when wifi is connected, no usb connection to pc):

C:\scrcpy>scrcpy.exe --tcpip=192.168.X.X -b 2M -m 1024 --max-fps=15 --legacy-paste
scrcpy 1.25 <https://github.com/Genymobile/scrcpy>
INFO: Connecting to 192.168.X.X:5555...
cannot connect to 192.168.X.X:5555: No connection could be made because the target machine actively refused it. (10061)
ERROR: Could not connect to 192.168.X.X:5555
ERROR: Server connection failed

According to

“Requirements :
Device running with Android 11
SDK platform-tools with version ≥ 30.0.0.
Same Wi-Fi network for Android device and your PC
Wireless debugging
Android 11 supports deploying and debugging your app wirelessly from your workstation via Android Debug Bridge (adb). For example, you can deploy your debuggable app to multiple remote devices without physically connecting your device via USB and contending with common USB connection issues, such as driver installation.”

So this should be supported in Android 11, then why scrcpy fails to connect to my phone ip?

Thank you.
 
Last edited:

jwoegerbauer

Senior Member
Dec 11, 2022
1,705
7
337
Freestate of Bavaria, Germany
Moto G10
AFAIK the mobile device should be connected to a computer - either via USB or wirelessly in the same LAN.
This computer can be connected from a remote computer (via SSH), and SCRCPY can be used from this remote computer.

Device's Android must not be rooted to run SCRCPY.
 

ptstr

Senior Member
Apr 10, 2022
54
3
AFAIK the mobile device should be connected to a computer - either via USB or wirelessly in the same LAN.
This computer can be connected from a remote computer (via SSH), and SCRCPY can be used from this remote computer.

Device's Android must not be rooted to run SCRCPY.
SSH is a non graphic user interface, so how exactly can you run scrcpy from a remote computer you connected through SSH in some non gui terminal window?
 

jwoegerbauer

Senior Member
Dec 11, 2022
1,705
7
337
Freestate of Bavaria, Germany
Moto G10
In Windows 11 you execute SSH commands either via Windows CMD
1685260093946.png


or via Windows PowerShell
1685260176377.png
 
Oct 27, 2018
18
2
38
honolulu
AFAIK the mobile device should be connected to a computer - either via USB or wirelessly in the same LAN.
This computer can be connected from a remote computer (via SSH), and SCRCPY can be used from this remote computer.

Device's Android must not be rooted to run SCRCPY.
au contraire! good sir i checked the website of SCRPY and its supposed to work w/o root, i came across it in this silly phone-spoit nonsense , and i used it with success on my oculus 2 , with all due respect
 
Oct 27, 2018
18
2
38
honolulu
1. obtain permission
2. set the rules on your router
3. "nmap it!" or wireshark (not recommended)

or i think something like twitch would same same
 

ptstr

Senior Member
Apr 10, 2022
54
3
In Windows 11 you execute SSH commands either via Windows CMD
View attachment 5920653

or via Windows PowerShell
View attachment 5920655
I understand what’s ssh and how to run it from cmd/powershell, what I don’t understand is how it’s related to scrcpy? What’s the context of saying ssh and scrcpy in the same sentence? Assuming you ssh from cmd/powershell into some remote machine, can you run scrcpy in that remote machine? And if so, will the scrcpy/phone color screen will show up in the cmd/powershell black screen? That’s what I don’t understand...
 

ptstr

Senior Member
Apr 10, 2022
54
3
Look inside here - navigate to section

SSH tunnel​




So if I understand correctly, I could ssh from an external network machine into the internal network that has both the phone and ‘pc that I ssh to’, and then I will be able to run scrcpy remotely from my external network machine without the need to actually remote desktop into the machine to launch scrcpy that’s in the same network as the phone as long as I establish an SSH connection with that machine in that local network? Please correct me if I’m wrong, but it sounds very cool, it’s like some sort of VPN that allows you to access the local resources of that network using SSH in this case, thank you for pointing this out to me!

By the way, if I SSH from my iphone to that local machine network, is there an app or a way to launch scrcpy against that local network similar to how you would do it from the remote machine pc but just from my iphone? I have iPhone 12 Pro Max with iOS 14.4.1 jailbroken and got newterm3 terminal that allows me to ssh to remote computers.
 
Last edited: