site  contact  subhomenews

scrcpy display and control Android device

April 18, 2022 — BarryK

The question was asked by forum member 'jesudia':

https://forum.puppylinux.com/viewtopic.php?t=5679

At the time, I was busy with other stuff, so only gave a minimal response. Today took a good look at it. Compiled, tested and a PET created. This is how I compiled it...

Firstly, downloaded version 1.23 source plus pre-compiled server, from here:

https://github.com/Genymobile/scrcpy

Compiled and installed:

# meson x --buildtype=release --strip --prefix=/usr -Db_lto=true -Dprebuilt_server=`pwd`/../scrcpy-server-v1.23
# ninja -Cx
# DESTDIR='' new2dir ninja -Cx install

Connected my phone by USB cable -- warning, make sure the cable handles data transfer and is not just a charging cable. "USB debugging" is enabled on the phone. Then ran the executable:

# scrcpy
scrcpy 1.23 <https://github.com/Genymobile/scrcpy>
* daemon not running. starting it now on port 5037 *
ADB server didn't ACK
* failed to start daemon *
ERROR: "adb start-server" returned with value 255
ERROR: Could not start adb daemon
ERROR: Server connection failed
#

Oh. Started 'adb' separately:

# adb start-server
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
#

...a popup on phone needs response to authorise connection. Perhaps I missed that the first time. I found that 'scrcpy' then worked. However, started again, killed 'adb', then ran 'scrcpy', this time it worked:

# scrcpy
scrcpy 1.23 <https://github.com/Genymobile/scrcpy>
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
3734 KB/s (41123 bytes in 0.010s)
[server] INFO: Device: HUAWEI STK-L22 (Android 10)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 21.3.7
INFO: Trilinear filtering enabled
INFO: Initial texture: 1080x2336

Fantastic, got the phone screen on the computer monitor:

img1

Amazing, everything works! Flipping the phone to portrait orientation also flipped on the computer screen. Copy and paste to and from clipboard works between phone and computer. Drag and drop a file from computer to /sdcard/Download works (location can be changed), but couldn't see how to do the reverse.

Was able to send an sms (typing on computer keyboard), and answered a phone call. Played a YouTube video.

img4

I am not planning to include it built-in in the next release of Easy, but it is now a PET that can be installed via the package manager, or direct download (118KB):

https://distro.ibiblio.org/easyos/amd64/packages/pet/pet_packages-dunfell/scrcpy-1.23-dunfell64.pet

There is no menu entry, you will have to run it from a terminal. There are various commandline options to play with:

https://manpages.debian.org/testing/scrcpy/scrcpy.1.en.html

Fascinating app!    

Tags: easy