v1.21
Genymobile/scrcpyv1.21Nov 29, 2021by rom1v
AI Summary
Enhanced TCP/IP connectivity with tunneling support, improved Android 12 compatibility, and refined HID keyboard interactions.
Key Highlights
- Added simplified TCP/IP connection option
- Added tunneling options for remote ADB servers
- Improved Android 12 compatibility for settings
- Added 'raw key events' mode for HID injection
New Features
- --tcpip
- --raw-key-events
- --no-clipboard-autosync
- --tunnel-host
- --tunnel-port
- Improved Android 12 support
- Fixed HID keyboard Ctrl+v clipboard sync
Full Release Notes
_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: ```bash 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: ```bash 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][tunnels]. 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: ```bash adb kill-server adb -a nodaemon server start # keep this open ``` Then, from another terminal, run scrcpy: ```bash 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][ssh-tunnel] instead. [tunnels]: https://github.com/Genymobile/scrcpy#tunnels [ssh-tunnel]: https://github.com/Genymobile/scrcpy#ssh-tunnel ## 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][textevents] generated when typing text: - _key events_, signaling that a key is pressed or released; - _text events_, signaling that a text has been entered. [textevents]: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-text-input 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._ [text injection preference]: https://github.com/Genymobile/scrcpy#text-injection-preference ## 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](https://github.com/Genymobile/scrcpy#copy-paste) (see [v1.15 highlights](https://github.com/Genymobile/scrcpy/releases/tag/v1.15)), on <kbd>Ctrl</kbd>+<kbd>v</kbd>, a request to synchronize the computer clipboard to the device clipboard is performed before injecting <kbd>Ctrl</kbd>+<kbd>v</kbd>. But when HID keyboard (introduced in scrcpy v1.20), is enabled, the <kbd>Ctrl</kbd>+<kbd>v</kbd> 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: e4163321f00bb3830c6049bdb6c1515e7cc668a0. Then it was increased to 5ms: 45b0f8123a52f5c73a5860d616f4ceba2766ca6a. But even with 5ms, the wrong behavior sometimes happens. To handle it properly, this new version implements an acknowledgment mechanism, so that <kbd>Ctrl</kbd>+<kbd>v</kbd> is injected over AOA only after the clipboard synchronization request has been performed and acknowledged by the server (#2814). This ensures that <kbd>Ctrl</kbd>+<kbd>v</kbd> 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 <kbd>Ctrl</kbd>+<kbd>v</kbd>, 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 <kbd>MOD</kbd>+<kbd>c</kbd>, <kbd>MOD</kbd>+<kbd>x</kbd> and <kbd>MOD</kbd>+<kbd>v</kbd> still allow explicit copy, cut and paste, even in this mode.