IRC:scrcpy [2020-05-23]

scrcpy - using a native build at linux mint 19.3 or LMDE 4

logo - [click to enlarge]

[click to enlarge]

scrcpy does allow to share and operate your android device via usb-cable or wifi with your linux desktop.

scrcpy is not available via the official repositories or a ppa as a native installable version with linux mint 19.3 or LMDE4.

If "polluting" your linux mint with a snap-install (and it's side effects) is not an option for you, or if you simply do not want to add 240 MB extra environment, to run a 72 KB application, you could use the following tutorial to:

Only to be used at linux mint 19.3 or LMDE 4

The instructions are meant to be used at linux mint 19.3 or LMDE 4 only. With upcoming mint 20 it's expected, that scrcpy might be available using the official repositories.

install prebuilt scrcpy-client

If you want to avoid setting up a build-environment and built the scrcpy-client on your own, you can use prebuilt versions and a setup-tool/helper-script, caring about to get the required dependencies installed.

The helper-script does care about to install required dependencies and the required adb-package to use scrcpy later:

Note: the offered --remove (uninstall) option of the helper-script does not uninstall the above package (you have to remove them on your own if needed) but only the scrcpy-related binary files and the created symbolic link.

Using the helper-script to install

source <(wget https://www.orcus.de/Entities/linux/ot-inst-scrcpy.sh -O -) --install
[click to show typical output...}
demo@lmde-4-cinnamon-64bit:/home/demo$ source <(wget https://www.orcus.de/Entities/linux/ot-inst-scrcpy.sh -O -) --install
--2020-05-28 01:12:02--  https://www.orcus.de/Entities/linux/ot-inst-scrcpy.sh
... REMOVED OUTPUT ...
2020-05-28 01:12:03 (970 KB/s) - written to stdout [5543/5543]

ot-inst-scrpy V003 2020-05-28
install/remove:
 * scrcpy-server by GeanyMotion
 * prebuilt scrcpy-client by orcus
 * required dependencies + adb (install only)
--------------------------------------------------------
running at LMDE 4 Debbie OK - supported
using:
--------------------------------------------------------
https://github.com/Genymobile/scrcpy/releases/download/v1.13/scrcpy-server-v1.13
https://orcus.de/Entities/linux/scrcpy-v1.13-prebuilt-orcus-lmde4
--------------------------------------------------------
--install selected	press [ENTER] to continue, [CTRL+C] to abort

--------------------------------------------------------
ot-inst-scrpy V003 2020-05-28
install started: Thu 28 May 2020 01:12:13 AM CEST
logfile is: ot-inst-scrpy-v1.13.log
--------------------------------------------------------
dostep: sudo apt-get --yes install ffmpeg libsdl2-2.0-0 adb ...
--------------------------------------------------------
[sudo] password for demo:         
Reading package lists...
Building dependency tree...
Reading state information...
... REMOVED OUTPUT ...
...OK
--------------------------------------------------------
dostep: sudo mkdir -p /usr/local/share/scrcpy ...
--------------------------------------------------------
...OK
--------------------------------------------------------
dostep: sudo wget https://github.com/Genymobile/scrcpy/releases/download/v1.13/scrcpy-server-v1.13 -O /usr/local/share/scrcpy/scrcpy-server ...
--------------------------------------------------------
--2020-05-28 01:12:20--  https://github.com/Genymobile/scrcpy/releases/download/v1.13/scrcpy-server-v1.13
... REMOVED OUTPUT ...
2020-05-28 01:12:22 (223 KB/s) - ‘/usr/local/share/scrcpy/scrcpy-server’ saved [27694/27694]

...OK
--------------------------------------------------------
dostep: sudo wget https://orcus.de/Entities/linux/scrcpy-v1.13-prebuilt-orcus-lmde4 -O /usr/local/share/scrcpy/scrcpy-v1.13-prebuilt-orcus-lmde4 ...
--------------------------------------------------------
--2020-05-28 01:12:22--  https://orcus.de/Entities/linux/scrcpy-v1.13-prebuilt-orcus-lmde4
... REMOVED OUTPUT ...
2020-05-28 01:12:22 (735 KB/s) - ‘/usr/local/share/scrcpy/scrcpy-v1.13-prebuilt-orcus-lmde4’ saved [77600/77600]

...OK
--------------------------------------------------------
dostep: sudo chmod +x /usr/local/share/scrcpy/scrcpy-v1.13-prebuilt-orcus-lmde4 ...
--------------------------------------------------------
...OK
--------------------------------------------------------
dostep: sudo ln -sf /usr/local/share/scrcpy/scrcpy-v1.13-prebuilt-orcus-lmde4  /usr/local/bin/scrcpy ...
--------------------------------------------------------
...OK
--------------------------------------------------------
Installation done
read https://www.orcus.de/IRC/scrcpy.htm#test for instructions howto use scrcpy

If you want to get rid of the installed files:

source <(wget https://www.orcus.de/Entities/linux/ot-inst-scrcpy.sh -O -) --remove
[click to show typical output...}
demo@lmde-4-cinnamon-64bit:/home/demo$ source <(wget https://www.orcus.de/Entities/linux/ot-inst-scrcpy.sh -O -) --remove
--2020-05-28 01:19:31--  https://www.orcus.de/Entities/linux/ot-inst-scrcpy.sh
... REMOVED OUTPUT ...
2020-05-28 01:19:31 (909 KB/s) - written to stdout [5543/5543]

ot-inst-scrpy V003 2020-05-28
install/remove:
 * scrcpy-server by GeanyMotion
 * prebuilt scrcpy-client by orcus
 * required dependencies + adb (install only)
--------------------------------------------------------
running at LMDE 4 Debbie OK - supported
using:
--------------------------------------------------------
https://github.com/Genymobile/scrcpy/releases/download/v1.13/scrcpy-server-v1.13
https://orcus.de/Entities/linux/scrcpy-v1.13-prebuilt-orcus-lmde4
--------------------------------------------------------
--remove selected	press [ENTER] to continue, [CTRL+C] to abort

remove: /usr/local/bin/scrcpy
remove: /usr/local/share/scrcpy
remove: this installed packages/tools do NOT get removed intentionally
remove: to avoid nested removal of dependant applications:
remove: ffmpeg libsdl2-2.0-0 adb

After installation you should be able to cast your android phone at and use it from your linux mint 19.3 or LMDE4 installation following:

build scrcpy-client from source

If you are prefer to build the client yourself, you cold use this instructions (the server-side can be used as offered by Genymotion and will be downloaded for their website).

Notes - before you start

Timeshift snapshot - using or not

You should only use timeshift for snapshot if you have at least 30 GiB of free disk-space at your root filesystem (the default location for timeshift snapshots).

If you got not enough free diskspace, using timeshift might get you into trouble by filling up the filesystem entirely (fixable, but annoying).

Preparations

Create a timeshift snapshot A

Install available updates, using the update-manager

Reboot and do some basic tests to proof the machine is working as expected. Now shutdown (not only reboot), to proof that shutdown is working as expected.

If you face issues after update: fix issues BEFORE you continue; or if you cant fix them: restore timeshift snapshot A and install only the working updates. reboot/retest/shutdown until everything is working as expected.

Create a timeshift snapshot B (which is obviously for the case where you ran into trouble during the installation, to be able to revert changes).

Setup build-environment

1) install build-toochain + dependencies :

apt install build-essential \
git pkg-config meson ninja-build \
libavcodec-dev libavformat-dev libavutil-dev libsdl2-dev \
python3-pip python3-setuptools \
ffmpeg libsdl2-2.0-0 adb

2) update / install python tools

pip3 install wheel meson

3) get current source and prebuilt scrpy-server

mkdir -p ~/build/Genymobile
cd ~/build/Genymobile
git clone https://github.com/Genymobile/scrcpy
wget https://github.com/Genymobile/scrcpy/releases/download/v1.13/scrcpy-server-v1.13

logout & login to update environment

4) Logout and login again: This step is REQUIRED if you didn't use "pip3 install" before and your PATH has not been updated to cover your ~/.local/bin directory. Otherwise your build will fail, as the updated meson-version is not found and the default-version is too old.

(yes you might be tempted to add $HOME/.local/bin manually to the PATH, BUT you will end up with an duplicate entry after you booted/login the next time...)

5) After logout and login, the PATH + the found meson-version look like this:

