Skip to content

scrcpy v1.21

Compare
Choose a tag to compare
@rom1v rom1v released this 29 Nov 21:35
· 1098 commits to master since this release
v1.21

To receive a notification on new releases, click on Watch > Releases only on the top.


scrcpy v1.21

Changes since v1.20:

  • Add --tcpip option to automate TCP/IP (wireless) connections (#2827)
  • Add --raw-key-events to always inject key events and ignore text events (#2816, #2831)
  • Add --no-clipboard-autosync to disable automatic clipboard synchronization (#2228, #2817, #2834)
  • Add --tunnel-host and --tunnel-port options (#2801, #2807)
  • Ensure clipboard synchronization is performed before injecting Ctrl+v via HID keyboard (#2814)
  • Adapt read/write settings for Android 12 (#2671, #2788, #2802)
  • Fix hanging with multiple scrcpy instances on Windows (#2779, #2783)
  • Fix quick interruption on Ctrl+c during server starting
  • Print help to stdout (instead of stderr)
  • Various technical refactors and fixes

NOTE: This version does not work on Windows 7 (#2838). A development version including a fix is available here: #2840.


Highlights

Simplify TCP/IP (wireless) configuration

Scrcpy uses adb to communicate with the device. To use scrcpy wirelessly, the users had to find the device IP address and connect via TCP/IP using adb directly.

For convenience, this version introduces a new option to configure TCP/IP connections automatically, with two variants.

If the device (accessible at 192.168.1.1 in this example) already listens on a port (typically 5555) for incoming adb connections, then run:

scrcpy --tcpip=192.168.1.1       # default port is 5555
scrcpy --tcpip=192.168.1.1:5555

If the adb TCP/IP mode is disabled (or if you don't know the IP address), connect the device over USB, then run:

scrcpy --tcpip    # without arguments

It will automatically find the device IP address (by parsing adb shell ip route), enable TCP/IP mode, then connects to the device before starting.

Configure tunneling

Two new options --tunnel-host and --tunnel-port (implemented by @RipleyTom) allow to connect to a remote ADB server. This allows for example to mirror a device plugged on another computer easily.

To connect to a remote ADB server (for example 192.168.1.2), make the server listen on all interfaces:

adb kill-server
adb -a nodaemon server start
# keep this open

Then, from another terminal, run scrcpy:

export ADB_SERVER_SOCKET=tcp:192.168.1.2:5037
scrcpy --tunnel-host=192.168.1.2

Note that all ADB communications between the server and the client are unencrypted.

To connect to a remote ADB server over the Internet, it is strongly recommended to use a SSH tunnel instead.

Improve Android 12 support

The way scrcpy was accessing to the settings is now blocked in Android 12 due to permission changes. In practice, --stay-awake (#2671) and --show-touches (#2788) were broken.

An alternative implementation (#2802) fixes the issue.

Add "raw key events" mode

There are two kinds of events generated when typing text:

  • key events, signaling that a key is pressed or released;
  • text events, signaling that a text has been entered.

By default, letters are injected using key events, so that the keyboard behaves as expected in games (typically for WASD keys).

An option --prefer-text allows to inject text events even for letters and space (see text injection preference).

This version introduces a new option (--raw-key-events, #2831), which always injects key events and ignores all text events.

This will typically result in the insertion of wrong characters for some keyboard layouts, but it may help a lot with some others (e.g. Chinese).

This option is only meaningful for the default injection method: with HID keyboard (--hid-keyboard), all keys are sent as scancodes.

Fix hanging on multiple instances on Windows

Scrcpy v1.20 introduced an important regression on Windows, preventing to launch several scrcpy instances simultaneously on Windows (#2779). It is fixed (by #2783) in this new version.

HID keyboard and Ctrl+v

To allow seamless copy-paste (see v1.15 highlights), on Ctrl+v, a request to synchronize the computer clipboard to the device clipboard is performed before injecting Ctrl+v.

But when HID keyboard (introduced in scrcpy v1.20), is enabled, the Ctrl+v injection is not sent on the same channel as the clipboard request, so they are not serialized, and may occur in any order. As a consequence, it could happen that the old clipboard content was pasted instead of the new one.

In v1.20, to minimize the probability of occurrence of the wrong order, a delay of 2 milliseconds was added before injecting Ctrl+v: e416332. Then it was increased to 5ms: 45b0f81. But even with 5ms, the wrong behavior sometimes happens.

To handle it properly, this new version implements an acknowledgment mechanism, so that Ctrl+v is injected over AOA only after the clipboard synchronization request has been performed and acknowledged by the server (#2814).

This ensures that Ctrl+v with an HID keyboard always pastes the expected content.

Optionally disable seamless copy-paste

By default, scrcpy automatically synchronizes the computer clipboard to the device clipboard before injecting Ctrl+v, and the device clipboard to the computer clipboard whenever it changes.

A new option --no-clipboard-autosync disables this automatic synchronization. This also disables the acknowledgment mechanism described above.

The scrcpy shortcuts MOD+c, MOD+x and MOD+v still allow explicit copy, cut and paste, even in this mode.