Compare commits
8 Commits
v1.22
...
downscale-
Author | SHA1 | Date | |
---|---|---|---|
c0a75ca746 | |||
f02f2135cd | |||
9b4360b6b8 | |||
c8d0f5cdeb | |||
22d9f0faf4 | |||
a1967b4dfd | |||
a86deab3d4 | |||
f4c7044b46 |
6
BUILD.md
6
BUILD.md
@ -270,10 +270,10 @@ install` must be run as root)._
|
||||
|
||||
#### Option 2: Use prebuilt server
|
||||
|
||||
- [`scrcpy-server-v1.21`][direct-scrcpy-server]
|
||||
_(SHA-256: dbcccab523ee26796e55ea33652649e4b7af498edae9aa75e4d4d7869c0ab848)_
|
||||
- [`scrcpy-server-v1.22`][direct-scrcpy-server]
|
||||
_(SHA-256: c05d273eec7533c0e106282e0254cf04e7f5e8f0c2920ca39448865fab2a419b)_
|
||||
|
||||
[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.21/scrcpy-server-v1.21
|
||||
[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.22/scrcpy-server-v1.22
|
||||
|
||||
Download the prebuilt server somewhere, and specify its path during the Meson
|
||||
configuration:
|
||||
|
2
FAQ.md
2
FAQ.md
@ -305,4 +305,4 @@ This FAQ is available in other languages:
|
||||
|
||||
- [Italiano (Italiano, `it`) - v1.19](FAQ.it.md)
|
||||
- [한국어 (Korean, `ko`) - v1.11](FAQ.ko.md)
|
||||
- [简体中文 (Simplified Chinese, `zh-Hans`) - v1.18](FAQ.zh-Hans.md)
|
||||
- [简体中文 (Simplified Chinese, `zh-Hans`) - v1.22](FAQ.zh-Hans.md)
|
||||
|
@ -1,7 +1,12 @@
|
||||
只有原版的[FAQ](FAQ.md)会保持更新。
|
||||
本文根据[d6aaa5]翻译。
|
||||
_Only the original [FAQ.md](FAQ.md) is guaranteed to be up-to-date._
|
||||
|
||||
[d6aaa5]:https://github.com/Genymobile/scrcpy/blob/d6aaa5bf9aa3710660c683b6e3e0ed971ee44af5/FAQ.md
|
||||
_只有原版的 [FAQ.md](FAQ.md)是保证最新的。_
|
||||
|
||||
Current version is based on [28054cd]
|
||||
|
||||
本文根据[28054cd]进行翻译。
|
||||
|
||||
[28054cd]: https://github.com/Genymobile/scrcpy/blob/28054cd471f848733e11372c9d745cd5d71e6ce7/FAQ.md
|
||||
|
||||
# 常见问题
|
||||
|
||||
@ -9,11 +14,11 @@
|
||||
|
||||
## `adb` 相关问题
|
||||
|
||||
`scrcpy` 执行 `adb` 命令来初始化和设备之间的连接。如果`adb` 执行失败了, scrcpy 就无法工作。
|
||||
`scrcpy` 执行 `adb` 命令来初始化和设备之间的连接。如果 `adb` 执行失败了, scrcpy 就无法工作。
|
||||
|
||||
在这种情况中,将会输出这个错误:
|
||||
|
||||
> ERROR: "adb push" returned with value 1
|
||||
> ERROR: "adb get-serialno" returned with value 1
|
||||
|
||||
这通常不是 _scrcpy_ 的bug,而是你的环境的问题。
|
||||
|
||||
@ -33,28 +38,37 @@ adb devices
|
||||
|
||||
### 设备未授权
|
||||
|
||||
参见这里 [stackoverflow][device-unauthorized].
|
||||
|
||||
> error: device unauthorized.
|
||||
> This adb server's $ADB_VENDOR_KEYS is not set
|
||||
> Try 'adb kill-server' if that seems wrong.
|
||||
> Otherwise check for a confirmation dialog on your device.
|
||||
|
||||
连接时,在设备上应该会打开一个弹出窗口。 您必须授权 USB 调试。
|
||||
|
||||
如果没有打开,参见[stackoverflow][device-unauthorized].
|
||||
|
||||
[device-unauthorized]: https://stackoverflow.com/questions/23081263/adb-android-device-unauthorized
|
||||
|
||||
|
||||
### 未检测到设备
|
||||
|
||||
> adb: error: failed to get feature set: no devices/emulators found
|
||||
> error: no devices/emulators found
|
||||
|
||||
确认已经正确启用 [adb debugging][enable-adb].
|
||||
|
||||
如果你的设备没有被检测到,你可能需要一些[驱动][drivers] (在 Windows上).
|
||||
如果你的设备没有被检测到,你可能需要一些[驱动][drivers] (在 Windows上)。这里有一个单独的 [适用于Google设备的USB驱动][google-usb-driver].
|
||||
|
||||
[enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling
|
||||
[drivers]: https://developer.android.com/studio/run/oem-usb.html
|
||||
[google-usb-driver]: https://developer.android.com/studio/run/win-usb
|
||||
|
||||
|
||||
### 已连接多个设备
|
||||
|
||||
如果连接了多个设备,您将遇到以下错误:
|
||||
|
||||
> adb: error: failed to get feature set: more than one device/emulator
|
||||
> error: more than one device/emulator
|
||||
|
||||
必须提供要镜像的设备的标识符:
|
||||
|
||||
@ -90,19 +104,19 @@ scrcpy
|
||||
### 设备断开连接
|
||||
|
||||
如果 _scrcpy_ 在警告“设备连接断开”的情况下自动中止,那就意味着`adb`连接已经断开了。
|
||||
请尝试使用另一条USB线或者电脑上的另一个USB接口。
|
||||
请参看 [#281] 和 [#283]。
|
||||
|
||||
请尝试使用另一条USB线或者电脑上的另一个USB接口。请参看 [#281] 和 [#283]。
|
||||
|
||||
[#281]: https://github.com/Genymobile/scrcpy/issues/281
|
||||
[#283]: https://github.com/Genymobile/scrcpy/issues/283
|
||||
|
||||
|
||||
## 控制相关问题
|
||||
|
||||
### 鼠标和键盘不起作用
|
||||
|
||||
|
||||
在某些设备上,您可能需要启用一个选项以允许 [模拟输入][simulating input]。
|
||||
|
||||
在开发者选项中,打开:
|
||||
|
||||
> **USB调试 (安全设置)**
|
||||
@ -115,10 +129,12 @@ scrcpy
|
||||
|
||||
可输入的文本[被限制为ASCII字符][text-input]。也可以用一些小技巧输入一些[带重音符号的字符][accented-characters],但是仅此而已。参见[#37]。
|
||||
|
||||
自 Linux 上的 scrcpy v1.20 之后,可以模拟[物理键盘][hid] (HID)。
|
||||
|
||||
[text-input]: https://github.com/Genymobile/scrcpy/issues?q=is%3Aopen+is%3Aissue+label%3Aunicode
|
||||
[accented-characters]: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-accented-characters
|
||||
[#37]: https://github.com/Genymobile/scrcpy/issues/37
|
||||
[hid]: README.md#physical-keyboard-simulation-hid
|
||||
|
||||
|
||||
## 客户端相关问题
|
||||
@ -129,7 +145,6 @@ scrcpy
|
||||
|
||||
[#40]: https://github.com/Genymobile/scrcpy/issues/40
|
||||
|
||||
|
||||
为了提升降尺度的质量,如果渲染器是OpenGL并且支持mip映射,就会自动开启三线性过滤。
|
||||
|
||||
在Windows上,你可能希望强制使用OpenGL:
|
||||
@ -177,6 +192,7 @@ scrcpy
|
||||
## 崩溃
|
||||
|
||||
### 异常
|
||||
|
||||
可能有很多原因。一个常见的原因是您的设备无法按给定清晰度进行编码:
|
||||
|
||||
> ```
|
||||
@ -204,12 +220,40 @@ scrcpy -m 1024
|
||||
scrcpy -m 800
|
||||
```
|
||||
|
||||
自 scrcpy v1.22以来,scrcpy 会自动在失败前以更低的分辨率重试。这种行为可以用`--no-downsize-on-error`关闭。
|
||||
|
||||
你也可以尝试另一种 [编码器](README.md#encoder)。
|
||||
|
||||
|
||||
如果您在 Android 12 上遇到此异常,则只需升级到 scrcpy >= 1.18 (见 [#2129]):
|
||||
|
||||
```
|
||||
> ERROR: Exception on thread Thread[main,5,main]
|
||||
java.lang.AssertionError: java.lang.reflect.InvocationTargetException
|
||||
at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:75)
|
||||
...
|
||||
Caused by: java.lang.reflect.InvocationTargetException
|
||||
at java.lang.reflect.Method.invoke(Native Method)
|
||||
at com.genymobile.scrcpy.wrappers.SurfaceControl.setDisplaySurface(SurfaceControl.java:73)
|
||||
... 7 more
|
||||
Caused by: java.lang.IllegalArgumentException: displayToken must not be null
|
||||
at android.view.SurfaceControl$Transaction.setDisplaySurface(SurfaceControl.java:3067)
|
||||
at android.view.SurfaceControl.setDisplaySurface(SurfaceControl.java:2147)
|
||||
... 9 more
|
||||
```
|
||||
|
||||
[#2129]: https://github.com/Genymobile/scrcpy/issues/2129
|
||||
|
||||
|
||||
## Windows命令行
|
||||
|
||||
一些Windows用户不熟悉命令行。以下是如何打开终端并带参数执行`scrcpy`:
|
||||
从 v1.22 开始,增加了一个“快捷方式”,可以直接在 scrcpy 目录打开一个终端。双击`open_a_terminal_here.bat`,然后输入你的命令。 例如:
|
||||
|
||||
```
|
||||
scrcpy --record file.mkv
|
||||
```
|
||||
|
||||
您也可以打开终端并手动转到 scrcpy 文件夹:
|
||||
|
||||
1. 按下 <kbd>Windows</kbd>+<kbd>r</kbd>,打开一个对话框。
|
||||
2. 输入 `cmd` 并按 <kbd>Enter</kbd>,这样就打开了一个终端。
|
||||
@ -233,7 +277,7 @@ scrcpy -m 800
|
||||
scrcpy --prefer-text --turn-screen-off --stay-awake
|
||||
```
|
||||
|
||||
然后双击刚刚创建的文件。
|
||||
然后只需双击刚刚创建的文件。
|
||||
|
||||
你也可以编辑 `scrcpy-console.bat` 或者 `scrcpy-noconsole.vbs`(的副本)来添加参数。
|
||||
|
||||
|
10
README.md
10
README.md
@ -1,4 +1,4 @@
|
||||
# scrcpy (v1.21)
|
||||
# scrcpy (v1.22)
|
||||
|
||||
<img src="data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
||||
|
||||
@ -108,10 +108,10 @@ process][BUILD_simple]).
|
||||
For Windows, for simplicity, a prebuilt archive with all the dependencies
|
||||
(including `adb`) is available:
|
||||
|
||||
- [`scrcpy-win64-v1.21.zip`][direct-win64]
|
||||
_(SHA-256: fdab0c1421353b592a9bbcebd6e252675eadccca65cca8105686feaa9c1ded53)_
|
||||
- [`scrcpy-win64-v1.22.zip`][direct-win64]
|
||||
_(SHA-256: ce4d9b8cc761e29862c4a72d8ad6f538bdd1f1831d15fd1f36633cd3b403db82)_
|
||||
|
||||
[direct-win64]: https://github.com/Genymobile/scrcpy/releases/download/v1.21/scrcpy-win64-v1.21.zip
|
||||
[direct-win64]: https://github.com/Genymobile/scrcpy/releases/download/v1.22/scrcpy-win64-v1.22.zip
|
||||
|
||||
It is also available in [Chocolatey]:
|
||||
|
||||
@ -1116,7 +1116,7 @@ This README is available in other languages:
|
||||
- [한국어 (Korean, `ko`) - v1.11](README.ko.md)
|
||||
- [Português Brasileiro (Brazilian Portuguese, `pt-BR`) - v1.19](README.pt-br.md)
|
||||
- [Español (Spanish, `sp`) - v1.21](README.sp.md)
|
||||
- [简体中文 (Simplified Chinese, `zh-Hans`) - v1.21](README.zh-Hans.md)
|
||||
- [简体中文 (Simplified Chinese, `zh-Hans`) - v1.22](README.zh-Hans.md)
|
||||
- [繁體中文 (Traditional Chinese, `zh-Hant`) - v1.15](README.zh-Hant.md)
|
||||
- [Turkish (Turkish, `tr`) - v1.18](README.tr.md)
|
||||
|
||||
|
@ -2,16 +2,18 @@ _Only the original [README](README.md) is guaranteed to be up-to-date._
|
||||
|
||||
_只有原版的 [README](README.md)是保证最新的。_
|
||||
|
||||
Current version is based on [8615813]
|
||||
Current version is based on [f4c7044]
|
||||
|
||||
本文根据[8615813]进行翻译。
|
||||
本文根据[f4c7044]进行翻译。
|
||||
|
||||
[8615813]: https://github.com/Genymobile/scrcpy/blob/86158130051d450a449a2e7bb20b0fcef1b62e80/README.md
|
||||
[f4c7044]: https://github.com/Genymobile/scrcpy/blob/f4c7044b46ae28eb64cb5e1a15c9649a44023c70/README.md
|
||||
|
||||
# scrcpy (v1.21)
|
||||
# scrcpy (v1.22)
|
||||
|
||||
<img src="data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
||||
|
||||
_发音为 "**scr**een **c**o**py**"_
|
||||
|
||||
本应用程序可以显示并控制通过 USB (或 [TCP/IP][article-tcpip]) 连接的安卓设备,且不需要任何 _root_ 权限。本程序支持 _GNU/Linux_, _Windows_ 和 _macOS_。
|
||||
|
||||

