Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0a75ca746 | ||
|
|
f02f2135cd | ||
|
|
9b4360b6b8 | ||
|
|
c8d0f5cdeb | ||
|
|
22d9f0faf4 | ||
|
|
a1967b4dfd | ||
|
|
a86deab3d4 | ||
|
|
f4c7044b46 | ||
|
|
64a09513ae | ||
|
|
28054cd471 | ||
|
|
334f46995a | ||
|
|
38cdcdda50 | ||
|
|
eaba613633 | ||
|
|
b8d7f36ba3 | ||
|
|
80bec70852 | ||
|
|
8615813005 | ||
|
|
ae8fdda09e | ||
|
|
1ff69e21c2 | ||
|
|
479abc8c77 | ||
|
|
25a4135935 | ||
|
|
5704ec6967 |
@@ -270,10 +270,10 @@ install` must be run as root)._
|
|||||||
|
|
||||||
#### Option 2: Use prebuilt server
|
#### Option 2: Use prebuilt server
|
||||||
|
|
||||||
- [`scrcpy-server-v1.21`][direct-scrcpy-server]
|
- [`scrcpy-server-v1.22`][direct-scrcpy-server]
|
||||||
_(SHA-256: dbcccab523ee26796e55ea33652649e4b7af498edae9aa75e4d4d7869c0ab848)_
|
_(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
|
Download the prebuilt server somewhere, and specify its path during the Meson
|
||||||
configuration:
|
configuration:
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Here are the common reported problems and their status.
|
|||||||
|
|
||||||
In that case, it will print this error:
|
In that case, it will print this error:
|
||||||
|
|
||||||
> ERROR: "adb push" returned with value 1
|
> ERROR: "adb get-serialno" returned with value 1
|
||||||
|
|
||||||
This is typically not a bug in _scrcpy_, but a problem in your environment.
|
This is typically not a bug in _scrcpy_, but a problem in your environment.
|
||||||
|
|
||||||
@@ -32,28 +32,38 @@ in the release, so it should work out-of-the-box.
|
|||||||
|
|
||||||
### Device unauthorized
|
### Device unauthorized
|
||||||
|
|
||||||
Check [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.
|
||||||
|
|
||||||
|
When connecting, a popup should open on the device. You must authorize USB
|
||||||
|
debugging.
|
||||||
|
|
||||||
|
If it does not open, check [stackoverflow][device-unauthorized].
|
||||||
|
|
||||||
[device-unauthorized]: https://stackoverflow.com/questions/23081263/adb-android-device-unauthorized
|
[device-unauthorized]: https://stackoverflow.com/questions/23081263/adb-android-device-unauthorized
|
||||||
|
|
||||||
|
|
||||||
### Device not detected
|
### Device not detected
|
||||||
|
|
||||||
> adb: error: failed to get feature set: no devices/emulators found
|
> error: no devices/emulators found
|
||||||
|
|
||||||
Check that you correctly enabled [adb debugging][enable-adb].
|
Check that you correctly enabled [adb debugging][enable-adb].
|
||||||
|
|
||||||
If your device is not detected, you may need some [drivers] (on Windows).
|
If your device is not detected, you may need some [drivers] (on Windows). There is a separate [USB driver for Google devices][google-usb-driver].
|
||||||
|
|
||||||
[enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling
|
[enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling
|
||||||
[drivers]: https://developer.android.com/studio/run/oem-usb.html
|
[drivers]: https://developer.android.com/studio/run/oem-usb.html
|
||||||
|
[google-usb-driver]: https://developer.android.com/studio/run/win-usb
|
||||||
|
|
||||||
|
|
||||||
### Several devices connected
|
### Several devices connected
|
||||||
|
|
||||||
If several devices are connected, you will encounter this error:
|
If several devices are connected, you will encounter this error:
|
||||||
|
|
||||||
> adb: error: failed to get feature set: more than one device/emulator
|
> error: more than one device/emulator
|
||||||
|
|
||||||
the identifier of the device you want to mirror must be provided:
|
the identifier of the device you want to mirror must be provided:
|
||||||
|
|
||||||
@@ -61,7 +71,7 @@ the identifier of the device you want to mirror must be provided:
|
|||||||
scrcpy -s 01234567890abcdef
|
scrcpy -s 01234567890abcdef
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that if your device is connected over TCP/IP, you'll get this message:
|
Note that if your device is connected over TCP/IP, you might get this message:
|
||||||
|
|
||||||
> adb: error: more than one device/emulator
|
> adb: error: more than one device/emulator
|
||||||
> ERROR: "adb reverse" returned with value 1
|
> ERROR: "adb reverse" returned with value 1
|
||||||
@@ -295,4 +305,4 @@ This FAQ is available in other languages:
|
|||||||
|
|
||||||
- [Italiano (Italiano, `it`) - v1.19](FAQ.it.md)
|
- [Italiano (Italiano, `it`) - v1.19](FAQ.it.md)
|
||||||
- [한국어 (Korean, `ko`) - v1.11](FAQ.ko.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)
|
||||||
|
|||||||
+59
-15
@@ -1,7 +1,12 @@
|
|||||||
只有原版的[FAQ](FAQ.md)会保持更新。
|
_Only the original [FAQ.md](FAQ.md) is guaranteed to be up-to-date._
|
||||||
本文根据[d6aaa5]翻译。
|
|
||||||
|
|
||||||
[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` 相关问题
|
## `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,而是你的环境的问题。
|
这通常不是 _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
|
[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].
|
确认已经正确启用 [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
|
[enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling
|
||||||
[drivers]: https://developer.android.com/studio/run/oem-usb.html
|
[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`连接已经断开了。
|
如果 _scrcpy_ 在警告“设备连接断开”的情况下自动中止,那就意味着`adb`连接已经断开了。
|
||||||
请尝试使用另一条USB线或者电脑上的另一个USB接口。
|
|
||||||
请参看 [#281] 和 [#283]。
|
请尝试使用另一条USB线或者电脑上的另一个USB接口。请参看 [#281] 和 [#283]。
|
||||||
|
|
||||||
[#281]: https://github.com/Genymobile/scrcpy/issues/281
|
[#281]: https://github.com/Genymobile/scrcpy/issues/281
|
||||||
[#283]: https://github.com/Genymobile/scrcpy/issues/283
|
[#283]: https://github.com/Genymobile/scrcpy/issues/283
|
||||||
|
|
||||||
|
|
||||||
## 控制相关问题
|
## 控制相关问题
|
||||||
|
|
||||||
### 鼠标和键盘不起作用
|
### 鼠标和键盘不起作用
|
||||||
|
|
||||||
|
|
||||||
在某些设备上,您可能需要启用一个选项以允许 [模拟输入][simulating input]。
|
在某些设备上,您可能需要启用一个选项以允许 [模拟输入][simulating input]。
|
||||||
|
|
||||||
在开发者选项中,打开:
|
在开发者选项中,打开:
|
||||||
|
|
||||||
> **USB调试 (安全设置)**
|
> **USB调试 (安全设置)**
|
||||||
@@ -115,10 +129,12 @@ scrcpy
|
|||||||
|
|
||||||
可输入的文本[被限制为ASCII字符][text-input]。也可以用一些小技巧输入一些[带重音符号的字符][accented-characters],但是仅此而已。参见[#37]。
|
可输入的文本[被限制为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
|
[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
|
[accented-characters]: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-accented-characters
|
||||||
[#37]: https://github.com/Genymobile/scrcpy/issues/37
|
[#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
|
[#40]: https://github.com/Genymobile/scrcpy/issues/40
|
||||||
|
|
||||||
|
|
||||||
为了提升降尺度的质量,如果渲染器是OpenGL并且支持mip映射,就会自动开启三线性过滤。
|
为了提升降尺度的质量,如果渲染器是OpenGL并且支持mip映射,就会自动开启三线性过滤。
|
||||||
|
|
||||||
在Windows上,你可能希望强制使用OpenGL:
|
在Windows上,你可能希望强制使用OpenGL:
|
||||||
@@ -177,6 +192,7 @@ scrcpy
|
|||||||
## 崩溃
|
## 崩溃
|
||||||
|
|
||||||
### 异常
|
### 异常
|
||||||
|
|
||||||
可能有很多原因。一个常见的原因是您的设备无法按给定清晰度进行编码:
|
可能有很多原因。一个常见的原因是您的设备无法按给定清晰度进行编码:
|
||||||
|
|
||||||
> ```
|
> ```
|
||||||
@@ -204,12 +220,40 @@ scrcpy -m 1024
|
|||||||
scrcpy -m 800
|
scrcpy -m 800
|
||||||
```
|
```
|
||||||
|
|
||||||
|
自 scrcpy v1.22以来,scrcpy 会自动在失败前以更低的分辨率重试。这种行为可以用`--no-downsize-on-error`关闭。
|
||||||
|
|
||||||
你也可以尝试另一种 [编码器](README.md#encoder)。
|
你也可以尝试另一种 [编码器](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命令行
|
||||||
|
|
||||||
一些Windows用户不熟悉命令行。以下是如何打开终端并带参数执行`scrcpy`:
|
从 v1.22 开始,增加了一个“快捷方式”,可以直接在 scrcpy 目录打开一个终端。双击`open_a_terminal_here.bat`,然后输入你的命令。 例如:
|
||||||
|
|
||||||
|
```
|
||||||
|
scrcpy --record file.mkv
|
||||||
|
```
|
||||||
|
|
||||||
|
您也可以打开终端并手动转到 scrcpy 文件夹:
|
||||||
|
|
||||||
1. 按下 <kbd>Windows</kbd>+<kbd>r</kbd>,打开一个对话框。
|
1. 按下 <kbd>Windows</kbd>+<kbd>r</kbd>,打开一个对话框。
|
||||||
2. 输入 `cmd` 并按 <kbd>Enter</kbd>,这样就打开了一个终端。
|
2. 输入 `cmd` 并按 <kbd>Enter</kbd>,这样就打开了一个终端。
|
||||||
@@ -233,7 +277,7 @@ scrcpy -m 800
|
|||||||
scrcpy --prefer-text --turn-screen-off --stay-awake
|
scrcpy --prefer-text --turn-screen-off --stay-awake
|
||||||
```
|
```
|
||||||
|
|
||||||
然后双击刚刚创建的文件。
|
然后只需双击刚刚创建的文件。
|
||||||
|
|
||||||
你也可以编辑 `scrcpy-console.bat` 或者 `scrcpy-noconsole.vbs`(的副本)来添加参数。
|
你也可以编辑 `scrcpy-console.bat` 或者 `scrcpy-noconsole.vbs`(的副本)来添加参数。
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# scrcpy (v1.21)
|
# scrcpy (v1.22)
|
||||||
|
|
||||||
<img src="data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
<img src="data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
||||||
|
|
||||||
@@ -76,6 +76,12 @@ On Debian and Ubuntu:
|
|||||||
apt install scrcpy
|
apt install scrcpy
|
||||||
```
|
```
|
||||||
|
|
||||||
|
On Arch Linux:
|
||||||
|
|
||||||
|
```
|
||||||
|
pacman -S scrcpy
|
||||||
|
```
|
||||||
|
|
||||||
A [Snap] package is available: [`scrcpy`][snap-link].
|
A [Snap] package is available: [`scrcpy`][snap-link].
|
||||||
|
|
||||||
[snap-link]: https://snapstats.org/snaps/scrcpy
|
[snap-link]: https://snapstats.org/snaps/scrcpy
|
||||||
@@ -87,10 +93,6 @@ For Fedora, a [COPR] package is available: [`scrcpy`][copr-link].
|
|||||||
[COPR]: https://fedoraproject.org/wiki/Category:Copr
|
[COPR]: https://fedoraproject.org/wiki/Category:Copr
|
||||||
[copr-link]: https://copr.fedorainfracloud.org/coprs/zeno/scrcpy/
|
[copr-link]: https://copr.fedorainfracloud.org/coprs/zeno/scrcpy/
|
||||||
|
|
||||||
For Arch Linux, an [AUR] package is available: [`scrcpy`][aur-link].
|
|
||||||
|
|
||||||
[AUR]: https://wiki.archlinux.org/index.php/Arch_User_Repository
|
|
||||||
[aur-link]: https://aur.archlinux.org/packages/scrcpy/
|
|
||||||
|
|
||||||
For Gentoo, an [Ebuild] is available: [`scrcpy/`][ebuild-link].
|
For Gentoo, an [Ebuild] is available: [`scrcpy/`][ebuild-link].
|
||||||
|
|
||||||
@@ -106,10 +108,10 @@ process][BUILD_simple]).
|
|||||||
For Windows, for simplicity, a prebuilt archive with all the dependencies
|
For Windows, for simplicity, a prebuilt archive with all the dependencies
|
||||||
(including `adb`) is available:
|
(including `adb`) is available:
|
||||||
|
|
||||||
- [`scrcpy-win64-v1.21.zip`][direct-win64]
|
- [`scrcpy-win64-v1.22.zip`][direct-win64]
|
||||||
_(SHA-256: fdab0c1421353b592a9bbcebd6e252675eadccca65cca8105686feaa9c1ded53)_
|
_(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]:
|
It is also available in [Chocolatey]:
|
||||||
|
|
||||||
@@ -1000,7 +1002,7 @@ _<kbd>[Super]</kbd> is typically the <kbd>Windows</kbd> or <kbd>Cmd</kbd> key._
|
|||||||
| Click on `HOME` | <kbd>MOD</kbd>+<kbd>h</kbd> \| _Middle-click_
|
| Click on `HOME` | <kbd>MOD</kbd>+<kbd>h</kbd> \| _Middle-click_
|
||||||
| Click on `BACK` | <kbd>MOD</kbd>+<kbd>b</kbd> \| _Right-click²_
|
| Click on `BACK` | <kbd>MOD</kbd>+<kbd>b</kbd> \| _Right-click²_
|
||||||
| Click on `APP_SWITCH` | <kbd>MOD</kbd>+<kbd>s</kbd> \| _4th-click³_
|
| Click on `APP_SWITCH` | <kbd>MOD</kbd>+<kbd>s</kbd> \| _4th-click³_
|
||||||
| Click on `MENU` (unlock screen) | <kbd>MOD</kbd>+<kbd>m</kbd>
|
| Click on `MENU` (unlock screen)⁴ | <kbd>MOD</kbd>+<kbd>m</kbd>
|
||||||
| Click on `VOLUME_UP` | <kbd>MOD</kbd>+<kbd>↑</kbd> _(up)_
|
| Click on `VOLUME_UP` | <kbd>MOD</kbd>+<kbd>↑</kbd> _(up)_
|
||||||
| Click on `VOLUME_DOWN` | <kbd>MOD</kbd>+<kbd>↓</kbd> _(down)_
|
| Click on `VOLUME_DOWN` | <kbd>MOD</kbd>+<kbd>↓</kbd> _(down)_
|
||||||
| Click on `POWER` | <kbd>MOD</kbd>+<kbd>p</kbd>
|
| Click on `POWER` | <kbd>MOD</kbd>+<kbd>p</kbd>
|
||||||
@@ -1011,9 +1013,9 @@ _<kbd>[Super]</kbd> is typically the <kbd>Windows</kbd> or <kbd>Cmd</kbd> key._
|
|||||||
| Expand notification panel | <kbd>MOD</kbd>+<kbd>n</kbd> \| _5th-click³_
|
| Expand notification panel | <kbd>MOD</kbd>+<kbd>n</kbd> \| _5th-click³_
|
||||||
| Expand settings panel | <kbd>MOD</kbd>+<kbd>n</kbd>+<kbd>n</kbd> \| _Double-5th-click³_
|
| Expand settings panel | <kbd>MOD</kbd>+<kbd>n</kbd>+<kbd>n</kbd> \| _Double-5th-click³_
|
||||||
| Collapse panels | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>n</kbd>
|
| Collapse panels | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>n</kbd>
|
||||||
| Copy to clipboard⁴ | <kbd>MOD</kbd>+<kbd>c</kbd>
|
| Copy to clipboard⁵ | <kbd>MOD</kbd>+<kbd>c</kbd>
|
||||||
| Cut to clipboard⁴ | <kbd>MOD</kbd>+<kbd>x</kbd>
|
| Cut to clipboard⁵ | <kbd>MOD</kbd>+<kbd>x</kbd>
|
||||||
| Synchronize clipboards and paste⁴ | <kbd>MOD</kbd>+<kbd>v</kbd>
|
| Synchronize clipboards and paste⁵ | <kbd>MOD</kbd>+<kbd>v</kbd>
|
||||||
| Inject computer clipboard text | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>
|
| Inject computer clipboard text | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>
|
||||||
| Enable/disable FPS counter (on stdout) | <kbd>MOD</kbd>+<kbd>i</kbd>
|
| Enable/disable FPS counter (on stdout) | <kbd>MOD</kbd>+<kbd>i</kbd>
|
||||||
| Pinch-to-zoom | <kbd>Ctrl</kbd>+_click-and-move_
|
| Pinch-to-zoom | <kbd>Ctrl</kbd>+_click-and-move_
|
||||||
@@ -1023,7 +1025,8 @@ _<kbd>[Super]</kbd> is typically the <kbd>Windows</kbd> or <kbd>Cmd</kbd> key._
|
|||||||
_¹Double-click on black borders to remove them._
|
_¹Double-click on black borders to remove them._
|
||||||
_²Right-click turns the screen on if it was off, presses BACK otherwise._
|
_²Right-click turns the screen on if it was off, presses BACK otherwise._
|
||||||
_³4th and 5th mouse buttons, if your mouse has them._
|
_³4th and 5th mouse buttons, if your mouse has them._
|
||||||
_⁴Only on Android >= 7._
|
_⁴For react-native apps in development, `MENU` triggers development menu._
|
||||||
|
_⁵Only on Android >= 7._
|
||||||
|
|
||||||
Shortcuts with repeated keys are executted by releasing and pressing the key a
|
Shortcuts with repeated keys are executted by releasing and pressing the key a
|
||||||
second time. For example, to execute "Expand settings panel":
|
second time. For example, to execute "Expand settings panel":
|
||||||
@@ -1112,8 +1115,8 @@ This README is available in other languages:
|
|||||||
- [日本語 (Japanese, `jp`) - v1.19](README.jp.md)
|
- [日本語 (Japanese, `jp`) - v1.19](README.jp.md)
|
||||||
- [한국어 (Korean, `ko`) - v1.11](README.ko.md)
|
- [한국어 (Korean, `ko`) - v1.11](README.ko.md)
|
||||||
- [Português Brasileiro (Brazilian Portuguese, `pt-BR`) - v1.19](README.pt-br.md)
|
- [Português Brasileiro (Brazilian Portuguese, `pt-BR`) - v1.19](README.pt-br.md)
|
||||||
- [Español (Spanish, `sp`) - v1.17](README.sp.md)
|
- [Español (Spanish, `sp`) - v1.21](README.sp.md)
|
||||||
- [简体中文 (Simplified Chinese, `zh-Hans`) - v1.20](README.zh-Hans.md)
|
- [简体中文 (Simplified Chinese, `zh-Hans`) - v1.22](README.zh-Hans.md)
|
||||||
- [繁體中文 (Traditional Chinese, `zh-Hant`) - v1.15](README.zh-Hant.md)
|
- [繁體中文 (Traditional Chinese, `zh-Hant`) - v1.15](README.zh-Hant.md)
|
||||||
- [Turkish (Turkish, `tr`) - v1.18](README.tr.md)
|
- [Turkish (Turkish, `tr`) - v1.18](README.tr.md)
|
||||||
|
|
||||||
|
|||||||
+300
-69
@@ -1,24 +1,36 @@
|
|||||||
Solo se garantiza que el archivo [README](README.md) original esté actualizado.
|
Solo se garantiza que el archivo [README](README.md) original esté actualizado.
|
||||||
|
|
||||||
# scrcpy (v1.17)
|
# scrcpy (v1.21)
|
||||||
|
|
||||||
Esta aplicación proporciona imagen y control de un dispositivo Android conectado
|
<img src="data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
||||||
por USB (o [por TCP/IP][article-tcpip]). No requiere acceso _root_.
|
|
||||||
|
Esta aplicación proporciona control e imagen de un dispositivo Android conectado
|
||||||
|
por USB (o [por TCP/IP](#conexión)). No requiere acceso _root_.
|
||||||
Compatible con _GNU/Linux_, _Windows_ y _macOS_.
|
Compatible con _GNU/Linux_, _Windows_ y _macOS_.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Sus características principales son:
|
Se enfoca en:
|
||||||
|
- **ser ligera**: aplicación nativa, solo muestra la imagen del dispositivo
|
||||||
- **ligero** (nativo, solo muestra la imagen del dispositivo)
|
- **rendimiento**: 30~120fps, dependiendo del dispositivo
|
||||||
- **desempeño** (30~60fps)
|
- **calidad**: 1920×1080 o superior
|
||||||
- **calidad** (1920×1080 o superior)
|
- **baja latencia**: [35~70ms][lowlatency]
|
||||||
- **baja latencia** ([35~70ms][lowlatency])
|
- **inicio rápido**: ~1 segundo para mostrar la primera imagen
|
||||||
- **corto tiempo de inicio** (~1 segundo para mostrar la primera imagen)
|
- **no intrusivo**: no deja nada instalado en el dispositivo
|
||||||
- **no intrusivo** (no se deja nada instalado en el dispositivo)
|
- **beneficios**: sin cuentas, sin anuncios, no requiere acceso a internet
|
||||||
|
- **libertad**: software gratis y de código abierto
|
||||||
|
|
||||||
[lowlatency]: https://github.com/Genymobile/scrcpy/pull/646
|
[lowlatency]: https://github.com/Genymobile/scrcpy/pull/646
|
||||||
|
|
||||||
|
Con la aplicación puede:
|
||||||
|
- [grabar la pantalla](#capturas-y-grabaciones)
|
||||||
|
- duplicar la imagen con [la pantalla apagada](#apagar-la-pantalla)
|
||||||
|
- [copiar y pegar](#copiar-y-pegar) en ambos sentidos
|
||||||
|
- [configurar la calidad](#configuración-de-captura)
|
||||||
|
- usar la pantalla del dispositivo [como webcam (V4L2)](#v4l2loopback) (solo en Linux)
|
||||||
|
- [emular un teclado físico (HID)](#emular-teclado-físico-hid)
|
||||||
|
(solo en Linux)
|
||||||
|
- y mucho más…
|
||||||
|
|
||||||
## Requisitos
|
## Requisitos
|
||||||
|
|
||||||
@@ -51,7 +63,7 @@ Construir desde la fuente: [BUILD] ([proceso simplificado][BUILD_simple])
|
|||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
En Debian (_test_ y _sid_ por ahora) y Ubuntu (20.04):
|
En Debian y Ubuntu:
|
||||||
|
|
||||||
```
|
```
|
||||||
apt install scrcpy
|
apt install scrcpy
|
||||||
@@ -125,7 +137,7 @@ Necesitarás `adb`, accesible desde `PATH`. Si aún no lo tienes:
|
|||||||
brew install android-platform-tools
|
brew install android-platform-tools
|
||||||
```
|
```
|
||||||
|
|
||||||
También está disponible en [MacPorts], que configurará el adb automáticamente:
|
También está disponible en [MacPorts], que configura el adb automáticamente:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo port install scrcpy
|
sudo port install scrcpy
|
||||||
@@ -153,7 +165,7 @@ scrcpy --help
|
|||||||
|
|
||||||
## Características
|
## Características
|
||||||
|
|
||||||
### Capturar configuración
|
### Configuración de captura
|
||||||
|
|
||||||
#### Reducir la definición
|
#### Reducir la definición
|
||||||
|
|
||||||
@@ -208,10 +220,11 @@ Si `--max-size` también está especificado, el cambio de tamaño es aplicado de
|
|||||||
Para fijar la rotación de la transmisión:
|
Para fijar la rotación de la transmisión:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --lock-video-orientation 0 # orientación normal
|
scrcpy --lock-video-orientation # orientación inicial
|
||||||
scrcpy --lock-video-orientation 1 # 90° contrarreloj
|
scrcpy --lock-video-orientation=0 # orientación normal
|
||||||
scrcpy --lock-video-orientation 2 # 180°
|
scrcpy --lock-video-orientation=1 # 90° contrarreloj
|
||||||
scrcpy --lock-video-orientation 3 # 90° sentido de las agujas del reloj
|
scrcpy --lock-video-orientation=2 # 180°
|
||||||
|
scrcpy --lock-video-orientation=3 # 90° sentido de las agujas del reloj
|
||||||
```
|
```
|
||||||
|
|
||||||
Esto afecta la rotación de la grabación.
|
Esto afecta la rotación de la grabación.
|
||||||
@@ -233,7 +246,10 @@ Para listar los codificadores disponibles, puedes pasar un nombre de codificador
|
|||||||
scrcpy --encoder _
|
scrcpy --encoder _
|
||||||
```
|
```
|
||||||
|
|
||||||
### Grabación
|
### Capturas y grabaciones
|
||||||
|
|
||||||
|
|
||||||
|
#### Grabación
|
||||||
|
|
||||||
Es posible grabar la pantalla mientras se transmite:
|
Es posible grabar la pantalla mientras se transmite:
|
||||||
|
|
||||||
@@ -250,17 +266,117 @@ scrcpy -Nr file.mkv
|
|||||||
# interrumpe la grabación con Ctrl+C
|
# interrumpe la grabación con Ctrl+C
|
||||||
```
|
```
|
||||||
|
|
||||||
"Skipped frames" son grabados, incluso si no son mostrados en tiempo real (por razones de desempeño). Los frames tienen _marcas de tiempo_ en el dispositivo, por lo que el "[packet delay
|
Los "skipped frames" son grabados, incluso si no se mostrados en tiempo real (por razones de desempeño). Los frames tienen _marcas de tiempo_ en el dispositivo, por lo que el "[packet delay
|
||||||
variation]" no impacta el archivo grabado.
|
variation]" no impacta el archivo grabado.
|
||||||
|
|
||||||
[packet delay variation]: https://en.wikipedia.org/wiki/Packet_delay_variation
|
[packet delay variation]: https://en.wikipedia.org/wiki/Packet_delay_variation
|
||||||
|
|
||||||
|
|
||||||
|
#### v4l2loopback
|
||||||
|
|
||||||
|
En Linux se puede mandar el stream del video a un dispositivo loopback v4l2, por
|
||||||
|
lo que se puede abrir el dispositivo Android como una webcam con cualquier
|
||||||
|
programa compatible con v4l2.
|
||||||
|
|
||||||
|
Se debe instalar el modulo `v4l2loopback`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt install v4l2loopback-dkms
|
||||||
|
```
|
||||||
|
|
||||||
|
Para crear un dispositivo v4l2:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo modprobe v4l2loopback
|
||||||
|
```
|
||||||
|
|
||||||
|
Esto va a crear un nuevo dispositivo de video en `/dev/videoN`, donde `N` es un número
|
||||||
|
(hay más [opciones](https://github.com/umlaeute/v4l2loopback#options) disponibles
|
||||||
|
para crear múltiples dispositivos o usar un ID en específico).
|
||||||
|
|
||||||
|
Para ver los dispositivos disponibles:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# requiere el paquete v4l-utils
|
||||||
|
v4l2-ctl --list-devices
|
||||||
|
# simple pero generalmente suficiente
|
||||||
|
ls /dev/video*
|
||||||
|
```
|
||||||
|
|
||||||
|
Para iniciar scrcpy usando una fuente v4l2:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scrcpy --v4l2-sink=/dev/videoN
|
||||||
|
scrcpy --v4l2-sink=/dev/videoN --no-display # deshabilita la transmisión de imagen
|
||||||
|
scrcpy --v4l2-sink=/dev/videoN -N # más corto
|
||||||
|
```
|
||||||
|
|
||||||
|
(reemplace `N` con el ID del dispositivo, compruebe con `ls /dev/video*`)
|
||||||
|
|
||||||
|
Una vez habilitado, podés abrir el stream del video con una herramienta compatible con v4l2:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ffplay -i /dev/videoN
|
||||||
|
vlc v4l2:///dev/videoN # VLC puede agregar un delay por buffering
|
||||||
|
```
|
||||||
|
|
||||||
|
Por ejemplo, podrías capturar el video usando [OBS].
|
||||||
|
|
||||||
|
[OBS]: https://obsproject.com/
|
||||||
|
|
||||||
|
|
||||||
|
#### Buffering
|
||||||
|
|
||||||
|
Es posible agregar buffering al video. Esto reduce el ruido en la imagen ("jitter")
|
||||||
|
pero aumenta la latencia (vea [#2464]).
|
||||||
|
|
||||||
|
[#2464]: https://github.com/Genymobile/scrcpy/issues/2464
|
||||||
|
|
||||||
|
La opción de buffering está disponible para la transmisión de imagen:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scrcpy --display-buffer=50 # agrega 50 ms de buffering a la imagen
|
||||||
|
```
|
||||||
|
|
||||||
|
y las fuentes V4L2:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scrcpy --v4l2-buffer=500 # agrega 500 ms de buffering a la fuente v4l2
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Conexión
|
### Conexión
|
||||||
|
|
||||||
#### Inalámbrica
|
#### TCP/IP (Inalámbrica)
|
||||||
|
|
||||||
_Scrcpy_ usa `adb` para comunicarse con el dispositivo, y `adb` puede [conectarse] vía TCP/IP:
|
_Scrcpy_ usa `adb` para comunicarse con el dispositivo, y `adb` puede [conectarse] vía TCP/IP.
|
||||||
|
El dispositivo debe estar conectado a la misma red que la computadora:
|
||||||
|
|
||||||
|
##### Automático
|
||||||
|
|
||||||
|
La opción `--tcpip` permite configurar la conexión automáticamente. Hay 2 variables.
|
||||||
|
|
||||||
|
Si el dispositivo (accesible en 192.168.1.1 para este ejemplo) ya está escuchando
|
||||||
|
en un puerto (generalmente 5555) esperando una conexión adb entrante, entonces corré:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scrcpy --tcpip=192.168.1.1 # el puerto default es 5555
|
||||||
|
scrcpy --tcpip=192.168.1.1:5555
|
||||||
|
```
|
||||||
|
|
||||||
|
Si el dispositivo no tiene habilitado el modo adb TCP/IP (o si no sabés la dirección IP),
|
||||||
|
entonces conectá el dispositivo por USB y corré:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scrcpy --tcpip # sin argumentos
|
||||||
|
```
|
||||||
|
|
||||||
|
El programa buscará automáticamente la IP del dispositivo, habilitará el modo TCP/IP, y
|
||||||
|
se conectará al dispositivo antes de comenzar a transmitir la imagen.
|
||||||
|
|
||||||
|
##### Manual
|
||||||
|
|
||||||
|
Como alternativa, se puede habilitar la conexión TCP/IP manualmente usando `adb`:
|
||||||
|
|
||||||
1. Conecta el dispositivo al mismo Wi-Fi que tu computadora.
|
1. Conecta el dispositivo al mismo Wi-Fi que tu computadora.
|
||||||
2. Obtén la dirección IP del dispositivo, en Ajustes → Acerca del dispositivo → Estado, o ejecutando este comando:
|
2. Obtén la dirección IP del dispositivo, en Ajustes → Acerca del dispositivo → Estado, o ejecutando este comando:
|
||||||
@@ -302,7 +418,7 @@ scrcpy -s 192.168.0.1:5555 # versión breve
|
|||||||
|
|
||||||
Puedes iniciar múltiples instancias de _scrcpy_ para múltiples dispositivos.
|
Puedes iniciar múltiples instancias de _scrcpy_ para múltiples dispositivos.
|
||||||
|
|
||||||
#### Autoiniciar al detectar dispositivo
|
#### Iniciar automáticamente al detectar dispositivo
|
||||||
|
|
||||||
Puedes utilizar [AutoAdb]:
|
Puedes utilizar [AutoAdb]:
|
||||||
|
|
||||||
@@ -312,37 +428,82 @@ autoadb scrcpy -s '{}'
|
|||||||
|
|
||||||
[AutoAdb]: https://github.com/rom1v/autoadb
|
[AutoAdb]: https://github.com/rom1v/autoadb
|
||||||
|
|
||||||
#### Túnel SSH
|
#### Túneles
|
||||||
|
|
||||||
Para conectarse a un dispositivo remoto, es posible conectar un cliente local de `adb` a un servidor remoto `adb` (siempre y cuando utilicen la misma versión de protocolos _adb_):
|
Para conectarse a un dispositivo remoto, es posible conectar un cliente local `adb` a un servidor remoto `adb` (siempre y cuando utilicen la misma versión de protocolos _adb_).
|
||||||
|
|
||||||
|
##### Servidor ADB remoto
|
||||||
|
|
||||||
|
Para conectarse a un servidor ADB remoto, haz que el servidor escuche en todas las interfaces:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
adb kill-server # cierra el servidor local adb en 5037
|
adb kill-server
|
||||||
ssh -CN -L5037:localhost:5037 -R27183:localhost:27183 your_remote_computer
|
adb -a nodaemon server start
|
||||||
# conserva este servidor abierto
|
# conserva este servidor abierto
|
||||||
```
|
```
|
||||||
|
|
||||||
Desde otra terminal:
|
**Advertencia: todas las comunicaciones entre los clientes y el servidor ADB están desencriptadas.**
|
||||||
|
|
||||||
|
Supondremos que este servidor se puede acceder desde 192.168.1.2. Entonces, desde otra
|
||||||
|
terminal, corré scrcpy:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
export ADB_SERVER_SOCKET=tcp:192.168.1.2:5037
|
||||||
|
scrcpy --tunnel-host=192.168.1.2
|
||||||
|
```
|
||||||
|
|
||||||
|
Por default, scrcpy usa el puerto local que se usó para establecer el tunel
|
||||||
|
`adb forward` (típicamente `27183`, vea `--port`). También es posible forzar un
|
||||||
|
puerto diferente (puede resultar útil en situaciones más complejas, donde haya
|
||||||
|
múltiples redirecciones):
|
||||||
|
|
||||||
|
```
|
||||||
|
scrcpy --tunnel-port=1234
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
##### Túnel SSH
|
||||||
|
|
||||||
|
Para comunicarse con un servidor ADB remoto de forma segura, es preferible usar un túnel SSH.
|
||||||
|
|
||||||
|
Primero, asegurate que el servidor ADB está corriendo en la computadora remota:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
adb start-server
|
||||||
|
```
|
||||||
|
|
||||||
|
Después, establecé el túnel SSH:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# local 5038 --> remoto 5037
|
||||||
|
# local 27183 <-- remoto 27183
|
||||||
|
ssh -CN -L5038:localhost:5037 -R27183:localhost:27183 your_remote_computer
|
||||||
|
# conserva este servidor abierto
|
||||||
|
```
|
||||||
|
|
||||||
|
Desde otra terminal, corré scrcpy:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export ADB_SERVER_SOCKET=tcp:localhost:5038
|
||||||
scrcpy
|
scrcpy
|
||||||
```
|
```
|
||||||
|
|
||||||
Para evitar habilitar "remote port forwarding", puedes forzar una "forward connection" (nótese el argumento `-L` en vez de `-R`):
|
Para evitar habilitar "remote port forwarding", puedes forzar una "forward connection" (nótese el argumento `-L` en vez de `-R`):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
adb kill-server # cierra el servidor local adb en 5037
|
# local 5038 --> remoto 5037
|
||||||
ssh -CN -L5037:localhost:5037 -L27183:localhost:27183 your_remote_computer
|
# local 27183 --> remoto 27183
|
||||||
|
ssh -CN -L5038:localhost:5037 -L27183:localhost:27183 your_remote_computer
|
||||||
# conserva este servidor abierto
|
# conserva este servidor abierto
|
||||||
```
|
```
|
||||||
|
|
||||||
Desde otra terminal:
|
Desde otra terminal, corré scrcpy:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
export ADB_SERVER_SOCKET=tcp:localhost:5038
|
||||||
scrcpy --force-adb-forward
|
scrcpy --force-adb-forward
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Al igual que las conexiones inalámbricas, puede resultar útil reducir la calidad:
|
Al igual que las conexiones inalámbricas, puede resultar útil reducir la calidad:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -402,7 +563,7 @@ Se puede rotar la ventana:
|
|||||||
scrcpy --rotation 1
|
scrcpy --rotation 1
|
||||||
```
|
```
|
||||||
|
|
||||||
Los valores posibles son:
|
Los posibles valores son:
|
||||||
- `0`: sin rotación
|
- `0`: sin rotación
|
||||||
- `1`: 90 grados contrarreloj
|
- `1`: 90 grados contrarreloj
|
||||||
- `2`: 180 grados
|
- `2`: 180 grados
|
||||||
@@ -416,7 +577,7 @@ Nótese que _scrcpy_ maneja 3 diferentes rotaciones:
|
|||||||
- `--rotation` (o <kbd>MOD</kbd>+<kbd>←</kbd>/<kbd>MOD</kbd>+<kbd>→</kbd>) rota solo el contenido de la imagen. Esto solo afecta a la imagen mostrada, no a la grabación.
|
- `--rotation` (o <kbd>MOD</kbd>+<kbd>←</kbd>/<kbd>MOD</kbd>+<kbd>→</kbd>) rota solo el contenido de la imagen. Esto solo afecta a la imagen mostrada, no a la grabación.
|
||||||
|
|
||||||
|
|
||||||
### Otras opciones menores
|
### Otras opciones
|
||||||
|
|
||||||
#### Solo lectura ("Read-only")
|
#### Solo lectura ("Read-only")
|
||||||
|
|
||||||
@@ -479,14 +640,12 @@ scrcpy -Sw # versión breve
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### Renderizar frames vencidos
|
#### Apagar al cerrar la aplicación
|
||||||
|
|
||||||
Por defecto, para minimizar la latencia, _scrcpy_ siempre renderiza el último frame disponible decodificado, e ignora cualquier frame anterior.
|
Para apagar la pantalla del dispositivo al cerrar scrcpy:
|
||||||
|
|
||||||
Para forzar el renderizado de todos los frames (a costo de posible aumento de latencia), use:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --render-expired-frames
|
scrcpy --power-off-on-close
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Mostrar clicks
|
#### Mostrar clicks
|
||||||
@@ -548,6 +707,8 @@ Además, <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd> permite inyectar el texto
|
|||||||
|
|
||||||
Algunos dispositivos no se comportan como es esperado al establecer el portapapeles programáticamente. La opción `--legacy-paste` está disponible para cambiar el comportamiento de <kbd>Ctrl</kbd>+<kbd>v</kbd> y <kbd>MOD</kbd>+<kbd>v</kbd> para que también inyecten el texto del portapapeles de la computadora como una secuencia de teclas (de la misma forma que <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>).
|
Algunos dispositivos no se comportan como es esperado al establecer el portapapeles programáticamente. La opción `--legacy-paste` está disponible para cambiar el comportamiento de <kbd>Ctrl</kbd>+<kbd>v</kbd> y <kbd>MOD</kbd>+<kbd>v</kbd> para que también inyecten el texto del portapapeles de la computadora como una secuencia de teclas (de la misma forma que <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>).
|
||||||
|
|
||||||
|
Para deshabilitar la auto-sincronización del portapapeles, use `--no-clipboard-autosync`.
|
||||||
|
|
||||||
#### Pellizcar para zoom
|
#### Pellizcar para zoom
|
||||||
|
|
||||||
Para simular "pinch-to-zoom": <kbd>Ctrl</kbd>+_click-y-mover_.
|
Para simular "pinch-to-zoom": <kbd>Ctrl</kbd>+_click-y-mover_.
|
||||||
@@ -556,6 +717,48 @@ Más precisamente, mantén <kbd>Ctrl</kbd> mientras presionas botón izquierdo.
|
|||||||
|
|
||||||
Concretamente, scrcpy genera clicks adicionales con un "dedo virtual" en la posición invertida respecto al centro de la pantalla.
|
Concretamente, scrcpy genera clicks adicionales con un "dedo virtual" en la posición invertida respecto al centro de la pantalla.
|
||||||
|
|
||||||
|
#### Emular teclado físico (HID)
|
||||||
|
|
||||||
|
Por default, scrcpy usa el sistema de Android para la injección de teclas o texto:
|
||||||
|
funciona en todas partes, pero está limitado a ASCII.
|
||||||
|
|
||||||
|
En Linux, scrcpy puede emular un teclado USB físico en Android para proveer
|
||||||
|
una mejor experiencia al enviar _inputs_ (usando [USB HID vía AOAv2][hid-aoav2]):
|
||||||
|
deshabilita el teclado virtual y funciona para todos los caracteres y IME.
|
||||||
|
|
||||||
|
[hid-aoav2]: https://source.android.com/devices/accessories/aoa2#hid-support
|
||||||
|
|
||||||
|
Sin embargo, solo funciona si el dispositivo está conectado por USB, y por ahora
|
||||||
|
solo funciona en Linux.
|
||||||
|
|
||||||
|
Para habilitar este modo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scrcpy --hid-keyboard
|
||||||
|
scrcpy -K # más corto
|
||||||
|
```
|
||||||
|
|
||||||
|
Si por alguna razón falla (por ejemplo si el dispositivo no está conectado vía
|
||||||
|
USB), automáticamente vuelve al modo default (un mensaje se escribirá en la consola).
|
||||||
|
Se puede usar los mismos argumentos en la línea de comandos tanto si se conecta con
|
||||||
|
USB o vía TCP/IP.
|
||||||
|
|
||||||
|
En este modo, los _raw key events_ (_scancodes_) se envían al dispositivo, independientemente
|
||||||
|
del mapeo del teclado en el host. Por eso, si el diseño de tu teclado no concuerda, debe ser
|
||||||
|
configurado en el dispositivo Android, en Ajustes → Sistema → Idioma y Entrada de Texto
|
||||||
|
→ [Teclado Físico].
|
||||||
|
|
||||||
|
Se puede iniciar automáticamente en esta página de ajustes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
adb shell am start -a android.settings.HARD_KEYBOARD_SETTINGS
|
||||||
|
```
|
||||||
|
|
||||||
|
Sin embargo, la opción solo está disponible cuando el teclado HID está activo
|
||||||
|
(o cuando se conecta un teclado físico).
|
||||||
|
|
||||||
|
[Teclado Físico]: https://github.com/Genymobile/scrcpy/pull/2632#issuecomment-923756915
|
||||||
|
|
||||||
|
|
||||||
#### Preferencias de inyección de texto
|
#### Preferencias de inyección de texto
|
||||||
|
|
||||||
@@ -573,13 +776,23 @@ scrcpy --prefer-text
|
|||||||
|
|
||||||
(Pero esto romperá el comportamiento del teclado en los juegos)
|
(Pero esto romperá el comportamiento del teclado en los juegos)
|
||||||
|
|
||||||
|
Por el contrario, se puede forzar scrcpy para siempre injectar _raw key events_:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scrcpy --raw-key-events
|
||||||
|
```
|
||||||
|
|
||||||
|
Estas opciones no tienen efecto en los teclados HID (todos los _key events_ son enviados como
|
||||||
|
_scancodes_ en este modo).
|
||||||
|
|
||||||
[textevents]: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-text-input
|
[textevents]: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-text-input
|
||||||
[prefertext]: https://github.com/Genymobile/scrcpy/issues/650#issuecomment-512945343
|
[prefertext]: https://github.com/Genymobile/scrcpy/issues/650#issuecomment-512945343
|
||||||
|
|
||||||
|
|
||||||
#### Repetir tecla
|
#### Repetir tecla
|
||||||
|
|
||||||
Por defecto, mantener una tecla presionada genera múltiples _key events_. Esto puede causar problemas de desempeño en algunos juegos, donde estos eventos no tienen sentido de todos modos.
|
Por defecto, mantener una tecla presionada genera múltiples _key events_. Esto puede
|
||||||
|
causar problemas de desempeño en algunos juegos, donde estos eventos no tienen sentido de todos modos.
|
||||||
|
|
||||||
Para evitar enviar _key events_ repetidos:
|
Para evitar enviar _key events_ repetidos:
|
||||||
|
|
||||||
@@ -587,6 +800,9 @@ Para evitar enviar _key events_ repetidos:
|
|||||||
scrcpy --no-key-repeat
|
scrcpy --no-key-repeat
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Estas opciones no tienen efecto en los teclados HID (Android maneja directamente
|
||||||
|
las repeticiones de teclas en este modo)
|
||||||
|
|
||||||
|
|
||||||
#### Botón derecho y botón del medio
|
#### Botón derecho y botón del medio
|
||||||
|
|
||||||
@@ -608,14 +824,15 @@ No hay respuesta visual, un mensaje se escribirá en la consola.
|
|||||||
|
|
||||||
#### Enviar archivos al dispositivo
|
#### Enviar archivos al dispositivo
|
||||||
|
|
||||||
Para enviar un archivo a `/sdcard/` en el dispositivo, arrastre y suelte un archivo (no APK) a la ventana de _scrcpy_.
|
Para enviar un archivo a `/sdcard/Download/` en el dispositivo, arrastre y suelte
|
||||||
|
un archivo (no APK) a la ventana de _scrcpy_.
|
||||||
|
|
||||||
No hay respuesta visual, un mensaje se escribirá en la consola.
|
No hay ninguna respuesta visual, un mensaje se escribirá en la consola.
|
||||||
|
|
||||||
El directorio de destino puede ser modificado al iniciar:
|
El directorio de destino puede ser modificado al iniciar:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --push-target=/sdcard/Download/
|
scrcpy --push-target=/sdcard/Movies/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@@ -647,36 +864,48 @@ _<kbd>[Super]</kbd> es generalmente la tecla <kbd>Windows</kbd> o <kbd>Cmd</kbd>
|
|||||||
|
|
||||||
[Super]: https://en.wikipedia.org/wiki/Super_key_(keyboard_button)
|
[Super]: https://en.wikipedia.org/wiki/Super_key_(keyboard_button)
|
||||||
|
|
||||||
| Acción | Atajo
|
| Acción | Atajo
|
||||||
| ------------------------------------------- |:-----------------------------
|
| ------------------------------------------- |:-----------------------------
|
||||||
| Alterne entre pantalla compelta | <kbd>MOD</kbd>+<kbd>f</kbd>
|
| Alterne entre pantalla compelta | <kbd>MOD</kbd>+<kbd>f</kbd>
|
||||||
| Rotar pantalla hacia la izquierda | <kbd>MOD</kbd>+<kbd>←</kbd> _(izquierda)_
|
| Rotar pantalla hacia la izquierda | <kbd>MOD</kbd>+<kbd>←</kbd> _(izquierda)_
|
||||||
| Rotar pantalla hacia la derecha | <kbd>MOD</kbd>+<kbd>→</kbd> _(derecha)_
|
| Rotar pantalla hacia la derecha | <kbd>MOD</kbd>+<kbd>→</kbd> _(derecha)_
|
||||||
| Ajustar ventana a 1:1 ("pixel-perfect") | <kbd>MOD</kbd>+<kbd>g</kbd>
|
| Ajustar ventana a 1:1 ("pixel-perfect") | <kbd>MOD</kbd>+<kbd>g</kbd>
|
||||||
| Ajustar ventana para quitar los bordes negros| <kbd>MOD</kbd>+<kbd>w</kbd> \| _Doble click¹_
|
| Ajustar ventana para quitar los bordes negros| <kbd>MOD</kbd>+<kbd>w</kbd> \| _Doble click izquierdo¹_
|
||||||
| Click en `INICIO` | <kbd>MOD</kbd>+<kbd>h</kbd> \| _Botón del medio_
|
| Click en `INICIO` | <kbd>MOD</kbd>+<kbd>h</kbd> \| _Click medio_
|
||||||
| Click en `RETROCEDER` | <kbd>MOD</kbd>+<kbd>b</kbd> \| _Botón derecho²_
|
| Click en `RETROCEDER` | <kbd>MOD</kbd>+<kbd>b</kbd> \| _Click derecho²_
|
||||||
| Click en `CAMBIAR APLICACIÓN` | <kbd>MOD</kbd>+<kbd>s</kbd>
|
| Click en `CAMBIAR APLICACIÓN` | <kbd>MOD</kbd>+<kbd>s</kbd> \| _Cuarto botón³_
|
||||||
| Click en `MENÚ` (desbloquear pantalla) | <kbd>MOD</kbd>+<kbd>m</kbd>
|
| Click en `MENÚ` (desbloquear pantalla)⁴ | <kbd>MOD</kbd>+<kbd>m</kbd>
|
||||||
| Click en `SUBIR VOLUMEN` | <kbd>MOD</kbd>+<kbd>↑</kbd> _(arriba)_
|
| Click en `SUBIR VOLUMEN` | <kbd>MOD</kbd>+<kbd>↑</kbd> _(arriba)_
|
||||||
| Click en `BAJAR VOLUME` | <kbd>MOD</kbd>+<kbd>↓</kbd> _(abajo)_
|
| Click en `BAJAR VOLUME` | <kbd>MOD</kbd>+<kbd>↓</kbd> _(abajo)_
|
||||||
| Click en `ENCENDIDO` | <kbd>MOD</kbd>+<kbd>p</kbd>
|
| Click en `ENCENDIDO` | <kbd>MOD</kbd>+<kbd>p</kbd>
|
||||||
| Encendido | _Botón derecho²_
|
| Encendido | _Botón derecho²_
|
||||||
| Apagar pantalla (manteniendo la transmisión)| <kbd>MOD</kbd>+<kbd>o</kbd>
|
| Apagar pantalla (manteniendo la transmisión) | <kbd>MOD</kbd>+<kbd>o</kbd>
|
||||||
| Encender pantalla | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>o</kbd>
|
| Encender pantalla | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>o</kbd>
|
||||||
| Rotar pantalla del dispositivo | <kbd>MOD</kbd>+<kbd>r</kbd>
|
| Rotar pantalla del dispositivo | <kbd>MOD</kbd>+<kbd>r</kbd>
|
||||||
| Abrir panel de notificaciones | <kbd>MOD</kbd>+<kbd>n</kbd>
|
| Abrir panel de notificaciones | <kbd>MOD</kbd>+<kbd>n</kbd> \| _Quinto botón³_
|
||||||
| Cerrar panel de notificaciones | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>n</kbd>
|
| Abrir panel de configuración | <kbd>MOD</kbd>+<kbd>n</kbd>+<kbd>n</kbd> \| _Doble quinto botón³_
|
||||||
| Copiar al portapapeles³ | <kbd>MOD</kbd>+<kbd>c</kbd>
|
| Cerrar paneles | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>n</kbd>
|
||||||
| Cortar al portapapeles³ | <kbd>MOD</kbd>+<kbd>x</kbd>
|
| Copiar al portapapeles⁵ | <kbd>MOD</kbd>+<kbd>c</kbd>
|
||||||
| Synchronizar portapapeles y pegar³ | <kbd>MOD</kbd>+<kbd>v</kbd>
|
| Cortar al portapapeles⁵ | <kbd>MOD</kbd>+<kbd>x</kbd>
|
||||||
| inyectar texto del portapapeles de la PC | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>
|
| Synchronizar portapapeles y pegar⁵ | <kbd>MOD</kbd>+<kbd>v</kbd>
|
||||||
|
| Inyectar texto del portapapeles de la PC | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>
|
||||||
| Habilitar/Deshabilitar contador de FPS (en stdout) | <kbd>MOD</kbd>+<kbd>i</kbd>
|
| Habilitar/Deshabilitar contador de FPS (en stdout) | <kbd>MOD</kbd>+<kbd>i</kbd>
|
||||||
| Pellizcar para zoom | <kbd>Ctrl</kbd>+_click-y-mover_
|
| Pellizcar para zoom | <kbd>Ctrl</kbd>+_click-y-mover_
|
||||||
|
| Arrastrar y soltar un archivo (APK) | Instalar APK desde la computadora
|
||||||
|
| Arrastrar y soltar un archivo (no APK) | [Mover archivo al dispositivo](#enviar-archivos-al-dispositivo)
|
||||||
|
|
||||||
_¹Doble click en los bordes negros para eliminarlos._
|
_¹Doble click en los bordes negros para eliminarlos._
|
||||||
_²Botón derecho enciende la pantalla si estaba apagada, sino ejecuta RETROCEDER._
|
_²Botón derecho enciende la pantalla si estaba apagada, sino ejecuta RETROCEDER._
|
||||||
_³Solo en Android >= 7._
|
_³Cuarto y quinto botón del mouse, si tu mouse los tiene._
|
||||||
|
_⁴Para las apps react-native en desarrollo, `MENU` activa el menú de desarrollo._
|
||||||
|
_⁵Solo en Android >= 7._
|
||||||
|
|
||||||
|
Los shortcuts con teclas repetidas se ejecutan soltando y volviendo a apretar la tecla
|
||||||
|
por segunda vez. Por ejemplo, para ejecutar "Abrir panel de configuración":
|
||||||
|
|
||||||
|
1. Apretá y mantené apretado <kbd>MOD</kbd>.
|
||||||
|
2. Después apretá dos veces la tecla <kbd>n</kbd>.
|
||||||
|
3. Por último, soltá la tecla <kbd>MOD</kbd>.
|
||||||
|
|
||||||
Todos los atajos <kbd>Ctrl</kbd>+_tecla_ son enviados al dispositivo para que sean manejados por la aplicación activa.
|
Todos los atajos <kbd>Ctrl</kbd>+_tecla_ son enviados al dispositivo para que sean manejados por la aplicación activa.
|
||||||
|
|
||||||
@@ -691,6 +920,8 @@ ADB=/path/to/adb scrcpy
|
|||||||
|
|
||||||
Para sobreescribir el path del archivo `scrcpy-server`, configure el path en `SCRCPY_SERVER_PATH`.
|
Para sobreescribir el path del archivo `scrcpy-server`, configure el path en `SCRCPY_SERVER_PATH`.
|
||||||
|
|
||||||
|
Para sobreescribir el ícono, configure el path en `SCRCPY_ICON_PATH`.
|
||||||
|
|
||||||
|
|
||||||
## ¿Por qué _scrcpy_?
|
## ¿Por qué _scrcpy_?
|
||||||
|
|
||||||
|
|||||||
+162
-34
@@ -1,17 +1,19 @@
|
|||||||
_Only the original [README](README.md) is guaranteed to be up-to-date._
|
_Only the original [README](README.md) is guaranteed to be up-to-date._
|
||||||
|
|
||||||
只有原版的[README](README.md)会保持最新。
|
_只有原版的 [README](README.md)是保证最新的。_
|
||||||
|
|
||||||
Current version is based on [65b023a]
|
Current version is based on [f4c7044]
|
||||||
|
|
||||||
本文根据[65b023a]进行翻译。
|
本文根据[f4c7044]进行翻译。
|
||||||
|
|
||||||
[65b023a]: https://github.com/Genymobile/scrcpy/blob/65b023ac6d586593193fd5290f65e25603b68e02/README.md
|
[f4c7044]: https://github.com/Genymobile/scrcpy/blob/f4c7044b46ae28eb64cb5e1a15c9649a44023c70/README.md
|
||||||
|
|
||||||
# scrcpy (v1.20)
|
# scrcpy (v1.22)
|
||||||
|
|
||||||
<img src="data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
<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_。
|
本应用程序可以显示并控制通过 USB (或 [TCP/IP][article-tcpip]) 连接的安卓设备,且不需要任何 _root_ 权限。本程序支持 _GNU/Linux_, _Windows_ 和 _macOS_。
|
||||||
|
|
||||||

|

|
||||||
@@ -36,6 +38,8 @@ Current version is based on [65b023a]
|
|||||||
- [可配置显示质量](#采集设置)
|
- [可配置显示质量](#采集设置)
|
||||||
- 以设备屏幕[作为摄像头(V4L2)](#v4l2loopback) (仅限 Linux)
|
- 以设备屏幕[作为摄像头(V4L2)](#v4l2loopback) (仅限 Linux)
|
||||||
- [模拟物理键盘 (HID)](#物理键盘模拟-hid) (仅限 Linux)
|
- [模拟物理键盘 (HID)](#物理键盘模拟-hid) (仅限 Linux)
|
||||||
|
- [物理鼠标模拟 (HID)](#物理鼠标模拟-hid) (仅限 Linux)
|
||||||
|
- [OTG模式](#otg) (仅限 Linux)
|
||||||
- 更多 ……
|
- 更多 ……
|
||||||
|
|
||||||
## 系统要求
|
## 系统要求
|
||||||
@@ -68,12 +72,18 @@ Current version is based on [65b023a]
|
|||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
在 Debian (目前仅支持 _testing_ 和 _sid_ 分支) 和Ubuntu (20.04) 上:
|
在 Debian 和 Ubuntu 上:
|
||||||
|
|
||||||
```
|
```
|
||||||
apt install scrcpy
|
apt install scrcpy
|
||||||
```
|
```
|
||||||
|
|
||||||
|
在 Arch Linux 上:
|
||||||
|
|
||||||
|
```
|
||||||
|
pacman -S scrcpy
|
||||||
|
```
|
||||||
|
|
||||||
我们也提供 [Snap] 包: [`scrcpy`][snap-link]。
|
我们也提供 [Snap] 包: [`scrcpy`][snap-link]。
|
||||||
|
|
||||||
[snap-link]: https://snapstats.org/snaps/scrcpy
|
[snap-link]: https://snapstats.org/snaps/scrcpy
|
||||||
@@ -85,11 +95,6 @@ apt install scrcpy
|
|||||||
[COPR]: https://fedoraproject.org/wiki/Category:Copr
|
[COPR]: https://fedoraproject.org/wiki/Category:Copr
|
||||||
[copr-link]: https://copr.fedorainfracloud.org/coprs/zeno/scrcpy/
|
[copr-link]: https://copr.fedorainfracloud.org/coprs/zeno/scrcpy/
|
||||||
|
|
||||||
对 Arch Linux 我们提供 [AUR] 包: [`scrcpy`][aur-link]。
|
|
||||||
|
|
||||||
[AUR]: https://wiki.archlinux.org/index.php/Arch_User_Repository
|
|
||||||
[aur-link]: https://aur.archlinux.org/packages/scrcpy/
|
|
||||||
|
|
||||||
对 Gentoo 我们提供 [Ebuild] 包:[`scrcpy/`][ebuild-link]。
|
对 Gentoo 我们提供 [Ebuild] 包:[`scrcpy/`][ebuild-link]。
|
||||||
|
|
||||||
[Ebuild]: https://wiki.gentoo.org/wiki/Ebuild
|
[Ebuild]: https://wiki.gentoo.org/wiki/Ebuild
|
||||||
@@ -343,9 +348,32 @@ scrcpy --v4l2-buffer=500 # 为 v4l2 漏增加 500 毫秒的缓冲
|
|||||||
|
|
||||||
### 连接
|
### 连接
|
||||||
|
|
||||||
#### 无线
|
#### TCP/IP (无线)
|
||||||
|
|
||||||
_Scrcpy_ 使用 `adb` 与设备通信,并且 `adb` 支持通过 TCP/IP [连接]到设备:
|
_Scrcpy_ 使用 `adb` 与设备通信,并且 `adb` 支持通过 TCP/IP [连接]到设备(设备必须连接与电脑相同的网络)。
|
||||||
|
|
||||||
|
##### 自动配置
|
||||||
|
|
||||||
|
参数 `--tcpip` 允许自动配置连接。这里有两种方式。
|
||||||
|
|
||||||
|
对于传入的 adb 连接,如果设备(在这个例子中以192.168.1.1为可用地址)已经监听了一个端口(通常是5555),运行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scrcpy --tcpip=192.168.1.1 # 默认端口是5555
|
||||||
|
scrcpy --tcpip=192.168.1.1:5555
|
||||||
|
```
|
||||||
|
|
||||||
|
如果adb TCP/IP(无线) 模式在某些设备上不被启用(或者你不知道IP地址),用USB连接设备,然后运行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scrcpy --tcpip # 无需其他参数
|
||||||
|
```
|
||||||
|
|
||||||
|
这将会自动寻找设备IP地址,启用TCP/IP模式,然后在启动之前连接到设备。
|
||||||
|
|
||||||
|
##### 手动配置
|
||||||
|
|
||||||
|
或者,可以通过 `adb` 使用手动启用 TCP/IP 连接:
|
||||||
|
|
||||||
1. 将设备和电脑连接至同一 Wi-Fi。
|
1. 将设备和电脑连接至同一 Wi-Fi。
|
||||||
2. 打开 设置 → 关于手机 → 状态信息,获取设备的 IP 地址,也可以执行以下的命令:
|
2. 打开 设置 → 关于手机 → 状态信息,获取设备的 IP 地址,也可以执行以下的命令:
|
||||||
@@ -354,12 +382,12 @@ _Scrcpy_ 使用 `adb` 与设备通信,并且 `adb` 支持通过 TCP/IP [连接
|
|||||||
adb shell ip route | awk '{print $9}'
|
adb shell ip route | awk '{print $9}'
|
||||||
```
|
```
|
||||||
|
|
||||||
3. 启用设备的网络 adb 功能: `adb tcpip 5555`。
|
3. 启用设备的网络 adb 功能:`adb tcpip 5555`。
|
||||||
4. 断开设备的 USB 连接。
|
4. 断开设备的 USB 连接。
|
||||||
5. 连接到您的设备:`adb connect DEVICE_IP:5555` _(将 `DEVICE_IP` 替换为设备 IP)_。
|
5. 连接到您的设备:`adb connect DEVICE_IP:5555` _(将 `DEVICE_IP` 替换为设备 IP)_。
|
||||||
6. 正常运行 `scrcpy`。
|
6. 正常运行 `scrcpy`。
|
||||||
|
|
||||||
可能降低码率和分辨率会更好一些:
|
降低比特率和分辨率可能很有用:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --bit-rate 2M --max-size 800
|
scrcpy --bit-rate 2M --max-size 800
|
||||||
@@ -397,33 +425,75 @@ autoadb scrcpy -s '{}'
|
|||||||
|
|
||||||
[AutoAdb]: https://github.com/rom1v/autoadb
|
[AutoAdb]: https://github.com/rom1v/autoadb
|
||||||
|
|
||||||
#### SSH 隧道
|
#### 隧道
|
||||||
|
|
||||||
要远程连接到设备,可以将本地的 adb 客户端连接到远程的 adb 服务端 (需要两端的 _adb_ 协议版本相同):
|
要远程连接到设备,可以将本地的 adb 客户端连接到远程的 adb 服务端 (需要两端的 _adb_ 协议版本相同)。
|
||||||
|
|
||||||
|
##### 远程ADB服务器
|
||||||
|
|
||||||
|
要连接到一个远程ADB服务器,让服务器在所有接口上监听:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
adb kill-server # 关闭本地 5037 端口上的 adb 服务端
|
adb kill-server
|
||||||
ssh -CN -L5037:localhost:5037 -R27183:localhost:27183 your_remote_computer
|
adb -a nodaemon server start
|
||||||
# 保持该窗口开启
|
# 保持该窗口开启
|
||||||
```
|
```
|
||||||
|
|
||||||
在另一个终端:
|
**警告:所有客户端与ADB服务器的交流都是未加密的。**
|
||||||
|
|
||||||
|
假设此服务器可在 192.168.1.2 访问。 然后,从另一个终端,运行 scrcpy:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
export ADB_SERVER_SOCKET=tcp:192.168.1.2:5037
|
||||||
|
scrcpy --tunnel-host=192.168.1.2
|
||||||
|
```
|
||||||
|
|
||||||
|
默认情况下,scrcpy使用用于 `adb forward` 隧道建立的本地端口(通常是 `27183`,见 `--port` )。它也可以强制使用一个不同的隧道端口(当涉及更多的重定向时,这在更复杂的情况下可能很有用):
|
||||||
|
|
||||||
|
```
|
||||||
|
scrcpy --tunnel-port=1234
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
##### SSH 隧道
|
||||||
|
|
||||||
|
为了安全地与远程ADB服务器通信,最好使用SSH隧道。
|
||||||
|
|
||||||
|
首先,确保ADB服务器正在远程计算机上运行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
adb start-server
|
||||||
|
```
|
||||||
|
|
||||||
|
然后,建立一个SSH隧道:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 本地 5038 --> 远程 5037
|
||||||
|
# 本地 27183 <-- 远程 27183
|
||||||
|
ssh -CN -L5038:localhost:5037 -R27183:localhost:27183 your_remote_computer
|
||||||
|
# 保持该窗口开启
|
||||||
|
```
|
||||||
|
|
||||||
|
在另一个终端上,运行scrcpy:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export ADB_SERVER_SOCKET=tcp:localhost:5038
|
||||||
scrcpy
|
scrcpy
|
||||||
```
|
```
|
||||||
|
|
||||||
若要不使用远程端口转发,可以强制使用正向连接 (注意 `-L` 和 `-R` 的区别):
|
若要不使用远程端口转发,可以强制使用正向连接(注意是 `-L` 而不是 `-R` ):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
adb kill-server # 关闭本地 5037 端口上的 adb 服务端
|
# 本地 5038 --> 远程 5037
|
||||||
ssh -CN -L5037:localhost:5037 -L27183:localhost:27183 your_remote_computer
|
# 本地 27183 <-- 远程 27183
|
||||||
|
ssh -CN -L5038:localhost:5037 -L27183:localhost:27183 your_remote_computer
|
||||||
# 保持该窗口开启
|
# 保持该窗口开启
|
||||||
```
|
```
|
||||||
|
|
||||||
在另一个终端:
|
在另一个终端上,运行scrcpy:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
export ADB_SERVER_SOCKET=tcp:localhost:5038
|
||||||
scrcpy --force-adb-forward
|
scrcpy --force-adb-forward
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -441,7 +511,7 @@ scrcpy -b2M -m800 --max-fps 15
|
|||||||
窗口的标题默认为设备型号。可以通过如下命令修改:
|
窗口的标题默认为设备型号。可以通过如下命令修改:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --window-title 'My device'
|
scrcpy --window-title "我的设备"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 位置和大小
|
#### 位置和大小
|
||||||
@@ -630,6 +700,8 @@ scrcpy --disable-screensaver
|
|||||||
|
|
||||||
一些设备不支持通过程序设置剪贴板。通过 `--legacy-paste` 选项可以修改 <kbd>Ctrl</kbd>+<kbd>v</kbd> 和 <kbd>MOD</kbd>+<kbd>v</kbd> 的工作方式,使它们通过按键事件 (同 <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>) 来注入电脑剪贴板内容。
|
一些设备不支持通过程序设置剪贴板。通过 `--legacy-paste` 选项可以修改 <kbd>Ctrl</kbd>+<kbd>v</kbd> 和 <kbd>MOD</kbd>+<kbd>v</kbd> 的工作方式,使它们通过按键事件 (同 <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>) 来注入电脑剪贴板内容。
|
||||||
|
|
||||||
|
要禁用自动剪贴板同步功能,使用`--no-clipboard-autosync`。
|
||||||
|
|
||||||
#### 双指缩放
|
#### 双指缩放
|
||||||
|
|
||||||
模拟“双指缩放”:<kbd>Ctrl</kbd>+_按住并移动鼠标_。
|
模拟“双指缩放”:<kbd>Ctrl</kbd>+_按住并移动鼠标_。
|
||||||
@@ -659,11 +731,60 @@ scrcpy -K # 简写
|
|||||||
|
|
||||||
在这种模式下,原始按键事件 (扫描码) 被发送给设备,而与宿主机按键映射无关。因此,若键盘布局不匹配,需要在 Android 设备上进行配置,具体为 设置 → 系统 → 语言和输入法 → [实体键盘]。
|
在这种模式下,原始按键事件 (扫描码) 被发送给设备,而与宿主机按键映射无关。因此,若键盘布局不匹配,需要在 Android 设备上进行配置,具体为 设置 → 系统 → 语言和输入法 → [实体键盘]。
|
||||||
|
|
||||||
[Physical keyboard]: https://github.com/Genymobile/scrcpy/pull/2632#issuecomment-923756915
|
[实体键盘]: 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]:
|
输入文字的时候,系统会产生两种[事件][textevents]:
|
||||||
- _按键事件_ ,代表一个按键被按下或松开。
|
- _按键事件_ ,代表一个按键被按下或松开。
|
||||||
- _文本事件_ ,代表一个字符被输入。
|
- _文本事件_ ,代表一个字符被输入。
|
||||||
|
|
||||||
@@ -675,7 +796,13 @@ scrcpy -K # 简写
|
|||||||
scrcpy --prefer-text
|
scrcpy --prefer-text
|
||||||
```
|
```
|
||||||
|
|
||||||
(这会导致键盘在游戏中工作不正常)
|
(但这会导致键盘在游戏中工作不正常)
|
||||||
|
|
||||||
|
相反,您可以强制始终注入原始按键事件:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scrcpy --raw-key-events
|
||||||
|
```
|
||||||
|
|
||||||
该选项不影响 HID 键盘 (该模式下,所有按键都发送为扫描码)。
|
该选项不影响 HID 键盘 (该模式下,所有按键都发送为扫描码)。
|
||||||
|
|
||||||
@@ -765,7 +892,7 @@ _<kbd>[Super]</kbd> 键通常是指 <kbd>Windows</kbd> 或 <kbd>Cmd</kbd> 键。
|
|||||||
| 点按 `主屏幕` | <kbd>MOD</kbd>+<kbd>h</kbd> \| _中键_
|
| 点按 `主屏幕` | <kbd>MOD</kbd>+<kbd>h</kbd> \| _中键_
|
||||||
| 点按 `返回` | <kbd>MOD</kbd>+<kbd>b</kbd> \| _右键²_
|
| 点按 `返回` | <kbd>MOD</kbd>+<kbd>b</kbd> \| _右键²_
|
||||||
| 点按 `切换应用` | <kbd>MOD</kbd>+<kbd>s</kbd> \| _第4键³_
|
| 点按 `切换应用` | <kbd>MOD</kbd>+<kbd>s</kbd> \| _第4键³_
|
||||||
| 点按 `菜单` (解锁屏幕) | <kbd>MOD</kbd>+<kbd>m</kbd>
|
| 点按 `菜单` (解锁屏幕)⁴ | <kbd>MOD</kbd>+<kbd>m</kbd>
|
||||||
| 点按 `音量+` | <kbd>MOD</kbd>+<kbd>↑</kbd> _(上箭头)_
|
| 点按 `音量+` | <kbd>MOD</kbd>+<kbd>↑</kbd> _(上箭头)_
|
||||||
| 点按 `音量-` | <kbd>MOD</kbd>+<kbd>↓</kbd> _(下箭头)_
|
| 点按 `音量-` | <kbd>MOD</kbd>+<kbd>↓</kbd> _(下箭头)_
|
||||||
| 点按 `电源` | <kbd>MOD</kbd>+<kbd>p</kbd>
|
| 点按 `电源` | <kbd>MOD</kbd>+<kbd>p</kbd>
|
||||||
@@ -776,9 +903,9 @@ _<kbd>[Super]</kbd> 键通常是指 <kbd>Windows</kbd> 或 <kbd>Cmd</kbd> 键。
|
|||||||
| 展开通知面板 | <kbd>MOD</kbd>+<kbd>n</kbd> \| _第5键³_
|
| 展开通知面板 | <kbd>MOD</kbd>+<kbd>n</kbd> \| _第5键³_
|
||||||
| 展开设置面板 | <kbd>MOD</kbd>+<kbd>n</kbd>+<kbd>n</kbd> \| _双击第5键³_
|
| 展开设置面板 | <kbd>MOD</kbd>+<kbd>n</kbd>+<kbd>n</kbd> \| _双击第5键³_
|
||||||
| 收起通知面板 | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>n</kbd>
|
| 收起通知面板 | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>n</kbd>
|
||||||
| 复制到剪贴板⁴ | <kbd>MOD</kbd>+<kbd>c</kbd>
|
| 复制到剪贴板⁵ | <kbd>MOD</kbd>+<kbd>c</kbd>
|
||||||
| 剪切到剪贴板⁴ | <kbd>MOD</kbd>+<kbd>x</kbd>
|
| 剪切到剪贴板⁵ | <kbd>MOD</kbd>+<kbd>x</kbd>
|
||||||
| 同步剪贴板并粘贴⁴ | <kbd>MOD</kbd>+<kbd>v</kbd>
|
| 同步剪贴板并粘贴⁵ | <kbd>MOD</kbd>+<kbd>v</kbd>
|
||||||
| 注入电脑剪贴板文本 | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>
|
| 注入电脑剪贴板文本 | <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>
|
||||||
| 打开/关闭FPS显示 (至标准输出) | <kbd>MOD</kbd>+<kbd>i</kbd>
|
| 打开/关闭FPS显示 (至标准输出) | <kbd>MOD</kbd>+<kbd>i</kbd>
|
||||||
| 捏拉缩放 | <kbd>Ctrl</kbd>+_按住并移动鼠标_
|
| 捏拉缩放 | <kbd>Ctrl</kbd>+_按住并移动鼠标_
|
||||||
@@ -788,7 +915,8 @@ _<kbd>[Super]</kbd> 键通常是指 <kbd>Windows</kbd> 或 <kbd>Cmd</kbd> 键。
|
|||||||
_¹双击黑边可以去除黑边。_
|
_¹双击黑边可以去除黑边。_
|
||||||
_²点击鼠标右键将在屏幕熄灭时点亮屏幕,其余情况则视为按下返回键 。_
|
_²点击鼠标右键将在屏幕熄灭时点亮屏幕,其余情况则视为按下返回键 。_
|
||||||
_³鼠标的第4键和第5键。_
|
_³鼠标的第4键和第5键。_
|
||||||
_⁴需要安卓版本 Android >= 7。_
|
_⁴对于开发中的 react-native 应用程序,`MENU` 触发开发菜单。_
|
||||||
|
_⁵需要安卓版本 Android >= 7。_
|
||||||
|
|
||||||
有重复按键的快捷键通过松开再按下一个按键来进行,如“展开设置面板”:
|
有重复按键的快捷键通过松开再按下一个按键来进行,如“展开设置面板”:
|
||||||
|
|
||||||
@@ -816,7 +944,7 @@ ADB=/path/to/adb scrcpy
|
|||||||
|
|
||||||
一个同事让我找出一个和 [gnirehtet] 一样难以发音的名字。
|
一个同事让我找出一个和 [gnirehtet] 一样难以发音的名字。
|
||||||
|
|
||||||
[`strcpy`] 复制一个 **str**ing (字符串); `scrcpy` 复制一个 **scr**een (屏幕)。
|
[`strcpy`] 源于 **str**ing (字符串); `scrcpy` 源于 **scr**een (屏幕)。
|
||||||
|
|
||||||
[gnirehtet]: https://github.com/Genymobile/gnirehtet
|
[gnirehtet]: https://github.com/Genymobile/gnirehtet
|
||||||
[`strcpy`]: http://man7.org/linux/man-pages/man3/strcpy.3.html
|
[`strcpy`]: http://man7.org/linux/man-pages/man3/strcpy.3.html
|
||||||
|
|||||||
+5
-5
@@ -109,9 +109,9 @@ if not crossbuild_windows
|
|||||||
else
|
else
|
||||||
# cross-compile mingw32 build (from Linux to Windows)
|
# cross-compile mingw32 build (from Linux to Windows)
|
||||||
prebuilt_sdl2 = meson.get_cross_property('prebuilt_sdl2')
|
prebuilt_sdl2 = meson.get_cross_property('prebuilt_sdl2')
|
||||||
sdl2_bin_dir = meson.current_source_dir() + '/../prebuilt-deps/' + prebuilt_sdl2 + '/bin'
|
sdl2_bin_dir = meson.current_source_dir() + '/../prebuilt-deps/data/' + prebuilt_sdl2 + '/bin'
|
||||||
sdl2_lib_dir = meson.current_source_dir() + '/../prebuilt-deps/' + prebuilt_sdl2 + '/lib'
|
sdl2_lib_dir = meson.current_source_dir() + '/../prebuilt-deps/data/' + prebuilt_sdl2 + '/lib'
|
||||||
sdl2_include_dir = '../prebuilt-deps/' + prebuilt_sdl2 + '/include'
|
sdl2_include_dir = '../prebuilt-deps/data/' + prebuilt_sdl2 + '/include'
|
||||||
|
|
||||||
sdl2 = declare_dependency(
|
sdl2 = declare_dependency(
|
||||||
dependencies: [
|
dependencies: [
|
||||||
@@ -122,8 +122,8 @@ else
|
|||||||
)
|
)
|
||||||
|
|
||||||
prebuilt_ffmpeg = meson.get_cross_property('prebuilt_ffmpeg')
|
prebuilt_ffmpeg = meson.get_cross_property('prebuilt_ffmpeg')
|
||||||
ffmpeg_bin_dir = meson.current_source_dir() + '/../prebuilt-deps/' + prebuilt_ffmpeg + '/bin'
|
ffmpeg_bin_dir = meson.current_source_dir() + '/../prebuilt-deps/data/' + prebuilt_ffmpeg + '/bin'
|
||||||
ffmpeg_include_dir = '../prebuilt-deps/' + prebuilt_ffmpeg + '/include'
|
ffmpeg_include_dir = '../prebuilt-deps/data/' + prebuilt_ffmpeg + '/include'
|
||||||
|
|
||||||
# ffmpeg versions are different for win32 and win64 builds
|
# ffmpeg versions are different for win32 and win64 builds
|
||||||
ffmpeg_avcodec = meson.get_cross_property('ffmpeg_avcodec')
|
ffmpeg_avcodec = meson.get_cross_property('ffmpeg_avcodec')
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ BEGIN
|
|||||||
VALUE "LegalCopyright", "Romain Vimont, Genymobile"
|
VALUE "LegalCopyright", "Romain Vimont, Genymobile"
|
||||||
VALUE "OriginalFilename", "scrcpy.exe"
|
VALUE "OriginalFilename", "scrcpy.exe"
|
||||||
VALUE "ProductName", "scrcpy"
|
VALUE "ProductName", "scrcpy"
|
||||||
VALUE "ProductVersion", "1.21"
|
VALUE "ProductVersion", "1.22"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
static char *
|
static char *
|
||||||
sc_adb_parse_device_ip_from_line(char *line, size_t len) {
|
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"
|
// "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)
|
// Get the location of the device name (index of "wlan0" in the example)
|
||||||
|
|||||||
@@ -3,10 +3,12 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "stddef.h"
|
#include <stddef.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the ip from the output of `adb shell ip route`
|
* Parse the ip from the output of `adb shell ip route`
|
||||||
|
*
|
||||||
|
* Warning: this function modifies the buffer for optimization purposes.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
sc_adb_parse_device_ip_from_output(char *buf, size_t buf_len);
|
sc_adb_parse_device_ip_from_output(char *buf, size_t buf_len);
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
static SDL_LogPriority
|
static SDL_LogPriority
|
||||||
@@ -51,3 +54,24 @@ sc_get_log_level(void) {
|
|||||||
SDL_LogPriority sdl_log = SDL_LogGetPriority(SDL_LOG_CATEGORY_APPLICATION);
|
SDL_LogPriority sdl_log = SDL_LogGetPriority(SDL_LOG_CATEGORY_APPLICATION);
|
||||||
return log_level_sdl_to_sc(sdl_log);
|
return log_level_sdl_to_sc(sdl_log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
bool
|
||||||
|
sc_log_windows_error(const char *prefix, int error) {
|
||||||
|
assert(prefix);
|
||||||
|
|
||||||
|
char *message;
|
||||||
|
DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM;
|
||||||
|
DWORD lang_id = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
|
||||||
|
int ret =
|
||||||
|
FormatMessage(flags, NULL, error, lang_id, (char *) &message, 0, NULL);
|
||||||
|
if (ret <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: message already contains a trailing '\n'
|
||||||
|
LOGE("%s: [%d] %s", prefix, error, message);
|
||||||
|
LocalFree(message);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -26,4 +26,10 @@ sc_set_log_level(enum sc_log_level level);
|
|||||||
enum sc_log_level
|
enum sc_log_level
|
||||||
sc_get_log_level(void);
|
sc_get_log_level(void);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Log system error (typically returned by GetLastError() or similar)
|
||||||
|
bool
|
||||||
|
sc_log_windows_error(const char *prefix, int error);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-8
@@ -117,14 +117,7 @@ set_cloexec_flag(sc_raw_socket raw_sock) {
|
|||||||
static void
|
static void
|
||||||
net_perror(const char *s) {
|
net_perror(const char *s) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
int error = WSAGetLastError();
|
sc_log_windows_error(s, WSAGetLastError());
|
||||||
char *wsa_message;
|
|
||||||
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
|
||||||
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
||||||
(char *) &wsa_message, 0, NULL);
|
|
||||||
// no explicit '\n', wsa_message already contains a trailing '\n'
|
|
||||||
fprintf(stderr, "%s: [%d] %s", s, error, wsa_message);
|
|
||||||
LocalFree(wsa_message);
|
|
||||||
#else
|
#else
|
||||||
perror(s);
|
perror(s);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
// <https://stackoverflow.com/a/44383330/1987178>
|
// <https://stackoverflow.com/a/44383330/1987178>
|
||||||
# define SC_PRIsizet "Iu"
|
# define SC_PRIsizet "Iu"
|
||||||
# define SC_PROCESS_NONE NULL
|
# define SC_PROCESS_NONE NULL
|
||||||
# define SC_EXIT_CODE_NONE -1u // max value as unsigned
|
# define SC_EXIT_CODE_NONE -1UL // max value as unsigned long
|
||||||
typedef HANDLE sc_pid;
|
typedef HANDLE sc_pid;
|
||||||
typedef DWORD sc_exit_code;
|
typedef DWORD sc_exit_code;
|
||||||
typedef HANDLE sc_pipe;
|
typedef HANDLE sc_pipe;
|
||||||
|
|||||||
+3
-3
@@ -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`
|
* 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
|
* An '\0' is always written at the end of the data string, even if no
|
||||||
* character is encountered.
|
* 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
|
size_t
|
||||||
sc_str_truncate(char *data, size_t len, const char *endchars);
|
sc_str_truncate(char *data, size_t len, const char *endchars);
|
||||||
|
|||||||
+1
-1
@@ -19,5 +19,5 @@ endian = 'little'
|
|||||||
ffmpeg_avcodec = 'avcodec-58'
|
ffmpeg_avcodec = 'avcodec-58'
|
||||||
ffmpeg_avformat = 'avformat-58'
|
ffmpeg_avformat = 'avformat-58'
|
||||||
ffmpeg_avutil = 'avutil-56'
|
ffmpeg_avutil = 'avutil-56'
|
||||||
prebuilt_ffmpeg = 'ffmpeg-4.3.1-win32-shared'
|
prebuilt_ffmpeg = 'ffmpeg-win32-4.3.1'
|
||||||
prebuilt_sdl2 = 'SDL2-2.0.20/i686-w64-mingw32'
|
prebuilt_sdl2 = 'SDL2-2.0.20/i686-w64-mingw32'
|
||||||
|
|||||||
+1
-1
@@ -19,5 +19,5 @@ endian = 'little'
|
|||||||
ffmpeg_avcodec = 'avcodec-59'
|
ffmpeg_avcodec = 'avcodec-59'
|
||||||
ffmpeg_avformat = 'avformat-59'
|
ffmpeg_avformat = 'avformat-59'
|
||||||
ffmpeg_avutil = 'avutil-57'
|
ffmpeg_avutil = 'avutil-57'
|
||||||
prebuilt_ffmpeg = 'ffmpeg-5.0-full_build-shared'
|
prebuilt_ffmpeg = 'ffmpeg-win64-5.0'
|
||||||
prebuilt_sdl2 = 'SDL2-2.0.20/x86_64-w64-mingw32'
|
prebuilt_sdl2 = 'SDL2-2.0.20/x86_64-w64-mingw32'
|
||||||
|
|||||||
+2
-2
@@ -2,8 +2,8 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
BUILDDIR=build-auto
|
BUILDDIR=build-auto
|
||||||
PREBUILT_SERVER_URL=https://github.com/Genymobile/scrcpy/releases/download/v1.21/scrcpy-server-v1.21
|
PREBUILT_SERVER_URL=https://github.com/Genymobile/scrcpy/releases/download/v1.22/scrcpy-server-v1.22
|
||||||
PREBUILT_SERVER_SHA256=dbcccab523ee26796e55ea33652649e4b7af498edae9aa75e4d4d7869c0ab848
|
PREBUILT_SERVER_SHA256=c05d273eec7533c0e106282e0254cf04e7f5e8f0c2920ca39448865fab2a419b
|
||||||
|
|
||||||
echo "[scrcpy] Downloading prebuilt server..."
|
echo "[scrcpy] Downloading prebuilt server..."
|
||||||
wget "$PREBUILT_SERVER_URL" -O scrcpy-server
|
wget "$PREBUILT_SERVER_URL" -O scrcpy-server
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
project('scrcpy', 'c',
|
project('scrcpy', 'c',
|
||||||
version: '1.21',
|
version: '1.22',
|
||||||
meson_version: '>= 0.48',
|
meson_version: '>= 0.48',
|
||||||
default_options: [
|
default_options: [
|
||||||
'c_std=c11',
|
'c_std=c11',
|
||||||
|
|||||||
@@ -1,4 +1 @@
|
|||||||
*
|
/data
|
||||||
!/.gitignore
|
|
||||||
!/Makefile
|
|
||||||
!/prepare-dep
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
.PHONY: prepare-win32 prepare-win64 \
|
|
||||||
prepare-ffmpeg-win32 \
|
|
||||||
prepare-ffmpeg-win64 \
|
|
||||||
prepare-sdl2 \
|
|
||||||
prepare-adb
|
|
||||||
|
|
||||||
prepare-win32: prepare-sdl2 prepare-ffmpeg-win32 prepare-adb
|
|
||||||
prepare-win64: prepare-sdl2 prepare-ffmpeg-win64 prepare-adb
|
|
||||||
|
|
||||||
# Use old FFmpeg version for win32, there are no new prebuilts
|
|
||||||
prepare-ffmpeg-win32:
|
|
||||||
@./prepare-dep https://github.com/Genymobile/scrcpy/releases/download/v1.16/ffmpeg-4.3.1-win32-shared.zip \
|
|
||||||
357af9901a456f4dcbacd107e83a934d344c9cb07ddad8aaf80612eeab7d26d2 \
|
|
||||||
ffmpeg-4.3.1-win32-shared
|
|
||||||
@./prepare-dep https://github.com/Genymobile/scrcpy/releases/download/v1.16/ffmpeg-4.3.1-win32-dev.zip \
|
|
||||||
230efb08e9bcf225bd474da29676c70e591fc94d8790a740ca801408fddcb78b \
|
|
||||||
ffmpeg-4.3.1-win32-dev
|
|
||||||
ln -sf ../ffmpeg-4.3.1-win32-dev/include ffmpeg-4.3.1-win32-shared/
|
|
||||||
|
|
||||||
prepare-ffmpeg-win64:
|
|
||||||
@./prepare-dep https://github.com/GyanD/codexffmpeg/releases/download/5.0/ffmpeg-5.0-full_build-shared.7z \
|
|
||||||
e5900f6cecd4c438d398bd2fc308736c10b857cd8dd61c11bcfb05bff5d1211a \
|
|
||||||
ffmpeg-5.0-full_build-shared
|
|
||||||
|
|
||||||
prepare-sdl2:
|
|
||||||
@./prepare-dep https://libsdl.org/release/SDL2-devel-2.0.20-mingw.tar.gz \
|
|
||||||
38094d82a857d6c62352e5c5cdec74948c5b4d25c59cbd298d6d233568976bd1 \
|
|
||||||
SDL2-2.0.20
|
|
||||||
|
|
||||||
prepare-adb:
|
|
||||||
@./prepare-dep https://dl.google.com/android/repository/platform-tools_r32.0.0-windows.zip \
|
|
||||||
41f4c7512b32cbb3f8c624c20b56326abb692a6f169b03b4b63b6c5a6fdbb08c \
|
|
||||||
platform-tools
|
|
||||||
Executable
+22
@@ -0,0 +1,22 @@
|
|||||||
|
PREBUILT_DATA_DIR=data
|
||||||
|
|
||||||
|
checksum() {
|
||||||
|
local file="$1"
|
||||||
|
local sum="$2"
|
||||||
|
echo "$file: verifying checksum..."
|
||||||
|
echo "$sum $file" | sha256sum -c
|
||||||
|
}
|
||||||
|
|
||||||
|
get_file() {
|
||||||
|
local url="$1"
|
||||||
|
local file="$2"
|
||||||
|
local sum="$3"
|
||||||
|
if [[ -f "$file" ]]
|
||||||
|
then
|
||||||
|
echo "$file: found"
|
||||||
|
else
|
||||||
|
echo "$file: not found, downloading..."
|
||||||
|
wget "$url" -O "$file"
|
||||||
|
fi
|
||||||
|
checksum "$file" "$sum"
|
||||||
|
}
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname ${BASH_SOURCE[0]})
|
||||||
|
cd "$DIR"
|
||||||
|
. common
|
||||||
|
mkdir -p "$PREBUILT_DATA_DIR"
|
||||||
|
cd "$PREBUILT_DATA_DIR"
|
||||||
|
|
||||||
|
DEP_DIR=platform-tools-31.0.3
|
||||||
|
|
||||||
|
FILENAME=platform-tools_r31.0.3-windows.zip
|
||||||
|
SHA256SUM=0f4b8fdd26af2c3733539d6eebb3c2ed499ea1d4bb1f4e0ecc2d6016961a6e24
|
||||||
|
|
||||||
|
if [[ -d "$DEP_DIR" ]]
|
||||||
|
then
|
||||||
|
echo "$DEP_DIR" found
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
get_file "https://dl.google.com/android/repository/$FILENAME" \
|
||||||
|
"$FILENAME" "$SHA256SUM"
|
||||||
|
|
||||||
|
mkdir "$DEP_DIR"
|
||||||
|
cd "$DEP_DIR"
|
||||||
|
|
||||||
|
ZIP_PREFIX=platform-tools
|
||||||
|
unzip "../$FILENAME" \
|
||||||
|
"$ZIP_PREFIX"/AdbWinApi.dll \
|
||||||
|
"$ZIP_PREFIX"/AdbWinUsbApi.dll \
|
||||||
|
"$ZIP_PREFIX"/adb.exe
|
||||||
|
mv "$ZIP_PREFIX"/* .
|
||||||
|
rmdir "$ZIP_PREFIX"
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
url="$1"
|
|
||||||
sum="$2"
|
|
||||||
dir="$3"
|
|
||||||
|
|
||||||
checksum() {
|
|
||||||
local file="$1"
|
|
||||||
local sum="$2"
|
|
||||||
echo "$file: verifying checksum..."
|
|
||||||
echo "$sum $file" | sha256sum -c
|
|
||||||
}
|
|
||||||
|
|
||||||
get_file() {
|
|
||||||
local url="$1"
|
|
||||||
local file="$2"
|
|
||||||
local sum="$3"
|
|
||||||
if [[ -f "$file" ]]
|
|
||||||
then
|
|
||||||
echo "$file: found"
|
|
||||||
else
|
|
||||||
echo "$file: not found, downloading..."
|
|
||||||
wget "$url" -O "$file"
|
|
||||||
fi
|
|
||||||
checksum "$file" "$sum"
|
|
||||||
}
|
|
||||||
|
|
||||||
extract() {
|
|
||||||
local file="$1"
|
|
||||||
echo "Extracting $file..."
|
|
||||||
if [[ "$file" == *.zip ]]
|
|
||||||
then
|
|
||||||
unzip -q "$file"
|
|
||||||
elif [[ "$file" == *.tar.gz ]]
|
|
||||||
then
|
|
||||||
tar xf "$file"
|
|
||||||
elif [[ "$file" == *.7z ]]
|
|
||||||
then
|
|
||||||
7z x "$file"
|
|
||||||
else
|
|
||||||
echo "Unsupported file: $file"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get_dep() {
|
|
||||||
local url="$1"
|
|
||||||
local sum="$2"
|
|
||||||
local dir="$3"
|
|
||||||
local file="${url##*/}"
|
|
||||||
if [[ -d "$dir" ]]
|
|
||||||
then
|
|
||||||
echo "$dir: found"
|
|
||||||
else
|
|
||||||
echo "$dir: not found"
|
|
||||||
get_file "$url" "$file" "$sum"
|
|
||||||
extract "$file"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get_dep "$url" "$sum" "$dir"
|
|
||||||
Executable
+45
@@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname ${BASH_SOURCE[0]})
|
||||||
|
cd "$DIR"
|
||||||
|
. common
|
||||||
|
mkdir -p "$PREBUILT_DATA_DIR"
|
||||||
|
cd "$PREBUILT_DATA_DIR"
|
||||||
|
|
||||||
|
DEP_DIR=ffmpeg-win32-4.3.1
|
||||||
|
|
||||||
|
FILENAME_SHARED=ffmpeg-4.3.1-win32-shared.zip
|
||||||
|
SHA256SUM_SHARED=357af9901a456f4dcbacd107e83a934d344c9cb07ddad8aaf80612eeab7d26d2
|
||||||
|
|
||||||
|
FILENAME_DEV=ffmpeg-4.3.1-win32-dev.zip
|
||||||
|
SHA256SUM_DEV=230efb08e9bcf225bd474da29676c70e591fc94d8790a740ca801408fddcb78b
|
||||||
|
|
||||||
|
if [[ -d "$DEP_DIR" ]]
|
||||||
|
then
|
||||||
|
echo "$DEP_DIR" found
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
get_file "https://github.com/Genymobile/scrcpy/releases/download/v1.16/$FILENAME_SHARED" \
|
||||||
|
"$FILENAME_SHARED" "$SHA256SUM_SHARED"
|
||||||
|
get_file "https://github.com/Genymobile/scrcpy/releases/download/v1.16/$FILENAME_DEV" \
|
||||||
|
"$FILENAME_DEV" "$SHA256SUM_DEV"
|
||||||
|
|
||||||
|
mkdir "$DEP_DIR"
|
||||||
|
cd "$DEP_DIR"
|
||||||
|
|
||||||
|
ZIP_PREFIX_SHARED=ffmpeg-4.3.1-win32-shared
|
||||||
|
unzip "../$FILENAME_SHARED" \
|
||||||
|
"$ZIP_PREFIX_SHARED"/bin/avutil-56.dll \
|
||||||
|
"$ZIP_PREFIX_SHARED"/bin/avcodec-58.dll \
|
||||||
|
"$ZIP_PREFIX_SHARED"/bin/avformat-58.dll \
|
||||||
|
"$ZIP_PREFIX_SHARED"/bin/swresample-3.dll \
|
||||||
|
"$ZIP_PREFIX_SHARED"/bin/swscale-5.dll
|
||||||
|
|
||||||
|
ZIP_PREFIX_DEV=ffmpeg-4.3.1-win32-dev
|
||||||
|
unzip "../$FILENAME_DEV" \
|
||||||
|
"$ZIP_PREFIX_DEV/include/*"
|
||||||
|
|
||||||
|
mv "$ZIP_PREFIX_SHARED"/* .
|
||||||
|
mv "$ZIP_PREFIX_DEV"/* .
|
||||||
|
rmdir "$ZIP_PREFIX_SHARED" "$ZIP_PREFIX_DEV"
|
||||||
Executable
+35
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname ${BASH_SOURCE[0]})
|
||||||
|
cd "$DIR"
|
||||||
|
. common
|
||||||
|
mkdir -p "$PREBUILT_DATA_DIR"
|
||||||
|
cd "$PREBUILT_DATA_DIR"
|
||||||
|
|
||||||
|
DEP_DIR=ffmpeg-win64-5.0
|
||||||
|
|
||||||
|
FILENAME=ffmpeg-5.0-full_build-shared.7z
|
||||||
|
SHA256SUM=e5900f6cecd4c438d398bd2fc308736c10b857cd8dd61c11bcfb05bff5d1211a
|
||||||
|
|
||||||
|
if [[ -d "$DEP_DIR" ]]
|
||||||
|
then
|
||||||
|
echo "$DEP_DIR" found
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
get_file "https://github.com/GyanD/codexffmpeg/releases/download/5.0/$FILENAME" \
|
||||||
|
"$FILENAME" "$SHA256SUM"
|
||||||
|
|
||||||
|
mkdir "$DEP_DIR"
|
||||||
|
cd "$DEP_DIR"
|
||||||
|
|
||||||
|
ZIP_PREFIX=ffmpeg-5.0-full_build-shared
|
||||||
|
7z x "../$FILENAME" \
|
||||||
|
"$ZIP_PREFIX"/bin/avutil-57.dll \
|
||||||
|
"$ZIP_PREFIX"/bin/avcodec-59.dll \
|
||||||
|
"$ZIP_PREFIX"/bin/avformat-59.dll \
|
||||||
|
"$ZIP_PREFIX"/bin/swresample-4.dll \
|
||||||
|
"$ZIP_PREFIX"/bin/swscale-6.dll \
|
||||||
|
"$ZIP_PREFIX"/include
|
||||||
|
mv "$ZIP_PREFIX"/* .
|
||||||
|
rmdir "$ZIP_PREFIX"
|
||||||
Executable
+32
@@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
DIR=$(dirname ${BASH_SOURCE[0]})
|
||||||
|
cd "$DIR"
|
||||||
|
. common
|
||||||
|
mkdir -p "$PREBUILT_DATA_DIR"
|
||||||
|
cd "$PREBUILT_DATA_DIR"
|
||||||
|
|
||||||
|
DEP_DIR=SDL2-2.0.20
|
||||||
|
|
||||||
|
FILENAME=SDL2-devel-2.0.20-mingw.tar.gz
|
||||||
|
SHA256SUM=38094d82a857d6c62352e5c5cdec74948c5b4d25c59cbd298d6d233568976bd1
|
||||||
|
|
||||||
|
if [[ -d "$DEP_DIR" ]]
|
||||||
|
then
|
||||||
|
echo "$DEP_DIR" found
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
get_file "https://libsdl.org/release/$FILENAME" "$FILENAME" "$SHA256SUM"
|
||||||
|
|
||||||
|
mkdir "$DEP_DIR"
|
||||||
|
cd "$DEP_DIR"
|
||||||
|
|
||||||
|
TAR_PREFIX="$DEP_DIR" # root directory inside the tar has the same name
|
||||||
|
tar xf "../$FILENAME" --strip-components=1 \
|
||||||
|
"$TAR_PREFIX"/i686-w64-mingw32/bin/SDL2.dll \
|
||||||
|
"$TAR_PREFIX"/i686-w64-mingw32/include/ \
|
||||||
|
"$TAR_PREFIX"/i686-w64-mingw32/lib/ \
|
||||||
|
"$TAR_PREFIX"/x86_64-w64-mingw32/bin/SDL2.dll \
|
||||||
|
"$TAR_PREFIX"/x86_64-w64-mingw32/include/ \
|
||||||
|
"$TAR_PREFIX"/x86_64-w64-mingw32/lib/ \
|
||||||
+24
-20
@@ -63,7 +63,9 @@ build-server:
|
|||||||
ninja -C "$(SERVER_BUILD_DIR)"
|
ninja -C "$(SERVER_BUILD_DIR)"
|
||||||
|
|
||||||
prepare-deps-win32:
|
prepare-deps-win32:
|
||||||
-$(MAKE) -C prebuilt-deps prepare-win32
|
@prebuilt-deps/prepare-adb.sh
|
||||||
|
@prebuilt-deps/prepare-sdl.sh
|
||||||
|
@prebuilt-deps/prepare-ffmpeg-win32.sh
|
||||||
|
|
||||||
build-win32: prepare-deps-win32
|
build-win32: prepare-deps-win32
|
||||||
[ -d "$(WIN32_BUILD_DIR)" ] || ( mkdir "$(WIN32_BUILD_DIR)" && \
|
[ -d "$(WIN32_BUILD_DIR)" ] || ( mkdir "$(WIN32_BUILD_DIR)" && \
|
||||||
@@ -75,7 +77,9 @@ build-win32: prepare-deps-win32
|
|||||||
ninja -C "$(WIN32_BUILD_DIR)"
|
ninja -C "$(WIN32_BUILD_DIR)"
|
||||||
|
|
||||||
prepare-deps-win64:
|
prepare-deps-win64:
|
||||||
-$(MAKE) -C prebuilt-deps prepare-win64
|
@prebuilt-deps/prepare-adb.sh
|
||||||
|
@prebuilt-deps/prepare-sdl.sh
|
||||||
|
@prebuilt-deps/prepare-ffmpeg-win64.sh
|
||||||
|
|
||||||
build-win64: prepare-deps-win64
|
build-win64: prepare-deps-win64
|
||||||
[ -d "$(WIN64_BUILD_DIR)" ] || ( mkdir "$(WIN64_BUILD_DIR)" && \
|
[ -d "$(WIN64_BUILD_DIR)" ] || ( mkdir "$(WIN64_BUILD_DIR)" && \
|
||||||
@@ -94,15 +98,15 @@ dist-win32: build-server build-win32
|
|||||||
cp data/scrcpy-noconsole.vbs "$(DIST)/$(WIN32_TARGET_DIR)"
|
cp data/scrcpy-noconsole.vbs "$(DIST)/$(WIN32_TARGET_DIR)"
|
||||||
cp data/icon.png "$(DIST)/$(WIN32_TARGET_DIR)"
|
cp data/icon.png "$(DIST)/$(WIN32_TARGET_DIR)"
|
||||||
cp data/open_a_terminal_here.bat "$(DIST)/$(WIN32_TARGET_DIR)"
|
cp data/open_a_terminal_here.bat "$(DIST)/$(WIN32_TARGET_DIR)"
|
||||||
cp prebuilt-deps/ffmpeg-4.3.1-win32-shared/bin/avutil-56.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/avutil-56.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/ffmpeg-4.3.1-win32-shared/bin/avcodec-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/avcodec-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/ffmpeg-4.3.1-win32-shared/bin/avformat-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/avformat-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/ffmpeg-4.3.1-win32-shared/bin/swresample-3.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/swresample-3.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/ffmpeg-4.3.1-win32-shared/bin/swscale-5.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/swscale-5.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/platform-tools/adb.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp prebuilt-deps/data/platform-tools-31.0.3/adb.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/platform-tools/AdbWinApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp prebuilt-deps/data/platform-tools-31.0.3/AdbWinApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/platform-tools/AdbWinUsbApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp prebuilt-deps/data/platform-tools-31.0.3/AdbWinUsbApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/SDL2-2.0.20/i686-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp prebuilt-deps/data/SDL2-2.0.20/i686-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
|
|
||||||
dist-win64: build-server build-win64
|
dist-win64: build-server build-win64
|
||||||
mkdir -p "$(DIST)/$(WIN64_TARGET_DIR)"
|
mkdir -p "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||||
@@ -112,15 +116,15 @@ dist-win64: build-server build-win64
|
|||||||
cp data/scrcpy-noconsole.vbs "$(DIST)/$(WIN64_TARGET_DIR)"
|
cp data/scrcpy-noconsole.vbs "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||||
cp data/icon.png "$(DIST)/$(WIN64_TARGET_DIR)"
|
cp data/icon.png "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||||
cp data/open_a_terminal_here.bat "$(DIST)/$(WIN64_TARGET_DIR)"
|
cp data/open_a_terminal_here.bat "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||||
cp prebuilt-deps/ffmpeg-5.0-full_build-shared/bin/avutil-57.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp prebuilt-deps/data/ffmpeg-win64-5.0/bin/avutil-57.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/ffmpeg-5.0-full_build-shared/bin/avcodec-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp prebuilt-deps/data/ffmpeg-win64-5.0/bin/avcodec-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/ffmpeg-5.0-full_build-shared/bin/avformat-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp prebuilt-deps/data/ffmpeg-win64-5.0/bin/avformat-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/ffmpeg-5.0-full_build-shared/bin/swresample-4.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp prebuilt-deps/data/ffmpeg-win64-5.0/bin/swresample-4.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/ffmpeg-5.0-full_build-shared/bin/swscale-6.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp prebuilt-deps/data/ffmpeg-win64-5.0/bin/swscale-6.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/platform-tools/adb.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp prebuilt-deps/data/platform-tools-31.0.3/adb.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/platform-tools/AdbWinApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp prebuilt-deps/data/platform-tools-31.0.3/AdbWinApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/platform-tools/AdbWinUsbApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp prebuilt-deps/data/platform-tools-31.0.3/AdbWinUsbApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp prebuilt-deps/SDL2-2.0.20/x86_64-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp prebuilt-deps/data/SDL2-2.0.20/x86_64-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
|
|
||||||
zip-win32: dist-win32
|
zip-win32: dist-win32
|
||||||
cd "$(DIST)/$(WIN32_TARGET_DIR)"; \
|
cd "$(DIST)/$(WIN32_TARGET_DIR)"; \
|
||||||
|
|||||||
+2
-2
@@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "com.genymobile.scrcpy"
|
applicationId "com.genymobile.scrcpy"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 31
|
targetSdkVersion 31
|
||||||
versionCode 12100
|
versionCode 12200
|
||||||
versionName "1.21"
|
versionName "1.22"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
SCRCPY_DEBUG=false
|
SCRCPY_DEBUG=false
|
||||||
SCRCPY_VERSION_NAME=1.21
|
SCRCPY_VERSION_NAME=1.22
|
||||||
|
|
||||||
PLATFORM=${ANDROID_PLATFORM:-31}
|
PLATFORM=${ANDROID_PLATFORM:-31}
|
||||||
BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-31.0.0}
|
BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-31.0.0}
|
||||||
|
|||||||
@@ -89,13 +89,15 @@ public class ScreenEncoder implements Device.RotationListener {
|
|||||||
Rect unlockedVideoRect = screenInfo.getUnlockedVideoSize().toRect();
|
Rect unlockedVideoRect = screenInfo.getUnlockedVideoSize().toRect();
|
||||||
int videoRotation = screenInfo.getVideoRotation();
|
int videoRotation = screenInfo.getVideoRotation();
|
||||||
int layerStack = device.getLayerStack();
|
int layerStack = device.getLayerStack();
|
||||||
|
|
||||||
setSize(format, videoRect.width(), videoRect.height());
|
setSize(format, videoRect.width(), videoRect.height());
|
||||||
configure(codec, format);
|
|
||||||
Surface surface = codec.createInputSurface();
|
Surface surface = null;
|
||||||
setDisplaySurface(display, surface, videoRotation, contentRect, unlockedVideoRect, layerStack);
|
|
||||||
codec.start();
|
|
||||||
try {
|
try {
|
||||||
|
configure(codec, format);
|
||||||
|
surface = codec.createInputSurface();
|
||||||
|
setDisplaySurface(display, surface, videoRotation, contentRect, unlockedVideoRect, layerStack);
|
||||||
|
codec.start();
|
||||||
|
|
||||||
alive = encode(codec, fd);
|
alive = encode(codec, fd);
|
||||||
// do not call stop() on exception, it would trigger an IllegalStateException
|
// do not call stop() on exception, it would trigger an IllegalStateException
|
||||||
codec.stop();
|
codec.stop();
|
||||||
@@ -119,7 +121,9 @@ public class ScreenEncoder implements Device.RotationListener {
|
|||||||
} finally {
|
} finally {
|
||||||
destroyDisplay(display);
|
destroyDisplay(display);
|
||||||
codec.release();
|
codec.release();
|
||||||
surface.release();
|
if (surface != null) {
|
||||||
|
surface.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (alive);
|
} while (alive);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user