Open rdlf4 opened 5 years ago
Indeed, on some devices, disconnecting the USB cable breaks the adb-over-tcp connection. There are several threads about this on stackoverflow, but no real solution AFAIK.
I can confirm this issue is still present on v1.12.
With my device connected via USB, I do adb tcpip 5555
. Right after that, Scrcpy has no problem to find and connect to my phone. However, after restarting my computer, my phone returns:
unable to connect to 192.168.0.101:5555: Connection refused
For those who're wondering, I have no port-managing app on my phone nor any Firewall. And yes, my computer can still ping to my phone.
I can confirm this issue is still present on v1.12.
The issue is independant from scrcpy, it's just adb
.
https://stackoverflow.com/questions/33462720/adb-unable-to-connect-to-192-168-1-105555
I can confirm this issue is still present on v1.12. With my device connected via USB, I do
adb tcpip 5555
. Right after that, Scrcpy has no problem to find and connect to my phone. However, after restarting my computer, my phone returns:unable to connect to 192.168.0.101:5555: Connection refused
For those who're wondering, I have no port-managing app on my phone nor any Firewall. And yes, my computer can still ping to my phone.
Hi,
Were you able to fix that issue?
The same happens to me. Once I restart my computer or the phone, I'm forced to connect Phone via USB and then enable adb over TCP everytime.
I can confirm this issue is still present on v1.12. With my device connected via USB, I do
adb tcpip 5555
. Right after that, Scrcpy has no problem to find and connect to my phone. However, after restarting my computer, my phone returns:unable to connect to 192.168.0.101:5555: Connection refused
For those who're wondering, I have no port-managing app on my phone nor any Firewall. And yes, my computer can still ping to my phone.
Hi,
Were you able to fix that issue?
The same happens to me. Once I restart my computer or the phone, I'm forced to connect Phone via USB and then enable adb over TCP everytime.
Hello. I was not able to fix it. However, there's a chance my computer will connect to my phone without having to plug it to my computer and re-enable adb-over-tcp connection. It's a hit or miss thing. But when that happens, it performs really really slow. My phone takes longer to detect a click event and scrolling is also affected. Really weird. Checked my router's firewall - including LAN Firewall to see whether there are ports that have been restricted or blacklisted, but there's nothing there.
I'm in the dark and out of ideas.
I can confirm this issue is still present on v1.12. With my device connected via USB, I do
adb tcpip 5555
. Right after that, Scrcpy has no problem to find and connect to my phone. However, after restarting my computer, my phone returns:unable to connect to 192.168.0.101:5555: Connection refused
For those who're wondering, I have no port-managing app on my phone nor any Firewall. And yes, my computer can still ping to my phone.
Hi, Were you able to fix that issue? The same happens to me. Once I restart my computer or the phone, I'm forced to connect Phone via USB and then enable adb over TCP everytime.
Hello. I was not able to fix it. However, there's a chance my computer will connect to my phone without having to plug it to my computer and re-enable adb-over-tcp connection. It's a hit or miss thing. But when that happens, it performs really really slow. My phone takes longer to detect a click event and scrolling is also affected. Really weird. Checked my router's firewall - including LAN Firewall to see whether there are ports that have been restricted or blacklisted, but there's nothing there.
I'm in the dark and out of ideas.
Hi,
Thanks for the quick response.
Looks like it automatically disables the adb tcp connection after sometime of idle, something similar the "remember me" cookies on websites. I hope that's not the case though.
I'll have a look into that once I get back home. I just hope this isn't anything that requires rooting the phone in order to change or even disable it.
I'll have a look into that once I get back home. I just hope this isn't anything that requires rooting the phone in order to change or even disable it.
Sure, keep us posted at your convenience. Thanks.
@rdlf4 Hi all, I encountered a similar error to yours as I was setting up the wireless use of scrcpy. I managed to resolve my issue using the following step.
Enable Allow ADB Debugging in charge only mode as shown in the picture attached. [Stackoverflow Reference]
Hopefully this helps.
If this is indeed the problem, we will need to update the setup instructions for scrcpy wireless connection in the README.md
. @rom1v I will be glad to do a quick Pull Request to update the documentation.
If that's the problem, yes, you could submit a new entry in FAQ.md :+1:
@cardboardcode Thanks for taking the time to look into this. Unfortunately it seems that option you mentioned isn't available for Android 7.x-based devices, mine included. Matter fact, it seems I can only Enable USB debugging, revoke authorizations, and that's it. As you can see from the screenshot attached.
Question is, where do I go from here? :/
@rdlf4 It seems the suggested solution only applies to devices of Android 8.0 and above.
Since I am not an expert on this issue, I can only recommend a crude workaround or generic advice:
- Upgrade to Android 8.0 and above.
- Find the equivalent to Allow ADB Debugging in charge only mode within Android 7.0.
@rom1v It does not seem to be the problem, at least in the specific context of this issue thread.
@rdlf4 Hi all, I encountered a similar error to yours as I was setting up the wireless use of scrcpy. I managed to resolve my issue using the following step.
[Possible Solution]
Enable Allow ADB Debugging in charge only mode as shown in the picture attached. [Stackoverflow Reference]
Hopefully this helps.
If this is indeed the problem, we will need to update the setup instructions for scrcpy wireless connection in the
README.md
. @rom1v I will be glad to do a quick Pull Request to update the documentation.
I was successful in getting a connection after following these steps.
@NLHybrid @cardboardcode @rdlf4 this trick with enabling "Allow ADB debug in charge only mode" has helped me too! Thanks! Someone should add this to the Readme.md
To permanently enable adb via wifi that will persist upon reboot, login as root in termux and issue command:
setprop persist.adb.tcp.port 5555
In case things go really bad and adbd crashes (but shouldn't be the case normally), you can restart it in termux using root with:
stop adbd
start adbd
No need to plug usb cable anymore afterwards.
I've never heard of "setprob". Should there be a space between the two words? My bad, I misread that, it's "setproP" - still, it's unknown to me. Terminal also complains with command not found.
EDIT #3: I seem to have found a fix.
One should issue the command:
adb shell setprop persist.adb.tcp.port 5555
Now the next step would be to make sure it sticks, but when I did:
adb shell getprop persist.adb.tcp.port
It should've returned 5555 but instead, I got nothing.
EDIT #4: Issuing those commands as sudo makes no difference
EDIT #5: I tried restarting the phone since those commands are supposed to 'persist', so maybe they would show some result after it restarts. No, it doesn't.
@rdlf4 yes you can pass the command with adb shell. What I wrote above was directly into android's shell (via termux app)
To do that, you need however to become root to modify system props. So use this instead:
adb shell "su -c 'setprop persist.adb.tcp.port 5555'"
adb shell getprop persist.adb.tcp.port
Update: now i read your edits. Do you get any error? Also what android version do you have?
@rdlf4 yes you can pass the command with adb shell. What I wrote above was directly into android's shell (via termux app)
To do that, you need however to become root to modify system props. So use this instead:
adb shell "su -c 'setprop persist.adb.tcp.port 5555'" adb shell getprop persist.adb.tcp.port
Update: now i read your edits. Do you get any error? Also what android version do you have?
I couldn't become root (SU) when using Termux, which seems to require my phone to be rooted. Lots of work related stuff on there to even think about it, so I'm avoiding rooting my phone for now. Is there no other way to get this done without rooting the phone? Like an Android app that you know of that allows SU in Termux?
su implies having root access. You will make your life easier if you root your phone than trying to mess around with props in other ways. My advice for rooting is magisk. Depending on the android version you might need to follow a different approach. xda forums is a good place to start.
edit: i think you could however install custom recovery (TWRP) , mount system as read-write and modify build.props from there. No root needed. Worth a try..
What android version do you have?
I created this tool to ease wireless connectivity. Check it out and let me know of your experience.
So, this has happened to me all the time I need to recharge my phone, and I do so by plugging it to my computer. But normally, after it's been charged and unplugged, trying to connect to my phone again via wireless by issuing the command
returns me with an error:
Then, I have to plug it to my computer again, do the same as I did before:
And then, do:
So that, my phone returns:
And then, it finally connects.
My question is, why is it that every time I unplug it from my computer, it no longer works in TCP mode? Can't I leave it like that, in order to not have to re-do those steps after unplugging my device?