echo $PATH
/home/<your-user-name-here>/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
meson --version
0.54.2

Build the client and Install

6) build the client

Build scrcpy:

cd ~/build/Genymobile/scrcpy
meson x --buildtype release --strip -Db_lto=true -Dprebuilt_server=../scrcpy-server-v1.13
ninja -Cx

7) if the build did run without issues - you can install scrcpy finally

sudo ninja -Cx install

Connect and use your mobile device - USB

android smartphone

Turn on developer-mode.

At the developer-options: turn on USB debugging.

Connect your android phone using an usb-cable.

Activate in usb-preferences, Use usb for: file transfer.

linux mint

List available devices (should list your phone if being detected), using:

adb devices -l

You should not need any special options to run scrcpy:

scrcpy

Should show your phone at your linux desktop, which you can operate using your mouse and keyboard.

You likely want to bookmark or at least luckup the available shortcuts for scrcpy - like for rotating the screen etc:

https://github.com/Genymobile/scrcpy#user-content-shortcuts

Connect and use your mobile device - WIFI

Notes - WIFI

With some wifi-routers (FritzBox for example) you might need to give devices permission to access each other, to be able to connect to your phone using adb/scrcpy.

Using a guest network offered by some router models will likely prevent devices to be reachable via the other devices, and should be avoided.

You have to setup your phone for usb-debugging before you can use the additional settings for WIFI-support.

Keep the phone connected using the usb-cable at the moment until you finished the setup for wifi.

android smartphone

Lookup your current IP - in the sample it's 192.168.0.200 - but your IP will likely differ.

linux mint

If scrcpy is still runnning - close the window now.

Setup to use tcpip and define a port for adb by:

adb tcpip 5555

adb should state that it's restarting in tcpip-mode using port 5555.

Connect adb to the android phone - using it's current ip and the previous defined port (adjust the IP to match yours):

adb connect 192.168.0.200:5555

adb should state that it's connected to <your-ip-here>:5555

Run scrcpy will upload an additional apk and should show your android gui again at your desktop.

scrcpy

Disconnect your phone from the usb-cable. You can now operate your android phone without usb-cable.

As long you do not turn off developer-mode at your mobile, you can quit and restart scrcpy repeatedly without the need of an usb-cable.

If you leave your linux-session. You will need to setup adb again to use tcpip and define the port and run the adb-connect command (should still not require to connect the mobile using the usb-cable).

Related information

IRC:bootgrub.htmentering grub-menu on boot
IRC:bootkernel.htmSelect a kernel on boot

© 1998-2023 by ORCUS® GmbH - www.orcus.de (imprint) - we strictly do not track (period) - details: privacy - overview IRC: IRC support

note-1: not tracking does mean too - we are strictly NOT using direct external links within the content = we bother you having to copy&paste offered URLs