|
||||
@ -36,6 +38,8 @@ Current version is based on [8615813]
|
||||
- [可配置显示质量](#采集设置)
|
||||
- 以设备屏幕[作为摄像头(V4L2)](#v4l2loopback) (仅限 Linux)
|
||||
- [模拟物理键盘 (HID)](#物理键盘模拟-hid) (仅限 Linux)
|
||||
- [物理鼠标模拟 (HID)](#物理鼠标模拟-hid) (仅限 Linux)
|
||||
- [OTG模式](#otg) (仅限 Linux)
|
||||
- 更多 ……
|
||||
|
||||
## 系统要求
|
||||
@ -362,7 +366,7 @@ scrcpy --tcpip=192.168.1.1:5555
|
||||
如果adb TCP/IP(无线) 模式在某些设备上不被启用(或者你不知道IP地址),用USB连接设备,然后运行:
|
||||
|
||||
```bash
|
||||
scrcpy --tcpip # 无需参数
|
||||
scrcpy --tcpip # 无需其他参数
|
||||
```
|
||||
|
||||
这将会自动寻找设备IP地址,启用TCP/IP模式,然后在启动之前连接到设备。
|
||||
@ -729,6 +733,55 @@ scrcpy -K # 简写
|
||||
|
||||
[实体键盘]: https://github.com/Genymobile/scrcpy/pull/2632#issuecomment-923756915
|
||||
|
||||
#### 物理鼠标模拟 (HID)
|
||||
|
||||
与物理键盘模拟类似,可以模拟一个物理鼠标。 同样,它仅在设备通过 USB 连接时才有效,并且目前仅在 Linux 上受支持。
|
||||
|
||||
默认情况下,scrcpy 使用 Android 鼠标事件注入,使用绝对坐标。 通过模拟物理鼠标,在Android设备上出现鼠标指针,并注入鼠标相对运动、点击和滚动。
|
||||
|
||||
启用此模式:
|
||||
|
||||
```bash
|
||||
scrcpy --hid-mouse
|
||||
scrcpy -M # 简写
|
||||
```
|
||||
|
||||
您还可以将 `--forward-all-clicks` 添加到 [转发所有点击][forward_all_clicks].
|
||||
|
||||
[forward_all_clicks]: #右键和中键
|
||||
|
||||
启用此模式后,计算机鼠标将被“捕获”(鼠标指针从计算机上消失并出现在 Android 设备上)。
|
||||
|
||||
特殊的捕获键,<kbd>Alt</kbd> 或 <kbd>Super</kbd>,切换(禁用或启用)鼠标捕获。 使用其中之一将鼠标的控制权交还给计算机。
|
||||
|
||||
|
||||
#### OTG
|
||||
|
||||
可以仅使用物理键盘和鼠标模拟 (HID) 运行 _scrcpy_,就好像计算机键盘和鼠标通过 OTG 线直接插入设备一样。
|
||||
|
||||
在这个模式下,_adb_ (USB 调试)是不必要的,且镜像被禁用。
|
||||
|
||||
启用 OTG 模式:
|
||||
|
||||
```bash
|
||||
scrcpy --otg
|
||||
# 如果有多个 USB 设备可用,则通过序列号选择
|
||||
scrcpy --otg -s 0123456789abcdef
|
||||
```
|
||||
|
||||
只开启 HID 键盘 或 HID 鼠标 是可行的:
|
||||
|
||||
```bash
|
||||
scrcpy --otg --hid-keyboard # 只开启 HID 键盘
|
||||
scrcpy --otg --hid-mouse # 只开启 HID 鼠标
|
||||
scrcpy --otg --hid-keyboard --hid-mouse # 开启 HID 键盘 和 HID 鼠标
|
||||
# 为了方便,默认两者都开启
|
||||
scrcpy --otg # 开启 HID 键盘 和 HID 鼠标
|
||||
```
|
||||
|
||||
像 `--hid-keyboard` 和 `--hid-mouse` 一样,它只在设备通过 USB 连接时才有效,且目前仅在 Linux 上支持。
|
||||
|
||||
|
||||
#### 文本注入偏好
|
||||
|
||||
输入文字的时候,系统会产生两种[事件][textevents]:
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
static char *
|
||||
sc_adb_parse_device_ip_from_line(char *line, size_t len) {
|
||||
// One line from "ip route" looks lile:
|
||||
// One line from "ip route" looks like:
|
||||
// "192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.x"
|
||||
|
||||
// Get the location of the device name (index of "wlan0" in the example)
|
||||
|
@ -3,10 +3,12 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "stddef.h"
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* Parse the ip from the output of `adb shell ip route`
|
||||
*
|
||||
* Warning: this function modifies the buffer for optimization purposes.
|
||||
*/
|
||||
char *
|
||||
sc_adb_parse_device_ip_from_output(char *buf, size_t buf_len);
|
||||
|
@ -106,10 +106,10 @@ sc_str_wrap_lines(const char *input, unsigned columns, unsigned indent);
|
||||
/**
|
||||
* Truncate the data after any of the characters from `endchars`
|
||||
*
|
||||
* An '\0' is always written at the end of the data, even if no newline
|
||||
* character is encountered.
|
||||
* An '\0' is always written at the end of the data string, even if no
|
||||
* character from `endchars` is encountered.
|
||||
*
|
||||
* Return the size of the resulting line.
|
||||
* Return the size of the resulting string (as strlen() would return).
|
||||
*/
|
||||
size_t
|
||||
sc_str_truncate(char *data, size_t len, const char *endchars);
|
||||
|
@ -2,8 +2,8 @@
|
||||
set -e
|
||||
|
||||
BUILDDIR=build-auto
|
||||
PREBUILT_SERVER_URL=https://github.com/Genymobile/scrcpy/releases/download/v1.21/scrcpy-server-v1.21
|
||||
PREBUILT_SERVER_SHA256=dbcccab523ee26796e55ea33652649e4b7af498edae9aa75e4d4d7869c0ab848
|
||||
PREBUILT_SERVER_URL=https://github.com/Genymobile/scrcpy/releases/download/v1.22/scrcpy-server-v1.22
|
||||
PREBUILT_SERVER_SHA256=c05d273eec7533c0e106282e0254cf04e7f5e8f0c2920ca39448865fab2a419b
|
||||
|
||||
echo "[scrcpy] Downloading prebuilt server..."
|
||||
wget "$PREBUILT_SERVER_URL" -O scrcpy-server
|
||||
|
@ -89,13 +89,15 @@ public class ScreenEncoder implements Device.RotationListener {
|
||||
Rect unlockedVideoRect = screenInfo.getUnlockedVideoSize().toRect();
|
||||
int videoRotation = screenInfo.getVideoRotation();
|
||||
int layerStack = device.getLayerStack();
|
||||
|
||||
setSize(format, videoRect.width(), videoRect.height());
|
||||
configure(codec, format);
|
||||
Surface surface = codec.createInputSurface();
|
||||
setDisplaySurface(display, surface, videoRotation, contentRect, unlockedVideoRect, layerStack);
|
||||
codec.start();
|
||||
|
||||
Surface surface = null;
|
||||
try {
|
||||
configure(codec, format);
|
||||
surface = codec.createInputSurface();
|
||||
setDisplaySurface(display, surface, videoRotation, contentRect, unlockedVideoRect, layerStack);
|
||||
codec.start();
|
||||
|
||||
alive = encode(codec, fd);
|
||||
// do not call stop() on exception, it would trigger an IllegalStateException
|
||||
codec.stop();
|
||||
@ -119,7 +121,9 @@ public class ScreenEncoder implements Device.RotationListener {
|
||||
} finally {
|
||||
destroyDisplay(display);
|
||||
codec.release();
|
||||
surface.release();
|
||||
if (surface != null) {
|
||||
surface.release();
|
||||
}
|
||||
}
|
||||
} while (alive);
|
||||
} finally {
|
||||
|
Reference in New Issue
Block a user