I want to control (send text message receive calls etc.) my android phone with my laptop as I was doing in windows
kdeconnect is a really nice app and you can use it to do pretty much anything you did on windows. install
indicator-kdeconnect from the aur. also install kde connect app from play store
You can use
sudo pacman -S scrcpy
Okay I have installed now what should I do to connect my phone via Wi-Fi
I have installed in my laptop as per your instruction or given command
Before trying the wireless connection, check if the wired connection works correctly.
I have not tried this, but it is documented here. GitHub - Genymobile/scrcpy: Display and control your Android device
You can enter it manually.
Have you enabled USB Debugging?
I was doing this just now using scrcpy while i didn’t want to connect a cable
if your phone’s android is 11 or greater then
- enable developer options
- enable usb debugging
- enable adb over wifi
- disable adb permissions revoking
- enable usb debugging (security settings)
- and finally connect once via code
also you must have static ip for the phone ,preferably via the router
after all these and if you reboot your phone or disable adb over wifi, you just enable again adb over wifi and note the port your phone is telling you to use (port is different every time you re-enable adb over wifi or reboot)
here is my script to automate the job (change phone’s ip accordingly)
#!/bin/bash adb kill-server wait echo " " if [ ! -f /tmp/port ]; then echo What is the phones port? echo " " read port touch /tmp/port wait echo $port > /tmp/port echo " " fi read -r port < /tmp/port wait adb connect 192.168.1.4:$port wait echo " " if adb get-state 1>/dev/null 2>&1 then scrcpy -b 2M -m 1070 -S -t -w --window-height 1070 --power-off-on-close --disable-screensaver --tcpip=192.168.1.4:$port wait echo " " adb disconnect 192.168.1.4:$port wait echo " " adb kill-server wait exit else adb kill-server wait echo " " while [[ -z $(adb get-state) ]] do adb kill-server wait echo " " echo What is the phones port? echo " " read port wait echo $port > /tmp/port adb connect 192.168.1.4:$port wait echo " " done scrcpy -b 2M -m 1070 -S -t -w --window-height 1070 --power-off-on-close --disable-screensaver --tcpip=192.168.1.4:$port wait echo " " adb disconnect 192.168.1.4:$port wait echo " " adb kill-server wait exit fi
REMEMBER TO ALWAYS DISABLE ADB OVER WIFI AFTER YOU ARE DONE (to avoid unwanted wireless connections to your phone by others nearby)
scrcpy documentation and switches here
Is there anyway to get port automatically ? Or set static port in phone ?
Going to setting and then developer option and then wireless debug and then get port, its long process
you can’t get port automatically and can’t set static port as far as i know but i am pretty noob to linux
i am trying to store port and perform checks so you can avoid entering the port number if it hasn’t changed since last session
if anyone has a better - more automatic solution i 'll be happy to hear it too
Its 5555 by default.
adb over wifi dictates specific ports issued by the os i believe
you can’t redirect or change them if you are not connected already so can’t avoid asked for the issued port
Ok i made changes to the script so
it stores the port number to a temp file and doesn’t ask for port as long as phone is not rebooted or adb over wifi isn’t disabled (every time it is re-enabled it get’s a new port) or temp folder isn’t cleared
to exit scrcpy just close it’s window (and don’t close the terminal so it can carry out all the necessary commands, it exits automatically)
it’s the best i can do with my current bash skills
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.