Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
103.03k stars 10.01k forks source link

SCRCPY wifi #4866

Open Step72 opened 3 weeks ago

Step72 commented 3 weeks ago

Environment

Good morning I have a question regarding SCRCPY If I don't let SCRCPY connect via USB to my computer, when I start my computer in the morning, I have to reconnect SCRCPY via USB and redo the adb tcpip 5555 procedure to be able to use SCRCPY via WIFI

Is there a way when I start my computer that SCRCPY detects and works automatically over Wi-Fi

rom1v commented 3 weeks ago

You must execute adb tcpip 5555 on every phone reboot. But not on computer reboot.

Step72 commented 3 weeks ago

Ok but my phone must always be connected to my computer!

rom1v commented 3 weeks ago

If you don't want to connect over USB at all, as mentioned in the doc, from Android 11 you can pair wirelessly: https://developer.android.com/tools/adb#wireless-android11-command-line

Step72 commented 3 weeks ago

If I type in my terminal adb pair 192.168.1.16:5555 I don't receive any code association requests on my phone !

rom1v commented 3 weeks ago

Did you enable wireless debugging?

Please follow the steps here, I cannot help more, it's the official Android documentation: https://developer.android.com/tools/adb#wireless-android11-command-line

Step72 commented 3 weeks ago

Good morning In the morning, when I start my computer, and I want to connect to SCRCPY directly via Wi-Fi, I have to each time in my terminal type adb connect 192.168.1.16:5555 THEN scrcpy -s 192.168.1.16:5555 to connect to my phone via wifi.

Why if I directly type scrcpy -s 192.168.1.16:5555 do I not connect via Wi-Fi to my phone?

rom1v commented 3 weeks ago

scrcpy -s XXXX just selects a device listed by adb devices (like adb -s XXXX shell would do), it does not create any new connection.

So if your device is not connected, you must connect using adb connect XXXX beforehand (so that it is listed by adb devices).

But instead, you can use scrcpy --tcpip=192.168.1.16:5555 and it will connect if necessary. See https://github.com/Genymobile/scrcpy/blob/master/doc/connection.md#tcpip-wireless

Step72 commented 3 weeks ago

But instead, you can use scrcpy --tcpip=192.168.1.16:5555 and it will connect if necessary.

With this method it works really well. Thank you so much