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

Wireless not permanently enabled when turning on tcpip. #1548

Open
2 tasks done
robertsaron opened this issue Jun 26, 2020 · 17 comments
Open
2 tasks done

Wireless not permanently enabled when turning on tcpip. #1548

robertsaron opened this issue Jun 26, 2020 · 17 comments

Comments

@robertsaron
Copy link

robertsaron commented Jun 26, 2020

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

Environment

  • OS: [e.g. Debian, Windows, macOS...]
  • scrcpy version: [e.g. 1.12.1]
  • installation method: [e.g. manual build, apt, snap, brew, Windows release...]
  • device model:
  • Android version: [e.g. 10]

Describe the bug
A clear and concise description of what the bug is.

On errors, please provide the output of the console (and adb logcat if relevant).

Please paste terminal output in a code block.

Please do not post screenshots of your terminal, just post the content as text instead.

In a previous version of scrcpy, once wireless was enabled it would remain on. In version 1.14 I have to turn on the wireless option of scrcpy, or plug it in all the time to a USB connection.

I am on the latest version of android, and windows 10 Pro.

@robertsaron
Copy link
Author

Information from Terminal:

INFO: scrcpy 1.14 https://github.com/Genymobile/scrcpy
adb: error: failed to get feature set: no devices/emulators found
ERROR: "adb push" returned with value 1
Press any key to continue...

When connected via usb, it works fine.

@rom1v
Copy link
Collaborator

rom1v commented Jun 26, 2020

In version 1.14 I have to turn on the wireless option of scrcpy

scrcpy has no "wireless option". It just uses adb, which can connect to the device over USB or TCP/IP via adb connect.

How did you connect to your device wirelessly via adb?

@robertsaron
Copy link
Author

Yes I connected via adb over tcpip. In a previous version I could enable it once, and never connect my phone to my computers USB again. Today, after turning on my computer, I am not able to connect to my device over tcpip, which I will refer to as wireless, wifi, or wirelessy going forward.

I have to plug my phone into a USB port, after every reboot.

@rom1v
Copy link
Collaborator

rom1v commented Jun 27, 2020

After every reboot of the device or the computer? (adb tcpip does not survive device reboot)

Anyway, it's related to adb behavior, not scrcpy. The adb version changes between scrcpy releases, check a previous version to be sure.

@mjjauhar
Copy link

mjjauhar commented Aug 14, 2020

If you are on windows. Try creating a batch file, and put the batch file inside scrcpy folder and open that batch file instead of scrcpy.exe.

How to create and enable batch file in Windows

Here is what I put in my batch file:

@ECHO OFF 
:: Batch file for scrcpy wireless
TITLE scrcpy wireless
ECHO >> Make sure you enabled adb debugging on your device.
ECHO >> Plug your device via usb for the 1st time or if it's failing to start.
ECHO >> Connect the device to the same Wi-Fi as your computer.
:: step 1: Enable adb over TCP/IP on your device: adb tcpip 5555
ECHO =======================================
ECHO Enabling adb over TCP/IP on your device
ECHO =======================================
adb tcpip 5555
ECHO >> Unplug your device
:: step 2: Connect to your device: adb connect DEVICE_IP:5555 (replace DEVICE_IP).
ECHO =======================================
ECHO Connecting wirelessly to your device
ECHO =======================================
adb connect DEVICE_IP:5555
:: step 3: Run scrcpy as usual.
ECHO =======================================
ECHO starting scrcpy wielessly.
ECHO =======================================
scrcpy --bit-rate 2M --max-size 800
:: It may be useful to decrease the bit-rate and the definition
PAUSE

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

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

No need to plug usb cable anymore afterwards.

@robertsaron
Copy link
Author

@fusionneur Do I enable root through ADB on my android phone? Or turn on Root in the ADB shello, on my windows computer?
I have looked on line for both, and need some help on both. Will you please elaborate.

@Uj947nXmRqV2nRaWshKtHzTvckUUpD
Copy link

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented Oct 13, 2020

While usb cable is connected:

  1. in termux:
    su
    setprop persist.adb.tcp.port 5555
    setprop service.adb.tcp.port 5555
    stop adbd
    start adbd

  2. Alternatively you can send the command with adb:
    adb shell 'su --command "setprop persist.adb.tcp.port 5555"'
    #adb shell 'su --command "setprop service.adb.tcp.port 5555"' #this is not really needed in this case
    adb tcpip 5555 #if you want to start right away
    adb connect wlan0_ip:5555 #where wlan0_ip is the phone's wlan ip

You can get wlan0 ip with:
adb shell 'su -c "ifconfig wlan0"'

scrcpy

you can unplug the usb cable.

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

I wrote a script to assist wireless connections.

https://github.com/fusionneur/ethernally

I tested in various scenarios and looks fine. If you find any problem, please open an issue. Thank you

@robertsaron
Copy link
Author

@fusionneur any way to get this script to work on windows? I tried to follow your steps on my device using termux, and got my device rooted. Termux, tells me no su program found on this device. I also tried @mjjauhar batch file and that did not work either. So either I am doing something wrong, or wireless is just not for me.

@Uj947nXmRqV2nRaWshKtHzTvckUUpD
Copy link

Uj947nXmRqV2nRaWshKtHzTvckUUpD commented Oct 17, 2020

you can run the shell script in windows through cygwin or windows subsystem for linux or through a linux virtual machine installed in vmware/virtualbox - in windows

Just one question.. you said "got my device rooted. Termux, tells me no su program found on this device. " but these 2 things contradict each other. Are you really rooted? You should have magisk installed if you're rooted and 'su' should work in termux in this case

@robertsaron
Copy link
Author

I do not have magisk installed. When Rooting my device it wiped everything and I did not know that would happen. So I am not sure if I want to proceed. How hard is it to get magisk installed?

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

rooting itself shouldn't wipe, only unlocking bootloader wipes it - which is however a prerequisite step for first time rooting. What device do you have? Some devices are more tricky to root than others. Personally I follow xda guides that are device specific when rooting.

@robertsaron
Copy link
Author

I have the Pixel2 XL. And yeah this was my first time rooting it. I unlocked the bootloader.

@robertsaron
Copy link
Author

I somehow got the batch file working that another user posted. I am good on the wireless for now. Though I would at somepoint like to finish the root process.

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

for rooting I suppose you could follow this guide: https://www.youtube.com/watch?v=aMPRRQu1hCk

@Uj947nXmRqV2nRaWshKtHzTvckUUpD

I created this tool to ease wireless connectivity. Check it out and let me know of your experience.

https://github.com/fusionneur/ethernally

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

4 participants