Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f7797a49b |
21
BUILD.md
21
BUILD.md
@@ -46,7 +46,7 @@ sudo ninja -Cbuild-auto uninstall
|
|||||||
### `master`
|
### `master`
|
||||||
|
|
||||||
The `master` branch concerns the latest release, and is the home page of the
|
The `master` branch concerns the latest release, and is the home page of the
|
||||||
project on GitHub.
|
project on Github.
|
||||||
|
|
||||||
|
|
||||||
### `dev`
|
### `dev`
|
||||||
@@ -272,10 +272,10 @@ install` must be run as root)._
|
|||||||
|
|
||||||
#### Option 2: Use prebuilt server
|
#### Option 2: Use prebuilt server
|
||||||
|
|
||||||
- [`scrcpy-server-v1.24`][direct-scrcpy-server]
|
- [`scrcpy-server-v1.23`][direct-scrcpy-server]
|
||||||
<sub>SHA-256: `ae74a81ea79c0dc7250e586627c278c0a9a8c5de46c9fb5c38c167fb1a36f056`</sub>
|
_(SHA-256: 2a913fd47478c0b306fca507cb0beb625e49a19ff9fc7ab904e36ef5b9fe7e68)_
|
||||||
|
|
||||||
[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.24/scrcpy-server-v1.24
|
[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.23/scrcpy-server-v1.23
|
||||||
|
|
||||||
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:
|
||||||
@@ -305,16 +305,13 @@ After a successful build, you can install _scrcpy_ on the system:
|
|||||||
sudo ninja -Cx install # without sudo on Windows
|
sudo ninja -Cx install # without sudo on Windows
|
||||||
```
|
```
|
||||||
|
|
||||||
This installs several files:
|
This installs three files:
|
||||||
|
|
||||||
- `/usr/local/bin/scrcpy` (main app)
|
- `/usr/local/bin/scrcpy`
|
||||||
- `/usr/local/share/scrcpy/scrcpy-server` (server to push to the device)
|
- `/usr/local/share/scrcpy/scrcpy-server`
|
||||||
- `/usr/local/share/man/man1/scrcpy.1` (manpage)
|
- `/usr/local/share/man/man1/scrcpy.1`
|
||||||
- `/usr/local/share/icons/hicolor/256x256/apps/icon.png` (app icon)
|
|
||||||
- `/usr/local/share/zsh/site-functions/_scrcpy` (zsh completion)
|
|
||||||
- `/usr/local/share/bash-completion/completions/scrcpy` (bash completion)
|
|
||||||
|
|
||||||
You can then [run](README.md#run) `scrcpy`.
|
You can then [run](README.md#run) _scrcpy_.
|
||||||
|
|
||||||
### Uninstall
|
### Uninstall
|
||||||
|
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ Dies finden automatisch das Gerät und aktiviert den TCP/IP-Modus. Anschließend
|
|||||||
|
|
||||||
Alternativ kann die TCP/IP-Verbindung auch manuell per `adb` aktiviert werden:
|
Alternativ kann die TCP/IP-Verbindung auch manuell per `adb` aktiviert werden:
|
||||||
|
|
||||||
1. Gerät mit demselben Wi-Fi wie den Computer verbinden.
|
1. Gerät mit demselben Wifi wie den Computer verbinden.
|
||||||
2. IP-Adresse des Gerätes herausfinden, entweder über Einstellungen → Über das Telefon → Status, oder indem dieser Befehl ausgeführt wird:
|
2. IP-Adresse des Gerätes herausfinden, entweder über Einstellungen → Über das Telefon → Status, oder indem dieser Befehl ausgeführt wird:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ variation] does not impact the recorded file.
|
|||||||
|
|
||||||
#### Wireless
|
#### Wireless
|
||||||
|
|
||||||
_Scrcpy_ menggunakan `adb` untuk berkomunikasi dengan perangkat, dan `adb` dapat [terhubung] ke perangkat melalui TCP / IP:
|
_Scrcpy_ menggunakan `adb` untuk berkomunikasi dengan perangkat, dan` adb` dapat [terhubung] ke perangkat melalui TCP / IP:
|
||||||
|
|
||||||
1. Hubungkan perangkat ke Wi-Fi yang sama dengan komputer Anda.
|
1. Hubungkan perangkat ke Wi-Fi yang sama dengan komputer Anda.
|
||||||
2. Dapatkan alamat IP perangkat Anda (dalam Pengaturan → Tentang ponsel → Status).
|
2. Dapatkan alamat IP perangkat Anda (dalam Pengaturan → Tentang ponsel → Status).
|
||||||
@@ -281,7 +281,7 @@ Dari terminal lain:
|
|||||||
scrcpy
|
scrcpy
|
||||||
```
|
```
|
||||||
|
|
||||||
Untuk menghindari mengaktifkan penerusan port jarak jauh, Anda dapat memaksa sambungan maju sebagai gantinya (perhatikan `-L`, bukan `-R`):
|
Untuk menghindari mengaktifkan penerusan port jarak jauh, Anda dapat memaksa sambungan maju sebagai gantinya (perhatikan `-L`, bukan` -R`):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
adb kill-server # matikan server adb lokal di 5037
|
adb kill-server # matikan server adb lokal di 5037
|
||||||
@@ -579,7 +579,7 @@ Lihat juga [Masalah #14].
|
|||||||
|
|
||||||
Dalam daftar berikut, <kbd>MOD</kbd> adalah pengubah pintasan. Secara default, ini (kiri) <kbd>Alt</kbd> atau (kiri) <kbd>Super</kbd>.
|
Dalam daftar berikut, <kbd>MOD</kbd> adalah pengubah pintasan. Secara default, ini (kiri) <kbd>Alt</kbd> atau (kiri) <kbd>Super</kbd>.
|
||||||
|
|
||||||
Ini dapat diubah menggunakan `--shortcut-mod`. Kunci yang memungkinkan adalah `lctrl`, `rctrl`, `lalt`, `ralt`, `lsuper` dan `rsuper`. Sebagai contoh:
|
Ini dapat diubah menggunakan `--shortcut-mod`. Kunci yang memungkinkan adalah `lctrl`,`rctrl`, `lalt`,` ralt`, `lsuper` dan` rsuper`. Sebagai contoh:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# gunakan RCtrl untuk jalan pintas
|
# gunakan RCtrl untuk jalan pintas
|
||||||
|
|||||||
173
README.md
173
README.md
@@ -1,4 +1,4 @@
|
|||||||
# scrcpy (v1.24)
|
# scrcpy (v1.23)
|
||||||
|
|
||||||
<img src="app/data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
<img src="app/data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ _pronounced "**scr**een **c**o**py**"_
|
|||||||
[Read in another language](#translations)
|
[Read in another language](#translations)
|
||||||
|
|
||||||
This application provides display and control of Android devices connected via
|
This application provides display and control of Android devices connected via
|
||||||
USB or [over TCP/IP](#tcpip-wireless). It does not require any _root_ access.
|
USB (or [over TCP/IP](#tcpip-wireless)). It does not require any _root_ access.
|
||||||
It works on _GNU/Linux_, _Windows_ and _macOS_.
|
It works on _GNU/Linux_, _Windows_ and _macOS_.
|
||||||
|
|
||||||

|

|
||||||
@@ -19,7 +19,7 @@ It focuses on:
|
|||||||
- **quality**: 1920×1080 or above
|
- **quality**: 1920×1080 or above
|
||||||
- **low latency**: [35~70ms][lowlatency]
|
- **low latency**: [35~70ms][lowlatency]
|
||||||
- **low startup time**: ~1 second to display the first image
|
- **low startup time**: ~1 second to display the first image
|
||||||
- **non-intrusiveness**: nothing is left installed on the Android device
|
- **non-intrusiveness**: nothing is left installed on the device
|
||||||
- **user benefits**: no account, no ads, no internet required
|
- **user benefits**: no account, no ads, no internet required
|
||||||
- **freedom**: free and open source software
|
- **freedom**: free and open source software
|
||||||
|
|
||||||
@@ -27,10 +27,10 @@ It focuses on:
|
|||||||
|
|
||||||
Its features include:
|
Its features include:
|
||||||
- [recording](#recording)
|
- [recording](#recording)
|
||||||
- mirroring with [Android device screen off](#turn-screen-off)
|
- mirroring with [device screen off](#turn-screen-off)
|
||||||
- [copy-paste](#copy-paste) in both directions
|
- [copy-paste](#copy-paste) in both directions
|
||||||
- [configurable quality](#capture-configuration)
|
- [configurable quality](#capture-configuration)
|
||||||
- Android device [as a webcam (V4L2)](#v4l2loopback) (Linux-only)
|
- device screen [as a webcam (V4L2)](#v4l2loopback) (Linux-only)
|
||||||
- [physical keyboard simulation (HID)](#physical-keyboard-simulation-hid)
|
- [physical keyboard simulation (HID)](#physical-keyboard-simulation-hid)
|
||||||
- [physical mouse simulation (HID)](#physical-mouse-simulation-hid)
|
- [physical mouse simulation (HID)](#physical-mouse-simulation-hid)
|
||||||
- [OTG mode](#otg)
|
- [OTG mode](#otg)
|
||||||
@@ -40,12 +40,12 @@ Its features include:
|
|||||||
|
|
||||||
The Android device requires at least API 21 (Android 5.0).
|
The Android device requires at least API 21 (Android 5.0).
|
||||||
|
|
||||||
Make sure you [enable adb debugging][enable-adb] on your device(s).
|
Make sure you [enabled adb debugging][enable-adb] on your device(s).
|
||||||
|
|
||||||
[enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling
|
[enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling
|
||||||
|
|
||||||
On some devices, you also need to enable [an additional option][control] to
|
On some devices, you also need to enable [an additional option][control] to
|
||||||
control it using a keyboard and mouse.
|
control it using keyboard and mouse.
|
||||||
|
|
||||||
[control]: https://github.com/Genymobile/scrcpy/issues/70#issuecomment-373286323
|
[control]: https://github.com/Genymobile/scrcpy/issues/70#issuecomment-373286323
|
||||||
|
|
||||||
@@ -97,19 +97,19 @@ For Gentoo, an [Ebuild] is available: [`scrcpy/`][ebuild-link].
|
|||||||
[Ebuild]: https://wiki.gentoo.org/wiki/Ebuild
|
[Ebuild]: https://wiki.gentoo.org/wiki/Ebuild
|
||||||
[ebuild-link]: https://github.com/maggu2810/maggu2810-overlay/tree/master/app-mobilephone/scrcpy
|
[ebuild-link]: https://github.com/maggu2810/maggu2810-overlay/tree/master/app-mobilephone/scrcpy
|
||||||
|
|
||||||
You can also [build the app manually][BUILD] ([simplified
|
You could also [build the app manually][BUILD] ([simplified
|
||||||
process][BUILD_simple]).
|
process][BUILD_simple]).
|
||||||
|
|
||||||
|
|
||||||
### Windows
|
### Windows
|
||||||
|
|
||||||
For Windows, a prebuilt archive with all the dependencies (including `adb`) is
|
For Windows, for simplicity, a prebuilt archive with all the dependencies
|
||||||
available:
|
(including `adb`) is available:
|
||||||
|
|
||||||
- [`scrcpy-win64-v1.24.zip`][direct-win64]
|
- [`scrcpy-win64-v1.23.zip`][direct-win64]
|
||||||
<sub>SHA-256: `6ccb64cba0a3e75715e85a188daeb4f306a1985f8ce123eba92ba74fc9b27367`</sub>
|
_(SHA-256: d2f601b1d0157faf65153d8a093d827fd65aec5d5842d677ac86fb2b5b7704cc)_
|
||||||
|
|
||||||
[direct-win64]: https://github.com/Genymobile/scrcpy/releases/download/v1.24/scrcpy-win64-v1.24.zip
|
[direct-win64]: https://github.com/Genymobile/scrcpy/releases/download/v1.23/scrcpy-win64-v1.23.zip
|
||||||
|
|
||||||
It is also available in [Chocolatey]:
|
It is also available in [Chocolatey]:
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ You need `adb`, accessible from your `PATH`. If you don't have it yet:
|
|||||||
brew install android-platform-tools
|
brew install android-platform-tools
|
||||||
```
|
```
|
||||||
|
|
||||||
It's also available in [MacPorts], which sets up `adb` for you:
|
It's also available in [MacPorts], which sets up adb for you:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo port install scrcpy
|
sudo port install scrcpy
|
||||||
@@ -162,7 +162,7 @@ You can also [build the app manually][BUILD].
|
|||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
Plug an Android device into your computer, and execute:
|
Plug an Android device, and execute:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy
|
scrcpy
|
||||||
@@ -180,7 +180,7 @@ scrcpy --help
|
|||||||
|
|
||||||
#### Reduce size
|
#### Reduce size
|
||||||
|
|
||||||
Sometimes, it is useful to mirror an Android device at a lower resolution to
|
Sometimes, it is useful to mirror an Android device at a lower definition to
|
||||||
increase performance.
|
increase performance.
|
||||||
|
|
||||||
To limit both the width and height to some value (e.g. 1024):
|
To limit both the width and height to some value (e.g. 1024):
|
||||||
@@ -190,8 +190,8 @@ scrcpy --max-size 1024
|
|||||||
scrcpy -m 1024 # short version
|
scrcpy -m 1024 # short version
|
||||||
```
|
```
|
||||||
|
|
||||||
The other dimension is computed so that the Android device aspect ratio is
|
The other dimension is computed to that the device aspect ratio is preserved.
|
||||||
preserved. That way, a device in 1920×1080 will be mirrored at 1024×576.
|
That way, a device in 1920×1080 will be mirrored at 1024×576.
|
||||||
|
|
||||||
|
|
||||||
#### Change bit-rate
|
#### Change bit-rate
|
||||||
@@ -226,7 +226,7 @@ It may also be enabled or disabled at any time with <kbd>MOD</kbd>+<kbd>i</kbd>.
|
|||||||
|
|
||||||
The device screen may be cropped to mirror only part of the screen.
|
The device screen may be cropped to mirror only part of the screen.
|
||||||
|
|
||||||
This is useful, for example, to mirror only one eye of the Oculus Go:
|
This is useful for example to mirror only one eye of the Oculus Go:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --crop 1224:1440:0:0 # 1224x1440 at offset (0,0)
|
scrcpy --crop 1224:1440:0:0 # 1224x1440 at offset (0,0)
|
||||||
@@ -237,6 +237,7 @@ If `--max-size` is also specified, resizing is applied after cropping.
|
|||||||
|
|
||||||
#### Lock video orientation
|
#### Lock video orientation
|
||||||
|
|
||||||
|
|
||||||
To lock the orientation of the mirroring:
|
To lock the orientation of the mirroring:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -261,7 +262,7 @@ crash. It is possible to select a different encoder:
|
|||||||
scrcpy --encoder OMX.qcom.video.encoder.avc
|
scrcpy --encoder OMX.qcom.video.encoder.avc
|
||||||
```
|
```
|
||||||
|
|
||||||
To list the available encoders, you can pass an invalid encoder name; the
|
To list the available encoders, you could pass an invalid encoder name, the
|
||||||
error will give the available encoders:
|
error will give the available encoders:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -325,7 +326,7 @@ v4l2-ctl --list-devices
|
|||||||
ls /dev/video*
|
ls /dev/video*
|
||||||
```
|
```
|
||||||
|
|
||||||
To start `scrcpy` using a v4l2 sink:
|
To start scrcpy using a v4l2 sink:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --v4l2-sink=/dev/videoN
|
scrcpy --v4l2-sink=/dev/videoN
|
||||||
@@ -333,7 +334,7 @@ scrcpy --v4l2-sink=/dev/videoN --no-display # disable mirroring window
|
|||||||
scrcpy --v4l2-sink=/dev/videoN -N # short version
|
scrcpy --v4l2-sink=/dev/videoN -N # short version
|
||||||
```
|
```
|
||||||
|
|
||||||
(replace `N` with the device ID, check with `ls /dev/video*`)
|
(replace `N` by the device ID, check with `ls /dev/video*`)
|
||||||
|
|
||||||
Once enabled, you can open your video stream with a v4l2-capable tool:
|
Once enabled, you can open your video stream with a v4l2-capable tool:
|
||||||
|
|
||||||
@@ -349,7 +350,7 @@ For example, you could capture the video within [OBS].
|
|||||||
|
|
||||||
#### Buffering
|
#### Buffering
|
||||||
|
|
||||||
It is possible to add buffering. This increases latency, but reduces jitter (see
|
It is possible to add buffering. This increases latency but reduces jitter (see
|
||||||
[#2464]).
|
[#2464]).
|
||||||
|
|
||||||
[#2464]: https://github.com/Genymobile/scrcpy/issues/2464
|
[#2464]: https://github.com/Genymobile/scrcpy/issues/2464
|
||||||
@@ -381,14 +382,14 @@ An option `--tcpip` allows to configure the connection automatically. There are
|
|||||||
two variants.
|
two variants.
|
||||||
|
|
||||||
If the device (accessible at 192.168.1.1 in this example) already listens on a
|
If the device (accessible at 192.168.1.1 in this example) already listens on a
|
||||||
port (typically 5555) for incoming _adb_ connections, then run:
|
port (typically 5555) for incoming adb connections, then run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --tcpip=192.168.1.1 # default port is 5555
|
scrcpy --tcpip=192.168.1.1 # default port is 5555
|
||||||
scrcpy --tcpip=192.168.1.1:5555
|
scrcpy --tcpip=192.168.1.1:5555
|
||||||
```
|
```
|
||||||
|
|
||||||
If _adb_ TCP/IP mode is disabled on the device (or if you don't know the IP
|
If adb TCP/IP mode is disabled on the device (or if you don't know the IP
|
||||||
address), connect the device over USB, then run:
|
address), connect the device over USB, then run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -412,7 +413,7 @@ Alternatively, it is possible to enable the TCP/IP connection manually using
|
|||||||
adb shell ip route | awk '{print $9}'
|
adb shell ip route | awk '{print $9}'
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Enable `adb` over TCP/IP on your device: `adb tcpip 5555`.
|
4. Enable adb over TCP/IP on your device: `adb tcpip 5555`.
|
||||||
5. Unplug your device.
|
5. Unplug your device.
|
||||||
6. Connect to your device: `adb connect DEVICE_IP:5555` _(replace `DEVICE_IP`
|
6. Connect to your device: `adb connect DEVICE_IP:5555` _(replace `DEVICE_IP`
|
||||||
with the device IP address you found)_.
|
with the device IP address you found)_.
|
||||||
@@ -426,9 +427,9 @@ having to physically connect your device directly to your computer.
|
|||||||
If the connection randomly drops, run your `scrcpy` command to reconnect. If it
|
If the connection randomly drops, run your `scrcpy` command to reconnect. If it
|
||||||
says there are no devices/emulators found, try running `adb connect
|
says there are no devices/emulators found, try running `adb connect
|
||||||
DEVICE_IP:5555` again, and then `scrcpy` as usual. If it still says there are
|
DEVICE_IP:5555` again, and then `scrcpy` as usual. If it still says there are
|
||||||
none found, try running `adb disconnect`, and then run those two commands again.
|
none found, try running `adb disconnect` and then run those two commands again.
|
||||||
|
|
||||||
It may be useful to decrease the bit-rate and the resolution:
|
It may be useful to decrease the bit-rate and the definition:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --bit-rate 2M --max-size 800
|
scrcpy --bit-rate 2M --max-size 800
|
||||||
@@ -447,9 +448,6 @@ scrcpy --serial 0123456789abcdef
|
|||||||
scrcpy -s 0123456789abcdef # short version
|
scrcpy -s 0123456789abcdef # short version
|
||||||
```
|
```
|
||||||
|
|
||||||
The serial may also be provided via the environment variable `ANDROID_SERIAL`
|
|
||||||
(also used by `adb`).
|
|
||||||
|
|
||||||
If the device is connected over TCP/IP:
|
If the device is connected over TCP/IP:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -490,7 +488,7 @@ protocol).
|
|||||||
|
|
||||||
##### Remote ADB server
|
##### Remote ADB server
|
||||||
|
|
||||||
To connect to a remote _adb server_, make the server listen on all interfaces:
|
To connect to a remote ADB server, make the server listen on all interfaces:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
adb kill-server
|
adb kill-server
|
||||||
@@ -498,18 +496,17 @@ adb -a nodaemon server start
|
|||||||
# keep this open
|
# keep this open
|
||||||
```
|
```
|
||||||
|
|
||||||
**Warning: all communications between clients and the _adb server_ are
|
**Warning: all communications between clients and ADB server are unencrypted.**
|
||||||
unencrypted.**
|
|
||||||
|
|
||||||
Suppose that this server is accessible at 192.168.1.2. Then, from another
|
Suppose that this server is accessible at 192.168.1.2. Then, from another
|
||||||
terminal, run `scrcpy`:
|
terminal, run scrcpy:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export ADB_SERVER_SOCKET=tcp:192.168.1.2:5037
|
export ADB_SERVER_SOCKET=tcp:192.168.1.2:5037
|
||||||
scrcpy --tunnel-host=192.168.1.2
|
scrcpy --tunnel-host=192.168.1.2
|
||||||
```
|
```
|
||||||
|
|
||||||
By default, `scrcpy` uses the local port used for `adb forward` tunnel
|
By default, scrcpy uses the local port used for `adb forward` tunnel
|
||||||
establishment (typically `27183`, see `--port`). It is also possible to force a
|
establishment (typically `27183`, see `--port`). It is also possible to force a
|
||||||
different tunnel port (it may be useful in more complex situations, when more
|
different tunnel port (it may be useful in more complex situations, when more
|
||||||
redirections are involved):
|
redirections are involved):
|
||||||
@@ -521,16 +518,16 @@ scrcpy --tunnel-port=1234
|
|||||||
|
|
||||||
##### SSH tunnel
|
##### SSH tunnel
|
||||||
|
|
||||||
To communicate with a remote _adb server_ securely, it is preferable to use an
|
To communicate with a remote ADB server securely, it is preferable to use a SSH
|
||||||
SSH tunnel.
|
tunnel.
|
||||||
|
|
||||||
First, make sure the _adb server_ is running on the remote computer:
|
First, make sure the ADB server is running on the remote computer:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
adb start-server
|
adb start-server
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, establish an SSH tunnel:
|
Then, establish a SSH tunnel:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# local 5038 --> remote 5037
|
# local 5038 --> remote 5037
|
||||||
@@ -539,7 +536,7 @@ ssh -CN -L5038:localhost:5037 -R27183:localhost:27183 your_remote_computer
|
|||||||
# keep this open
|
# keep this open
|
||||||
```
|
```
|
||||||
|
|
||||||
From another terminal, run `scrcpy`:
|
From another terminal, run scrcpy:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export ADB_SERVER_SOCKET=tcp:localhost:5038
|
export ADB_SERVER_SOCKET=tcp:localhost:5038
|
||||||
@@ -556,7 +553,7 @@ ssh -CN -L5038:localhost:5037 -L27183:localhost:27183 your_remote_computer
|
|||||||
# keep this open
|
# keep this open
|
||||||
```
|
```
|
||||||
|
|
||||||
From another terminal, run `scrcpy`:
|
From another terminal, run scrcpy:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export ADB_SERVER_SOCKET=tcp:localhost:5038
|
export ADB_SERVER_SOCKET=tcp:localhost:5038
|
||||||
@@ -598,7 +595,7 @@ scrcpy --window-borderless
|
|||||||
|
|
||||||
#### Always on top
|
#### Always on top
|
||||||
|
|
||||||
To keep the _scrcpy_ window always on top:
|
To keep the scrcpy window always on top:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --always-on-top
|
scrcpy --always-on-top
|
||||||
@@ -623,7 +620,7 @@ The window may be rotated:
|
|||||||
scrcpy --rotation 1
|
scrcpy --rotation 1
|
||||||
```
|
```
|
||||||
|
|
||||||
Possible values:
|
Possibles values are:
|
||||||
- `0`: no rotation
|
- `0`: no rotation
|
||||||
- `1`: 90 degrees counterclockwise
|
- `1`: 90 degrees counterclockwise
|
||||||
- `2`: 180 degrees
|
- `2`: 180 degrees
|
||||||
@@ -672,19 +669,19 @@ adb shell dumpsys display # search "mDisplayId=" in the output
|
|||||||
```
|
```
|
||||||
|
|
||||||
The secondary display may only be controlled if the device runs at least Android
|
The secondary display may only be controlled if the device runs at least Android
|
||||||
10 (otherwise it is mirrored as read-only).
|
10 (otherwise it is mirrored in read-only).
|
||||||
|
|
||||||
|
|
||||||
#### Stay awake
|
#### Stay awake
|
||||||
|
|
||||||
To prevent the device from sleeping after a delay when the device is plugged in:
|
To prevent the device to sleep after some delay when the device is plugged in:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --stay-awake
|
scrcpy --stay-awake
|
||||||
scrcpy -w
|
scrcpy -w
|
||||||
```
|
```
|
||||||
|
|
||||||
The initial state is restored when _scrcpy_ is closed.
|
The initial state is restored when scrcpy is closed.
|
||||||
|
|
||||||
|
|
||||||
#### Turn screen off
|
#### Turn screen off
|
||||||
@@ -702,10 +699,9 @@ Or by pressing <kbd>MOD</kbd>+<kbd>o</kbd> at any time.
|
|||||||
To turn it back on, press <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>o</kbd>.
|
To turn it back on, press <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>o</kbd>.
|
||||||
|
|
||||||
On Android, the `POWER` button always turns the screen on. For convenience, if
|
On Android, the `POWER` button always turns the screen on. For convenience, if
|
||||||
`POWER` is sent via _scrcpy_ (via right-click or <kbd>MOD</kbd>+<kbd>p</kbd>),
|
`POWER` is sent via scrcpy (via right-click or <kbd>MOD</kbd>+<kbd>p</kbd>), it
|
||||||
it will force to turn the screen off after a small delay (on a best effort
|
will force to turn the screen off after a small delay (on a best effort basis).
|
||||||
basis). The physical `POWER` button will still cause the screen to be turned
|
The physical `POWER` button will still cause the screen to be turned on.
|
||||||
on.
|
|
||||||
|
|
||||||
It can also be useful to prevent the device from sleeping:
|
It can also be useful to prevent the device from sleeping:
|
||||||
|
|
||||||
@@ -716,22 +712,12 @@ scrcpy -Sw
|
|||||||
|
|
||||||
#### Power off on close
|
#### Power off on close
|
||||||
|
|
||||||
To turn the device screen off when closing _scrcpy_:
|
To turn the device screen off when closing scrcpy:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --power-off-on-close
|
scrcpy --power-off-on-close
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Power on on start
|
|
||||||
|
|
||||||
By default, on start, the device is powered on.
|
|
||||||
|
|
||||||
To prevent this behavior:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
scrcpy --no-power-on
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### Show touches
|
#### Show touches
|
||||||
|
|
||||||
@@ -748,13 +734,12 @@ scrcpy --show-touches
|
|||||||
scrcpy -t
|
scrcpy -t
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that it only shows _physical_ touches (by a finger on the device).
|
Note that it only shows _physical_ touches (with the finger on the device).
|
||||||
|
|
||||||
|
|
||||||
#### Disable screensaver
|
#### Disable screensaver
|
||||||
|
|
||||||
By default, _scrcpy_ does not prevent the screensaver from running on the
|
By default, scrcpy does not prevent the screensaver to run on the computer.
|
||||||
computer.
|
|
||||||
|
|
||||||
To disable it:
|
To disable it:
|
||||||
|
|
||||||
@@ -796,18 +781,18 @@ To copy, cut and paste in such cases (but only supported on Android >= 7):
|
|||||||
- <kbd>MOD</kbd>+<kbd>v</kbd> injects `PASTE` (after computer-to-device
|
- <kbd>MOD</kbd>+<kbd>v</kbd> injects `PASTE` (after computer-to-device
|
||||||
clipboard synchronization)
|
clipboard synchronization)
|
||||||
|
|
||||||
In addition, <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd> injects the computer
|
In addition, <kbd>MOD</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd> allows to inject the
|
||||||
clipboard text as a sequence of key events. This is useful when the component
|
computer clipboard text as a sequence of key events. This is useful when the
|
||||||
does not accept text pasting (for example in _Termux_), but it can break
|
component does not accept text pasting (for example in _Termux_), but it can
|
||||||
non-ASCII content.
|
break non-ASCII content.
|
||||||
|
|
||||||
**WARNING:** Pasting the computer clipboard to the device (either via
|
**WARNING:** Pasting the computer clipboard to the device (either via
|
||||||
<kbd>Ctrl</kbd>+<kbd>v</kbd> or <kbd>MOD</kbd>+<kbd>v</kbd>) copies the content
|
<kbd>Ctrl</kbd>+<kbd>v</kbd> or <kbd>MOD</kbd>+<kbd>v</kbd>) copies the content
|
||||||
into the Android clipboard. As a consequence, any Android application could read
|
into the device clipboard. As a consequence, any Android application could read
|
||||||
its content. You should avoid pasting sensitive content (like passwords) that
|
its content. You should avoid to paste sensitive content (like passwords) that
|
||||||
way.
|
way.
|
||||||
|
|
||||||
Some Android devices do not behave as expected when setting the device clipboard
|
Some devices do not behave as expected when setting the device clipboard
|
||||||
programmatically. An option `--legacy-paste` is provided to change the behavior
|
programmatically. An option `--legacy-paste` is provided to change the behavior
|
||||||
of <kbd>Ctrl</kbd>+<kbd>v</kbd> and <kbd>MOD</kbd>+<kbd>v</kbd> so that they
|
of <kbd>Ctrl</kbd>+<kbd>v</kbd> and <kbd>MOD</kbd>+<kbd>v</kbd> so that they
|
||||||
also inject the computer clipboard text as a sequence of key events (the same
|
also inject the computer clipboard text as a sequence of key events (the same
|
||||||
@@ -820,29 +805,29 @@ To disable automatic clipboard synchronization, use
|
|||||||
|
|
||||||
To simulate "pinch-to-zoom": <kbd>Ctrl</kbd>+_click-and-move_.
|
To simulate "pinch-to-zoom": <kbd>Ctrl</kbd>+_click-and-move_.
|
||||||
|
|
||||||
More precisely, hold down <kbd>Ctrl</kbd> while pressing the left-click button.
|
More precisely, hold <kbd>Ctrl</kbd> while pressing the left-click button. Until
|
||||||
Until the left-click button is released, all mouse movements scale and rotate
|
the left-click button is released, all mouse movements scale and rotate the
|
||||||
the content (if supported by the app) relative to the center of the screen.
|
content (if supported by the app) relative to the center of the screen.
|
||||||
|
|
||||||
Technically, _scrcpy_ generates additional touch events from a "virtual finger"
|
Concretely, scrcpy generates additional touch events from a "virtual finger" at
|
||||||
at a location inverted through the center of the screen.
|
a location inverted through the center of the screen.
|
||||||
|
|
||||||
#### Physical keyboard simulation (HID)
|
#### Physical keyboard simulation (HID)
|
||||||
|
|
||||||
By default, _scrcpy_ uses Android key or text injection: it works everywhere,
|
By default, scrcpy uses Android key or text injection: it works everywhere, but
|
||||||
but is limited to ASCII.
|
is limited to ASCII.
|
||||||
|
|
||||||
Alternatively, `scrcpy` can simulate a physical USB keyboard on Android to
|
Alternatively, scrcpy can simulate a physical USB keyboard on Android to provide
|
||||||
provide a better input experience (using [USB HID over AOAv2][hid-aoav2]): the
|
a better input experience (using [USB HID over AOAv2][hid-aoav2]): the virtual
|
||||||
virtual keyboard is disabled and it works for all characters and IME.
|
keyboard is disabled and it works for all characters and IME.
|
||||||
|
|
||||||
[hid-aoav2]: https://source.android.com/devices/accessories/aoa2#hid-support
|
[hid-aoav2]: https://source.android.com/devices/accessories/aoa2#hid-support
|
||||||
|
|
||||||
However, it only works if the device is connected via USB.
|
However, it only works if the device is connected by USB.
|
||||||
|
|
||||||
Note: On Windows, it may only work in [OTG mode](#otg), not while mirroring (it
|
Note: On Windows, it may only work in [OTG mode](#otg), not while mirroring (it
|
||||||
is not possible to open a USB device if it is already open by another process
|
is not possible to open a USB device if it is already open by another process
|
||||||
like the _adb daemon_).
|
like the adb daemon).
|
||||||
|
|
||||||
To enable this mode:
|
To enable this mode:
|
||||||
|
|
||||||
@@ -853,7 +838,7 @@ scrcpy -K # short version
|
|||||||
|
|
||||||
If it fails for some reason (for example because the device is not connected via
|
If it fails for some reason (for example because the device is not connected via
|
||||||
USB), it automatically fallbacks to the default mode (with a log in the
|
USB), it automatically fallbacks to the default mode (with a log in the
|
||||||
console). This allows using the same command line options when connected over
|
console). This allows to use the same command line options when connected over
|
||||||
USB and TCP/IP.
|
USB and TCP/IP.
|
||||||
|
|
||||||
In this mode, raw key events (scancodes) are sent to the device, independently
|
In this mode, raw key events (scancodes) are sent to the device, independently
|
||||||
@@ -877,7 +862,7 @@ a physical keyboard is connected).
|
|||||||
Similarly to the physical keyboard simulation, it is possible to simulate a
|
Similarly to the physical keyboard simulation, it is possible to simulate a
|
||||||
physical mouse. Likewise, it only works if the device is connected by USB.
|
physical mouse. Likewise, it only works if the device is connected by USB.
|
||||||
|
|
||||||
By default, _scrcpy_ uses Android mouse events injection with absolute
|
By default, scrcpy uses Android mouse events injection, using absolute
|
||||||
coordinates. By simulating a physical mouse, a mouse pointer appears on the
|
coordinates. By simulating a physical mouse, a mouse pointer appears on the
|
||||||
Android device, and relative mouse motion, clicks and scrolls are injected.
|
Android device, and relative mouse motion, clicks and scrolls are injected.
|
||||||
|
|
||||||
@@ -888,7 +873,7 @@ scrcpy --hid-mouse
|
|||||||
scrcpy -M # short version
|
scrcpy -M # short version
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also add `--forward-all-clicks` to [forward all mouse
|
You could also add `--forward-all-clicks` to [forward all mouse
|
||||||
buttons][forward_all_clicks].
|
buttons][forward_all_clicks].
|
||||||
|
|
||||||
[forward_all_clicks]: #right-click-and-middle-click
|
[forward_all_clicks]: #right-click-and-middle-click
|
||||||
@@ -907,7 +892,7 @@ It is possible to run _scrcpy_ with only physical keyboard and mouse simulation
|
|||||||
(HID), as if the computer keyboard and mouse were plugged directly to the device
|
(HID), as if the computer keyboard and mouse were plugged directly to the device
|
||||||
via an OTG cable.
|
via an OTG cable.
|
||||||
|
|
||||||
In this mode, `adb` (USB debugging) is not necessary, and mirroring is disabled.
|
In this mode, _adb_ (USB debugging) is not necessary, and mirroring is disabled.
|
||||||
|
|
||||||
To enable OTG mode:
|
To enable OTG mode:
|
||||||
|
|
||||||
@@ -933,7 +918,7 @@ connected by USB.
|
|||||||
|
|
||||||
#### Text injection preference
|
#### Text injection preference
|
||||||
|
|
||||||
Two kinds of [events][textevents] are generated when typing text:
|
There are two kinds of [events][textevents] generated when typing text:
|
||||||
- _key events_, signaling that a key is pressed or released;
|
- _key events_, signaling that a key is pressed or released;
|
||||||
- _text events_, signaling that a text has been entered.
|
- _text events_, signaling that a text has been entered.
|
||||||
|
|
||||||
@@ -1077,7 +1062,7 @@ _³4th and 5th mouse buttons, if your mouse has them._
|
|||||||
_⁴For react-native apps in development, `MENU` triggers development menu._
|
_⁴For react-native apps in development, `MENU` triggers development menu._
|
||||||
_⁵Only on Android >= 7._
|
_⁵Only on Android >= 7._
|
||||||
|
|
||||||
Shortcuts with repeated keys are executed 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":
|
||||||
|
|
||||||
1. Press and keep pressing <kbd>MOD</kbd>.
|
1. Press and keep pressing <kbd>MOD</kbd>.
|
||||||
@@ -1090,7 +1075,7 @@ handled by the active application.
|
|||||||
|
|
||||||
## Custom paths
|
## Custom paths
|
||||||
|
|
||||||
To use a specific `adb` binary, configure its path in the environment variable
|
To use a specific _adb_ binary, configure its path in the environment variable
|
||||||
`ADB`:
|
`ADB`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -1103,7 +1088,7 @@ To override the path of the `scrcpy-server` file, configure its path in
|
|||||||
To override the icon, configure its path in `SCRCPY_ICON_PATH`.
|
To override the icon, configure its path in `SCRCPY_ICON_PATH`.
|
||||||
|
|
||||||
|
|
||||||
## Why the name _scrcpy_?
|
## Why _scrcpy_?
|
||||||
|
|
||||||
A colleague challenged me to find a name as unpronounceable as [gnirehtet].
|
A colleague challenged me to find a name as unpronounceable as [gnirehtet].
|
||||||
|
|
||||||
@@ -1163,7 +1148,7 @@ If you encounter a bug, please read the [FAQ] first, then open an [issue].
|
|||||||
|
|
||||||
[issue]: https://github.com/Genymobile/scrcpy/issues
|
[issue]: https://github.com/Genymobile/scrcpy/issues
|
||||||
|
|
||||||
For general questions or discussions, you can also use:
|
For general questions or discussions, you could also use:
|
||||||
|
|
||||||
- Reddit: [`r/scrcpy`](https://www.reddit.com/r/scrcpy)
|
- Reddit: [`r/scrcpy`](https://www.reddit.com/r/scrcpy)
|
||||||
- Twitter: [`@scrcpy_app`](https://twitter.com/scrcpy_app)
|
- Twitter: [`@scrcpy_app`](https://twitter.com/scrcpy_app)
|
||||||
@@ -1174,7 +1159,7 @@ This README is available in other languages:
|
|||||||
|
|
||||||
- [Deutsch (German, `de`) - v1.22](README.de.md)
|
- [Deutsch (German, `de`) - v1.22](README.de.md)
|
||||||
- [Indonesian (Indonesia, `id`) - v1.16](README.id.md)
|
- [Indonesian (Indonesia, `id`) - v1.16](README.id.md)
|
||||||
- [Italiano (Italiano, `it`) - v1.23](README.it.md)
|
- [Italiano (Italiano, `it`) - v1.19](README.it.md)
|
||||||
- [日本語 (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)
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ _scrcpy() {
|
|||||||
-N --no-display
|
-N --no-display
|
||||||
--no-key-repeat
|
--no-key-repeat
|
||||||
--no-mipmaps
|
--no-mipmaps
|
||||||
--no-power-on
|
|
||||||
--otg
|
--otg
|
||||||
-p --port=
|
-p --port=
|
||||||
--power-off-on-close
|
--power-off-on-close
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name=scrcpy (console)
|
|
||||||
GenericName=Android Remote Control
|
|
||||||
Comment=Display and control your Android device
|
|
||||||
# For some users, the PATH or ADB environment variables are set from the shell
|
|
||||||
# startup file, like .bashrc or .zshrc… Run an interactive shell to get
|
|
||||||
# environment correctly initialized.
|
|
||||||
Exec=/bin/bash -i -c '"$SHELL" -i -c scrcpy || read -p "Press any key to quit..."'
|
|
||||||
Icon=scrcpy
|
|
||||||
Terminal=true
|
|
||||||
Type=Application
|
|
||||||
Categories=Utility;RemoteAccess;
|
|
||||||
StartupNotify=false
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Name=scrcpy
|
|
||||||
GenericName=Android Remote Control
|
|
||||||
Comment=Display and control your Android device
|
|
||||||
# For some users, the PATH or ADB environment variables are set from the shell
|
|
||||||
# startup file, like .bashrc or .zshrc… Run an interactive shell to get
|
|
||||||
# environment correctly initialized.
|
|
||||||
Exec=/bin/sh -c '"$SHELL" -i -c scrcpy'
|
|
||||||
Icon=scrcpy
|
|
||||||
Terminal=false
|
|
||||||
Type=Application
|
|
||||||
Categories=Utility;RemoteAccess;
|
|
||||||
StartupNotify=false
|
|
||||||
@@ -35,7 +35,6 @@ arguments=(
|
|||||||
{-N,--no-display}'[Do not display device \(during screen recording or when V4L2 sink is enabled\)]'
|
{-N,--no-display}'[Do not display device \(during screen recording or when V4L2 sink is enabled\)]'
|
||||||
'--no-key-repeat[Do not forward repeated key events when a key is held down]'
|
'--no-key-repeat[Do not forward repeated key events when a key is held down]'
|
||||||
'--no-mipmaps[Disable the generation of mipmaps]'
|
'--no-mipmaps[Disable the generation of mipmaps]'
|
||||||
'--no-power-on[Do not power on the device on start]'
|
|
||||||
'--otg[Run in OTG mode \(simulating physical keyboard and mouse\)]'
|
'--otg[Run in OTG mode \(simulating physical keyboard and mouse\)]'
|
||||||
{-p,--port=}'[\[port\[\:port\]\] Set the TCP port \(range\) used by the client to listen]'
|
{-p,--port=}'[\[port\[\:port\]\] Set the TCP port \(range\) used by the client to listen]'
|
||||||
'--power-off-on-close[Turn the device screen off when closing scrcpy]'
|
'--power-off-on-close[Turn the device screen off when closing scrcpy]'
|
||||||
|
|||||||
@@ -143,12 +143,12 @@ else
|
|||||||
|
|
||||||
prebuilt_libusb = meson.get_cross_property('prebuilt_libusb')
|
prebuilt_libusb = meson.get_cross_property('prebuilt_libusb')
|
||||||
prebuilt_libusb_root = meson.get_cross_property('prebuilt_libusb_root')
|
prebuilt_libusb_root = meson.get_cross_property('prebuilt_libusb_root')
|
||||||
libusb_bin_dir = meson.current_source_dir() + '/prebuilt-deps/data/' + prebuilt_libusb
|
libusb_bin_dir = meson.current_source_dir() + '/prebuilt-deps/data/' + prebuilt_libusb + '/dll'
|
||||||
libusb_include_dir = 'prebuilt-deps/data/' + prebuilt_libusb_root + '/include'
|
libusb_include_dir = 'prebuilt-deps/data/' + prebuilt_libusb_root + '/include'
|
||||||
|
|
||||||
libusb = declare_dependency(
|
libusb = declare_dependency(
|
||||||
dependencies: [
|
dependencies: [
|
||||||
cc.find_library('msys-usb-1.0', dirs: libusb_bin_dir),
|
cc.find_library('libusb-1.0', dirs: libusb_bin_dir),
|
||||||
],
|
],
|
||||||
include_directories: include_directories(libusb_include_dir)
|
include_directories: include_directories(libusb_include_dir)
|
||||||
)
|
)
|
||||||
@@ -223,26 +223,14 @@ executable('scrcpy', src,
|
|||||||
install: true,
|
install: true,
|
||||||
c_args: [])
|
c_args: [])
|
||||||
|
|
||||||
# <https://mesonbuild.com/Builtin-options.html#directories>
|
|
||||||
datadir = get_option('datadir') # by default 'share'
|
|
||||||
|
|
||||||
install_man('scrcpy.1')
|
install_man('scrcpy.1')
|
||||||
install_data('data/icon.png',
|
install_data('data/icon.png',
|
||||||
rename: 'scrcpy.png',
|
rename: 'scrcpy.png',
|
||||||
install_dir: join_paths(datadir, 'icons/hicolor/256x256/apps'))
|
install_dir: 'share/icons/hicolor/256x256/apps')
|
||||||
install_data('data/zsh-completion/_scrcpy',
|
install_data('data/zsh-completion/_scrcpy',
|
||||||
install_dir: join_paths(datadir, 'zsh/site-functions'))
|
install_dir: 'share/zsh/site-functions')
|
||||||
install_data('data/bash-completion/scrcpy',
|
install_data('data/bash-completion/scrcpy',
|
||||||
install_dir: join_paths(datadir, 'bash-completion/completions'))
|
install_dir: 'share/bash-completion/completions')
|
||||||
|
|
||||||
# Desktop entry file for application launchers
|
|
||||||
if host_machine.system() == 'linux'
|
|
||||||
# Install a launcher (ex: /usr/local/share/applications/scrcpy.desktop)
|
|
||||||
install_data('data/scrcpy.desktop',
|
|
||||||
install_dir: join_paths(datadir, 'applications'))
|
|
||||||
install_data('data/scrcpy-console.desktop',
|
|
||||||
install_dir: join_paths(datadir, 'applications'))
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
### TESTS
|
### TESTS
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ cd "$DIR"
|
|||||||
mkdir -p "$PREBUILT_DATA_DIR"
|
mkdir -p "$PREBUILT_DATA_DIR"
|
||||||
cd "$PREBUILT_DATA_DIR"
|
cd "$PREBUILT_DATA_DIR"
|
||||||
|
|
||||||
DEP_DIR=platform-tools-33.0.1
|
DEP_DIR=platform-tools-31.0.3
|
||||||
|
|
||||||
FILENAME=platform-tools_r33.0.1-windows.zip
|
FILENAME=platform-tools_r31.0.3-windows.zip
|
||||||
SHA256SUM=c1f02d42ea24ef4ff2a405ae7370e764ef4546f9b3e4520f5571a00ed5012c42
|
SHA256SUM=0f4b8fdd26af2c3733539d6eebb3c2ed499ea1d4bb1f4e0ecc2d6016961a6e24
|
||||||
|
|
||||||
if [[ -d "$DEP_DIR" ]]
|
if [[ -d "$DEP_DIR" ]]
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -6,11 +6,10 @@ cd "$DIR"
|
|||||||
mkdir -p "$PREBUILT_DATA_DIR"
|
mkdir -p "$PREBUILT_DATA_DIR"
|
||||||
cd "$PREBUILT_DATA_DIR"
|
cd "$PREBUILT_DATA_DIR"
|
||||||
|
|
||||||
VERSION=5.0.1
|
DEP_DIR=ffmpeg-win64-5.0
|
||||||
DEP_DIR=ffmpeg-win64-$VERSION
|
|
||||||
|
|
||||||
FILENAME=ffmpeg-$VERSION-full_build-shared.7z
|
FILENAME=ffmpeg-5.0-full_build-shared.7z
|
||||||
SHA256SUM=ded28435b6f04b74f5ef5a6a13761233bce9e8e9f8ecb0eabe936fd36a778b0c
|
SHA256SUM=e5900f6cecd4c438d398bd2fc308736c10b857cd8dd61c11bcfb05bff5d1211a
|
||||||
|
|
||||||
if [[ -d "$DEP_DIR" ]]
|
if [[ -d "$DEP_DIR" ]]
|
||||||
then
|
then
|
||||||
@@ -18,13 +17,13 @@ then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
get_file "https://github.com/GyanD/codexffmpeg/releases/download/$VERSION/$FILENAME" \
|
get_file "https://github.com/GyanD/codexffmpeg/releases/download/5.0/$FILENAME" \
|
||||||
"$FILENAME" "$SHA256SUM"
|
"$FILENAME" "$SHA256SUM"
|
||||||
|
|
||||||
mkdir "$DEP_DIR"
|
mkdir "$DEP_DIR"
|
||||||
cd "$DEP_DIR"
|
cd "$DEP_DIR"
|
||||||
|
|
||||||
ZIP_PREFIX=ffmpeg-$VERSION-full_build-shared
|
ZIP_PREFIX=ffmpeg-5.0-full_build-shared
|
||||||
7z x "../$FILENAME" \
|
7z x "../$FILENAME" \
|
||||||
"$ZIP_PREFIX"/bin/avutil-57.dll \
|
"$ZIP_PREFIX"/bin/avutil-57.dll \
|
||||||
"$ZIP_PREFIX"/bin/avcodec-59.dll \
|
"$ZIP_PREFIX"/bin/avcodec-59.dll \
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ cd "$DIR"
|
|||||||
mkdir -p "$PREBUILT_DATA_DIR"
|
mkdir -p "$PREBUILT_DATA_DIR"
|
||||||
cd "$PREBUILT_DATA_DIR"
|
cd "$PREBUILT_DATA_DIR"
|
||||||
|
|
||||||
DEP_DIR=libusb-1.0.26
|
DEP_DIR=libusb-1.0.25
|
||||||
|
|
||||||
FILENAME=libusb-1.0.26-binaries.7z
|
FILENAME=libusb-1.0.25.7z
|
||||||
SHA256SUM=9c242696342dbde9cdc47239391f71833939bf9f7aa2bbb28cdaabe890465ec5
|
SHA256SUM=3d1c98416f454026034b2b5d67f8a294053898cb70a8b489874e75b136c6674d
|
||||||
|
|
||||||
if [[ -d "$DEP_DIR" ]]
|
if [[ -d "$DEP_DIR" ]]
|
||||||
then
|
then
|
||||||
@@ -17,18 +17,12 @@ then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
get_file "https://github.com/libusb/libusb/releases/download/v1.0.26/$FILENAME" "$FILENAME" "$SHA256SUM"
|
get_file "https://github.com/libusb/libusb/releases/download/v1.0.25/$FILENAME" "$FILENAME" "$SHA256SUM"
|
||||||
|
|
||||||
mkdir "$DEP_DIR"
|
mkdir "$DEP_DIR"
|
||||||
cd "$DEP_DIR"
|
cd "$DEP_DIR"
|
||||||
|
|
||||||
# include/ is the same in all folders of the archive
|
|
||||||
7z x "../$FILENAME" \
|
7z x "../$FILENAME" \
|
||||||
libusb-1.0.26-binaries/libusb-MinGW-Win32/bin/msys-usb-1.0.dll \
|
MinGW32/dll/libusb-1.0.dll \
|
||||||
libusb-1.0.26-binaries/libusb-MinGW-x64/bin/msys-usb-1.0.dll \
|
MinGW64/dll/libusb-1.0.dll \
|
||||||
libusb-1.0.26-binaries/libusb-MinGW-x64/include/
|
include /
|
||||||
|
|
||||||
mv libusb-1.0.26-binaries/libusb-MinGW-Win32/bin MinGW-Win32
|
|
||||||
mv libusb-1.0.26-binaries/libusb-MinGW-x64/bin MinGW-x64
|
|
||||||
mv libusb-1.0.26-binaries/libusb-MinGW-x64/include .
|
|
||||||
rm -rf libusb-1.0.26-binaries
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ cd "$DIR"
|
|||||||
mkdir -p "$PREBUILT_DATA_DIR"
|
mkdir -p "$PREBUILT_DATA_DIR"
|
||||||
cd "$PREBUILT_DATA_DIR"
|
cd "$PREBUILT_DATA_DIR"
|
||||||
|
|
||||||
DEP_DIR=SDL2-2.0.22
|
DEP_DIR=SDL2-2.0.20
|
||||||
|
|
||||||
FILENAME=SDL2-devel-2.0.22-mingw.tar.gz
|
FILENAME=SDL2-devel-2.0.20-mingw.tar.gz
|
||||||
SHA256SUM=0e91e35973366aa1e6f81ee368924d9b4f93f9da4d2f2a89ec80b06eadcf23d1
|
SHA256SUM=38094d82a857d6c62352e5c5cdec74948c5b4d25c59cbd298d6d233568976bd1
|
||||||
|
|
||||||
if [[ -d "$DEP_DIR" ]]
|
if [[ -d "$DEP_DIR" ]]
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -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.24"
|
VALUE "ProductVersion", "1.23"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|||||||
14
app/scrcpy.1
14
app/scrcpy.1
@@ -180,10 +180,6 @@ Do not forward repeated key events when a key is held down.
|
|||||||
.B \-\-no\-mipmaps
|
.B \-\-no\-mipmaps
|
||||||
If the renderer is OpenGL 3.0+ or OpenGL ES 2.0+, then mipmaps are automatically generated to improve downscaling quality. This option disables the generation of mipmaps.
|
If the renderer is OpenGL 3.0+ or OpenGL ES 2.0+, then mipmaps are automatically generated to improve downscaling quality. This option disables the generation of mipmaps.
|
||||||
|
|
||||||
.TP
|
|
||||||
.B \-\-no\-power\-on
|
|
||||||
Do not power on the device on start.
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-\-otg
|
.B \-\-otg
|
||||||
Run in OTG mode: simulate physical keyboard and mouse, as if the computer keyboard and mouse were plugged directly to the device via an OTG cable.
|
Run in OTG mode: simulate physical keyboard and mouse, as if the computer keyboard and mouse were plugged directly to the device via an OTG cable.
|
||||||
@@ -359,12 +355,6 @@ Set the initial window height.
|
|||||||
|
|
||||||
Default is 0 (automatic).
|
Default is 0 (automatic).
|
||||||
|
|
||||||
.SH EXIT STATUS
|
|
||||||
.B scrcpy
|
|
||||||
will exit with code 0 on normal program termination. If an initial
|
|
||||||
connection cannot be established, the exit code 1 will be returned. If the
|
|
||||||
device disconnects while a session is active, exit code 2 will be returned.
|
|
||||||
|
|
||||||
.SH SHORTCUTS
|
.SH SHORTCUTS
|
||||||
|
|
||||||
In the following list, MOD is the shortcut modifier. By default, it's (left)
|
In the following list, MOD is the shortcut modifier. By default, it's (left)
|
||||||
@@ -481,10 +471,6 @@ Push file to device (see \fB\-\-push\-target\fR)
|
|||||||
.B ADB
|
.B ADB
|
||||||
Path to adb.
|
Path to adb.
|
||||||
|
|
||||||
.TP
|
|
||||||
.B ANDROID_SERIAL
|
|
||||||
Device serial to use if no selector (-s, -d, -e or --tcpip=<addr>) is specified.
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B SCRCPY_ICON_PATH
|
.B SCRCPY_ICON_PATH
|
||||||
Path to the program icon.
|
Path to the program icon.
|
||||||
|
|||||||
@@ -473,12 +473,9 @@ sc_adb_accept_device(const struct sc_adb_device *device,
|
|||||||
}
|
}
|
||||||
return !strcmp(selector->serial, device->serial);
|
return !strcmp(selector->serial, device->serial);
|
||||||
case SC_ADB_DEVICE_SELECT_USB:
|
case SC_ADB_DEVICE_SELECT_USB:
|
||||||
return sc_adb_device_get_type(device->serial) ==
|
return !sc_adb_is_serial_tcpip(device->serial);
|
||||||
SC_ADB_DEVICE_TYPE_USB;
|
|
||||||
case SC_ADB_DEVICE_SELECT_TCPIP:
|
case SC_ADB_DEVICE_SELECT_TCPIP:
|
||||||
// Both emulators and TCP/IP devices are selected via -e
|
return sc_adb_is_serial_tcpip(device->serial);
|
||||||
return sc_adb_device_get_type(device->serial) !=
|
|
||||||
SC_ADB_DEVICE_TYPE_USB;
|
|
||||||
default:
|
default:
|
||||||
assert(!"Missing SC_ADB_DEVICE_SELECT_* handling");
|
assert(!"Missing SC_ADB_DEVICE_SELECT_* handling");
|
||||||
break;
|
break;
|
||||||
@@ -512,10 +509,8 @@ sc_adb_devices_log(enum sc_log_level level, struct sc_adb_device *devices,
|
|||||||
for (size_t i = 0; i < count; ++i) {
|
for (size_t i = 0; i < count; ++i) {
|
||||||
struct sc_adb_device *d = &devices[i];
|
struct sc_adb_device *d = &devices[i];
|
||||||
const char *selection = d->selected ? "-->" : " ";
|
const char *selection = d->selected ? "-->" : " ";
|
||||||
bool is_usb =
|
const char *type = sc_adb_is_serial_tcpip(d->serial) ? "(tcpip)"
|
||||||
sc_adb_device_get_type(d->serial) == SC_ADB_DEVICE_TYPE_USB;
|
: " (usb)";
|
||||||
const char *type = is_usb ? " (usb)"
|
|
||||||
: "(tcpip)";
|
|
||||||
LOG(level, " %s %s %-20s %16s %s",
|
LOG(level, " %s %s %-20s %16s %s",
|
||||||
selection, type, d->serial, d->state, d->model ? d->model : "");
|
selection, type, d->serial, d->state, d->model ? d->model : "");
|
||||||
}
|
}
|
||||||
@@ -536,8 +531,6 @@ sc_adb_device_check_state(struct sc_adb_device *device,
|
|||||||
LOGE("A popup should open on the device to request authorization.");
|
LOGE("A popup should open on the device to request authorization.");
|
||||||
LOGE("Check the FAQ: "
|
LOGE("Check the FAQ: "
|
||||||
"<https://github.com/Genymobile/scrcpy/blob/master/FAQ.md>");
|
"<https://github.com/Genymobile/scrcpy/blob/master/FAQ.md>");
|
||||||
} else {
|
|
||||||
LOGE("Device could not be connected (state=%s)", state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -710,5 +703,10 @@ sc_adb_get_device_ip(struct sc_intr *intr, const char *serial, unsigned flags) {
|
|||||||
// It is parsed as a NUL-terminated string
|
// It is parsed as a NUL-terminated string
|
||||||
buf[r] = '\0';
|
buf[r] = '\0';
|
||||||
|
|
||||||
return sc_adb_parse_device_ip(buf);
|
return sc_adb_parse_device_ip_from_output(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
sc_adb_is_serial_tcpip(const char *serial) {
|
||||||
|
return strchr(serial, ':');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,4 +114,13 @@ sc_adb_getprop(struct sc_intr *intr, const char *serial, const char *prop,
|
|||||||
char *
|
char *
|
||||||
sc_adb_get_device_ip(struct sc_intr *intr, const char *serial, unsigned flags);
|
sc_adb_get_device_ip(struct sc_intr *intr, const char *serial, unsigned flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicate if the serial represents an IP address
|
||||||
|
*
|
||||||
|
* In practice, it just returns true if and only if it contains a ':', which is
|
||||||
|
* sufficient to distinguish an ip:port from a real USB serial.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
sc_adb_is_serial_tcpip(const char *serial);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "adb_device.h"
|
#include "adb_device.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sc_adb_device_destroy(struct sc_adb_device *device) {
|
sc_adb_device_destroy(struct sc_adb_device *device) {
|
||||||
@@ -26,18 +25,3 @@ sc_adb_devices_destroy(struct sc_vec_adb_devices *devices) {
|
|||||||
sc_vector_destroy(devices);
|
sc_vector_destroy(devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum sc_adb_device_type
|
|
||||||
sc_adb_device_get_type(const char *serial) {
|
|
||||||
// Starts with "emulator-"
|
|
||||||
if (!strncmp(serial, "emulator-", sizeof("emulator-") - 1)) {
|
|
||||||
return SC_ADB_DEVICE_TYPE_EMULATOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the serial contains a ':', then it is a TCP/IP device (it is
|
|
||||||
// sufficient to distinguish an ip:port from a real USB serial)
|
|
||||||
if (strchr(serial, ':')) {
|
|
||||||
return SC_ADB_DEVICE_TYPE_TCPIP;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SC_ADB_DEVICE_TYPE_USB;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -15,12 +15,6 @@ struct sc_adb_device {
|
|||||||
bool selected;
|
bool selected;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sc_adb_device_type {
|
|
||||||
SC_ADB_DEVICE_TYPE_USB,
|
|
||||||
SC_ADB_DEVICE_TYPE_TCPIP,
|
|
||||||
SC_ADB_DEVICE_TYPE_EMULATOR,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sc_vec_adb_devices SC_VECTOR(struct sc_adb_device);
|
struct sc_vec_adb_devices SC_VECTOR(struct sc_adb_device);
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -41,10 +35,4 @@ sc_adb_device_move(struct sc_adb_device *dst, struct sc_adb_device *src);
|
|||||||
void
|
void
|
||||||
sc_adb_devices_destroy(struct sc_vec_adb_devices *devices);
|
sc_adb_devices_destroy(struct sc_vec_adb_devices *devices);
|
||||||
|
|
||||||
/**
|
|
||||||
* Deduce the device type from the serial
|
|
||||||
*/
|
|
||||||
enum sc_adb_device_type
|
|
||||||
sc_adb_device_get_type(const char *serial);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ sc_adb_parse_device_ip_from_line(char *line) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
sc_adb_parse_device_ip(char *str) {
|
sc_adb_parse_device_ip_from_output(char *str) {
|
||||||
size_t idx_line = 0;
|
size_t idx_line = 0;
|
||||||
while (str[idx_line] != '\0') {
|
while (str[idx_line] != '\0') {
|
||||||
char *line = &str[idx_line];
|
char *line = &str[idx_line];
|
||||||
|
|||||||
@@ -25,6 +25,6 @@ sc_adb_parse_devices(char *str, struct sc_vec_adb_devices *out_vec);
|
|||||||
* Warning: this function modifies the buffer for optimization purposes.
|
* Warning: this function modifies the buffer for optimization purposes.
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
sc_adb_parse_device_ip(char *str);
|
sc_adb_parse_device_ip_from_output(char *str);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -56,7 +56,6 @@
|
|||||||
#define OPT_OTG 1036
|
#define OPT_OTG 1036
|
||||||
#define OPT_NO_CLEANUP 1037
|
#define OPT_NO_CLEANUP 1037
|
||||||
#define OPT_PRINT_FPS 1038
|
#define OPT_PRINT_FPS 1038
|
||||||
#define OPT_NO_POWER_ON 1039
|
|
||||||
|
|
||||||
struct sc_option {
|
struct sc_option {
|
||||||
char shortopt;
|
char shortopt;
|
||||||
@@ -81,11 +80,6 @@ struct sc_envvar {
|
|||||||
const char *text;
|
const char *text;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sc_exit_status {
|
|
||||||
unsigned value;
|
|
||||||
const char *text;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sc_getopt_adapter {
|
struct sc_getopt_adapter {
|
||||||
char *optstring;
|
char *optstring;
|
||||||
struct option *longopts;
|
struct option *longopts;
|
||||||
@@ -303,11 +297,6 @@ static const struct sc_option options[] = {
|
|||||||
"mipmaps are automatically generated to improve downscaling "
|
"mipmaps are automatically generated to improve downscaling "
|
||||||
"quality. This option disables the generation of mipmaps.",
|
"quality. This option disables the generation of mipmaps.",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.longopt_id = OPT_NO_POWER_ON,
|
|
||||||
.longopt = "no-power-on",
|
|
||||||
.text = "Do not power on the device on start.",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_OTG,
|
.longopt_id = OPT_OTG,
|
||||||
.longopt = "otg",
|
.longopt = "otg",
|
||||||
@@ -583,7 +572,7 @@ static const struct sc_shortcut shortcuts[] = {
|
|||||||
.text = "Click on BACK",
|
.text = "Click on BACK",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.shortcuts = { "MOD+s", "4th-click" },
|
.shortcuts = { "MOD+s" },
|
||||||
.text = "Click on APP_SWITCH",
|
.text = "Click on APP_SWITCH",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -619,7 +608,7 @@ static const struct sc_shortcut shortcuts[] = {
|
|||||||
.text = "Rotate device screen",
|
.text = "Rotate device screen",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.shortcuts = { "MOD+n", "5th-click" },
|
.shortcuts = { "MOD+n" },
|
||||||
.text = "Expand notification panel",
|
.text = "Expand notification panel",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -666,11 +655,6 @@ static const struct sc_envvar envvars[] = {
|
|||||||
.name = "ADB",
|
.name = "ADB",
|
||||||
.text = "Path to adb executable",
|
.text = "Path to adb executable",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.name = "ANDROID_SERIAL",
|
|
||||||
.text = "Device serial to use if no selector (-s, -d, -e or "
|
|
||||||
"--tcpip=<addr>) is specified",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.name = "SCRCPY_ICON_PATH",
|
.name = "SCRCPY_ICON_PATH",
|
||||||
.text = "Path to the program icon",
|
.text = "Path to the program icon",
|
||||||
@@ -678,22 +662,7 @@ static const struct sc_envvar envvars[] = {
|
|||||||
{
|
{
|
||||||
.name = "SCRCPY_SERVER_PATH",
|
.name = "SCRCPY_SERVER_PATH",
|
||||||
.text = "Path to the server binary",
|
.text = "Path to the server binary",
|
||||||
},
|
}
|
||||||
};
|
|
||||||
|
|
||||||
static const struct sc_exit_status exit_statuses[] = {
|
|
||||||
{
|
|
||||||
.value = 0,
|
|
||||||
.text = "Normal program termination",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.value = 1,
|
|
||||||
.text = "Start failure",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.value = 2,
|
|
||||||
.text = "Device disconnected while running",
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@@ -932,25 +901,6 @@ print_envvar(const struct sc_envvar *envvar, unsigned cols) {
|
|||||||
free(text);
|
free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
print_exit_status(const struct sc_exit_status *status, unsigned cols) {
|
|
||||||
assert(cols > 8); // sc_str_wrap_lines() requires indent < columns
|
|
||||||
assert(status->text);
|
|
||||||
|
|
||||||
// The text starts at 9: 4 ident spaces, 3 chars for numeric value, 2 spaces
|
|
||||||
char *text = sc_str_wrap_lines(status->text, cols, 9);
|
|
||||||
if (!text) {
|
|
||||||
printf("<ERROR>\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(strlen(text) >= 9); // Contains at least the initial identation
|
|
||||||
|
|
||||||
// text + 9 to remove the initial indentation
|
|
||||||
printf(" %3d %s\n", status->value, text + 9);
|
|
||||||
free(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
scrcpy_print_usage(const char *arg0) {
|
scrcpy_print_usage(const char *arg0) {
|
||||||
#define SC_TERM_COLS_DEFAULT 80
|
#define SC_TERM_COLS_DEFAULT 80
|
||||||
@@ -989,11 +939,6 @@ scrcpy_print_usage(const char *arg0) {
|
|||||||
for (size_t i = 0; i < ARRAY_LEN(envvars); ++i) {
|
for (size_t i = 0; i < ARRAY_LEN(envvars); ++i) {
|
||||||
print_envvar(&envvars[i], cols);
|
print_envvar(&envvars[i], cols);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\nExit status:\n\n");
|
|
||||||
for (size_t i = 0; i < ARRAY_LEN(exit_statuses); ++i) {
|
|
||||||
print_exit_status(&exit_statuses[i], cols);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@@ -1604,9 +1549,6 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|||||||
case OPT_NO_CLEANUP:
|
case OPT_NO_CLEANUP:
|
||||||
opts->cleanup = false;
|
opts->cleanup = false;
|
||||||
break;
|
break;
|
||||||
case OPT_NO_POWER_ON:
|
|
||||||
opts->power_on = false;
|
|
||||||
break;
|
|
||||||
case OPT_PRINT_FPS:
|
case OPT_PRINT_FPS:
|
||||||
opts->start_fps_counter = true;
|
opts->start_fps_counter = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SC_COMMON_H
|
#ifndef COMMON_H
|
||||||
#define SC_COMMON_H
|
#define COMMON_H
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SC_COMPAT_H
|
#ifndef COMPAT_H
|
||||||
#define SC_COMPAT_H
|
#define COMPAT_H
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SC_CONTROLMSG_H
|
#ifndef CONTROLMSG_H
|
||||||
#define SC_CONTROLMSG_H
|
#define CONTROLMSG_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SC_CONTROLLER_H
|
#ifndef CONTROLLER_H
|
||||||
#define SC_CONTROLLER_H
|
#define CONTROLLER_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SC_DEVICEMSG_H
|
#ifndef DEVICEMSG_H
|
||||||
#define SC_DEVICEMSG_H
|
#define DEVICEMSG_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SC_FPSCOUNTER_H
|
#ifndef FPSCOUNTER_H
|
||||||
#define SC_FPSCOUNTER_H
|
#define FPSCOUNTER_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SC_ICON_H
|
#ifndef ICON_H
|
||||||
#define SC_ICON_H
|
#define ICON_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SC_INPUTMANAGER_H
|
#ifndef INPUTMANAGER_H
|
||||||
#define SC_INPUTMANAGER_H
|
#define INPUTMANAGER_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -40,19 +40,19 @@ main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!scrcpy_parse_args(&args, argc, argv)) {
|
if (!scrcpy_parse_args(&args, argc, argv)) {
|
||||||
return SCRCPY_EXIT_FAILURE;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_set_log_level(args.opts.log_level);
|
sc_set_log_level(args.opts.log_level);
|
||||||
|
|
||||||
if (args.help) {
|
if (args.help) {
|
||||||
scrcpy_print_usage(argv[0]);
|
scrcpy_print_usage(argv[0]);
|
||||||
return SCRCPY_EXIT_SUCCESS;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.version) {
|
if (args.version) {
|
||||||
scrcpy_print_version();
|
scrcpy_print_version();
|
||||||
return SCRCPY_EXIT_SUCCESS;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SCRCPY_LAVF_REQUIRES_REGISTER_ALL
|
#ifdef SCRCPY_LAVF_REQUIRES_REGISTER_ALL
|
||||||
@@ -66,17 +66,17 @@ main(int argc, char *argv[]) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (avformat_network_init()) {
|
if (avformat_network_init()) {
|
||||||
return SCRCPY_EXIT_FAILURE;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_USB
|
#ifdef HAVE_USB
|
||||||
enum scrcpy_exit_code ret = args.opts.otg ? scrcpy_otg(&args.opts)
|
bool ok = args.opts.otg ? scrcpy_otg(&args.opts)
|
||||||
: scrcpy(&args.opts);
|
: scrcpy(&args.opts);
|
||||||
#else
|
#else
|
||||||
enum scrcpy_exit_code ret = scrcpy(&args.opts);
|
bool ok = scrcpy(&args.opts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
avformat_network_deinit(); // ignore failure
|
avformat_network_deinit(); // ignore failure
|
||||||
|
|
||||||
return ret;
|
return ok ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ sc_opengl_init(struct sc_opengl *gl) {
|
|||||||
sizeof(OPENGL_ES_PREFIX) - 1);
|
sizeof(OPENGL_ES_PREFIX) - 1);
|
||||||
if (gl->is_opengles) {
|
if (gl->is_opengles) {
|
||||||
/* skip the prefix */
|
/* skip the prefix */
|
||||||
version += sizeof(OPENGL_ES_PREFIX) - 1;
|
version += sizeof(PREFIX) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int r = sscanf(version, "%d.%d", &gl->version_major, &gl->version_minor);
|
int r = sscanf(version, "%d.%d", &gl->version_major, &gl->version_minor);
|
||||||
|
|||||||
@@ -64,5 +64,4 @@ const struct scrcpy_options scrcpy_options_default = {
|
|||||||
.select_usb = false,
|
.select_usb = false,
|
||||||
.cleanup = true,
|
.cleanup = true,
|
||||||
.start_fps_counter = false,
|
.start_fps_counter = false,
|
||||||
.power_on = true,
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ struct scrcpy_options {
|
|||||||
bool select_tcpip;
|
bool select_tcpip;
|
||||||
bool cleanup;
|
bool cleanup;
|
||||||
bool start_fps_counter;
|
bool start_fps_counter;
|
||||||
bool power_on;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct scrcpy_options scrcpy_options_default;
|
extern const struct scrcpy_options scrcpy_options_default;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SC_RECEIVER_H
|
#ifndef RECEIVER_H
|
||||||
#define SC_RECEIVER_H
|
#define RECEIVER_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -149,41 +149,38 @@ sdl_configure(bool display, bool disable_screensaver) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum scrcpy_exit_code
|
static bool
|
||||||
event_loop(struct scrcpy *s) {
|
event_loop(struct scrcpy *s) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while (SDL_WaitEvent(&event)) {
|
while (SDL_WaitEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case EVENT_STREAM_STOPPED:
|
case EVENT_STREAM_STOPPED:
|
||||||
LOGW("Device disconnected");
|
LOGW("Device disconnected");
|
||||||
return SCRCPY_EXIT_DISCONNECTED;
|
return false;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
LOGD("User requested to quit");
|
LOGD("User requested to quit");
|
||||||
return SCRCPY_EXIT_SUCCESS;
|
return true;
|
||||||
default:
|
default:
|
||||||
sc_screen_handle_event(&s->screen, &event);
|
sc_screen_handle_event(&s->screen, &event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SCRCPY_EXIT_FAILURE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true on success, false on error
|
|
||||||
static bool
|
static bool
|
||||||
await_for_server(bool *connected) {
|
await_for_server(void) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while (SDL_WaitEvent(&event)) {
|
while (SDL_WaitEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
LOGD("User requested to quit");
|
LOGD("User requested to quit");
|
||||||
*connected = false;
|
return false;
|
||||||
return true;
|
|
||||||
case EVENT_SERVER_CONNECTION_FAILED:
|
case EVENT_SERVER_CONNECTION_FAILED:
|
||||||
LOGE("Server connection failed");
|
LOGE("Server connection failed");
|
||||||
return false;
|
return false;
|
||||||
case EVENT_SERVER_CONNECTED:
|
case EVENT_SERVER_CONNECTED:
|
||||||
LOGD("Server connected");
|
LOGD("Server connected");
|
||||||
*connected = true;
|
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -265,7 +262,7 @@ sc_server_on_disconnected(struct sc_server *server, void *userdata) {
|
|||||||
// event
|
// event
|
||||||
}
|
}
|
||||||
|
|
||||||
enum scrcpy_exit_code
|
bool
|
||||||
scrcpy(struct scrcpy_options *options) {
|
scrcpy(struct scrcpy_options *options) {
|
||||||
static struct scrcpy scrcpy;
|
static struct scrcpy scrcpy;
|
||||||
struct scrcpy *s = &scrcpy;
|
struct scrcpy *s = &scrcpy;
|
||||||
@@ -273,12 +270,12 @@ scrcpy(struct scrcpy_options *options) {
|
|||||||
// Minimal SDL initialization
|
// Minimal SDL initialization
|
||||||
if (SDL_Init(SDL_INIT_EVENTS)) {
|
if (SDL_Init(SDL_INIT_EVENTS)) {
|
||||||
LOGE("Could not initialize SDL: %s", SDL_GetError());
|
LOGE("Could not initialize SDL: %s", SDL_GetError());
|
||||||
return SCRCPY_EXIT_FAILURE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
atexit(SDL_Quit);
|
atexit(SDL_Quit);
|
||||||
|
|
||||||
enum scrcpy_exit_code ret = SCRCPY_EXIT_FAILURE;
|
bool ret = false;
|
||||||
|
|
||||||
bool server_started = false;
|
bool server_started = false;
|
||||||
bool file_pusher_initialized = false;
|
bool file_pusher_initialized = false;
|
||||||
@@ -324,7 +321,6 @@ scrcpy(struct scrcpy_options *options) {
|
|||||||
.tcpip = options->tcpip,
|
.tcpip = options->tcpip,
|
||||||
.tcpip_dst = options->tcpip_dst,
|
.tcpip_dst = options->tcpip_dst,
|
||||||
.cleanup = options->cleanup,
|
.cleanup = options->cleanup,
|
||||||
.power_on = options->power_on,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct sc_server_callbacks cbs = {
|
static const struct sc_server_callbacks cbs = {
|
||||||
@@ -333,7 +329,7 @@ scrcpy(struct scrcpy_options *options) {
|
|||||||
.on_disconnected = sc_server_on_disconnected,
|
.on_disconnected = sc_server_on_disconnected,
|
||||||
};
|
};
|
||||||
if (!sc_server_init(&s->server, ¶ms, &cbs, NULL)) {
|
if (!sc_server_init(&s->server, ¶ms, &cbs, NULL)) {
|
||||||
return SCRCPY_EXIT_FAILURE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sc_server_start(&s->server)) {
|
if (!sc_server_start(&s->server)) {
|
||||||
@@ -355,14 +351,7 @@ scrcpy(struct scrcpy_options *options) {
|
|||||||
sdl_configure(options->display, options->disable_screensaver);
|
sdl_configure(options->display, options->disable_screensaver);
|
||||||
|
|
||||||
// Await for server without blocking Ctrl+C handling
|
// Await for server without blocking Ctrl+C handling
|
||||||
bool connected;
|
if (!await_for_server()) {
|
||||||
if (!await_for_server(&connected)) {
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!connected) {
|
|
||||||
// This is not an error, user requested to quit
|
|
||||||
ret = SCRCPY_EXIT_SUCCESS;
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,18 +6,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
enum scrcpy_exit_code {
|
bool
|
||||||
// Normal program termination
|
|
||||||
SCRCPY_EXIT_SUCCESS,
|
|
||||||
|
|
||||||
// No connection could be established
|
|
||||||
SCRCPY_EXIT_FAILURE,
|
|
||||||
|
|
||||||
// Device was disconnected while running
|
|
||||||
SCRCPY_EXIT_DISCONNECTED,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum scrcpy_exit_code
|
|
||||||
scrcpy(struct scrcpy_options *options);
|
scrcpy(struct scrcpy_options *options);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -248,10 +248,6 @@ execute_server(struct sc_server *server,
|
|||||||
// By default, cleanup is true
|
// By default, cleanup is true
|
||||||
ADD_PARAM("cleanup=false");
|
ADD_PARAM("cleanup=false");
|
||||||
}
|
}
|
||||||
if (!params->power_on) {
|
|
||||||
// By default, power_on is true
|
|
||||||
ADD_PARAM("power_on=false");
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef ADD_PARAM
|
#undef ADD_PARAM
|
||||||
|
|
||||||
@@ -653,8 +649,7 @@ sc_server_configure_tcpip_known_address(struct sc_server *server,
|
|||||||
static bool
|
static bool
|
||||||
sc_server_configure_tcpip_unknown_address(struct sc_server *server,
|
sc_server_configure_tcpip_unknown_address(struct sc_server *server,
|
||||||
const char *serial) {
|
const char *serial) {
|
||||||
bool is_already_tcpip =
|
bool is_already_tcpip = sc_adb_is_serial_tcpip(serial);
|
||||||
sc_adb_device_get_type(serial) == SC_ADB_DEVICE_TYPE_TCPIP;
|
|
||||||
if (is_already_tcpip) {
|
if (is_already_tcpip) {
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
LOGI("Device already connected via TCP/IP: %s", serial);
|
LOGI("Device already connected via TCP/IP: %s", serial);
|
||||||
@@ -712,15 +707,7 @@ run_server(void *data) {
|
|||||||
} else if (params->select_tcpip) {
|
} else if (params->select_tcpip) {
|
||||||
selector.type = SC_ADB_DEVICE_SELECT_TCPIP;
|
selector.type = SC_ADB_DEVICE_SELECT_TCPIP;
|
||||||
} else {
|
} else {
|
||||||
// No explicit selection, check $ANDROID_SERIAL
|
selector.type = SC_ADB_DEVICE_SELECT_ALL;
|
||||||
const char *env_serial = getenv("ANDROID_SERIAL");
|
|
||||||
if (env_serial) {
|
|
||||||
LOGI("Using ANDROID_SERIAL: %s", env_serial);
|
|
||||||
selector.type = SC_ADB_DEVICE_SELECT_SERIAL;
|
|
||||||
selector.serial = env_serial;
|
|
||||||
} else {
|
|
||||||
selector.type = SC_ADB_DEVICE_SELECT_ALL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
struct sc_adb_device device;
|
struct sc_adb_device device;
|
||||||
ok = sc_adb_select_device(&server->intr, &selector, 0, &device);
|
ok = sc_adb_select_device(&server->intr, &selector, 0, &device);
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ struct sc_server_params {
|
|||||||
bool select_usb;
|
bool select_usb;
|
||||||
bool select_tcpip;
|
bool select_tcpip;
|
||||||
bool cleanup;
|
bool cleanup;
|
||||||
bool power_on;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sc_server {
|
struct sc_server {
|
||||||
|
|||||||
51
app/src/stream.h
Normal file
51
app/src/stream.h
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
#ifndef STREAM_H
|
||||||
|
#define STREAM_H
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <libavcodec/avcodec.h>
|
||||||
|
#include <libavformat/avformat.h>
|
||||||
|
|
||||||
|
#include "trait/packet_sink.h"
|
||||||
|
#include "util/net.h"
|
||||||
|
#include "util/thread.h"
|
||||||
|
|
||||||
|
#define STREAM_MAX_SINKS 2
|
||||||
|
|
||||||
|
struct stream {
|
||||||
|
sc_socket socket;
|
||||||
|
sc_thread thread;
|
||||||
|
|
||||||
|
struct sc_packet_sink *sinks[STREAM_MAX_SINKS];
|
||||||
|
unsigned sink_count;
|
||||||
|
|
||||||
|
AVCodecContext *codec_ctx;
|
||||||
|
AVCodecParserContext *parser;
|
||||||
|
// successive packets may need to be concatenated, until a non-config
|
||||||
|
// packet is available
|
||||||
|
AVPacket *pending;
|
||||||
|
|
||||||
|
const struct stream_callbacks *cbs;
|
||||||
|
void *cbs_userdata;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct stream_callbacks {
|
||||||
|
void (*on_eos)(struct stream *stream, void *userdata);
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
stream_init(struct stream *stream, sc_socket socket,
|
||||||
|
const struct stream_callbacks *cbs, void *cbs_userdata);
|
||||||
|
|
||||||
|
void
|
||||||
|
stream_add_sink(struct stream *stream, struct sc_packet_sink *sink);
|
||||||
|
|
||||||
|
bool
|
||||||
|
stream_start(struct stream *stream);
|
||||||
|
|
||||||
|
void
|
||||||
|
stream_join(struct stream *stream);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -340,7 +340,7 @@ push_mod_lock_state(struct sc_hid_keyboard *kb, uint16_t mods_state) {
|
|||||||
|
|
||||||
if (!sc_aoa_push_hid_event(kb->aoa, &hid_event)) {
|
if (!sc_aoa_push_hid_event(kb->aoa, &hid_event)) {
|
||||||
sc_hid_event_destroy(&hid_event);
|
sc_hid_event_destroy(&hid_event);
|
||||||
LOGW("Could not request HID event (mod lock state)");
|
LOGW("Could request HID event");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,7 +382,7 @@ sc_key_processor_process_key(struct sc_key_processor *kp,
|
|||||||
|
|
||||||
if (!sc_aoa_push_hid_event(kb->aoa, &hid_event)) {
|
if (!sc_aoa_push_hid_event(kb->aoa, &hid_event)) {
|
||||||
sc_hid_event_destroy(&hid_event);
|
sc_hid_event_destroy(&hid_event);
|
||||||
LOGW("Could not request HID event (key)");
|
LOGW("Could request HID event");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ sc_mouse_processor_process_mouse_motion(struct sc_mouse_processor *mp,
|
|||||||
|
|
||||||
if (!sc_aoa_push_hid_event(mouse->aoa, &hid_event)) {
|
if (!sc_aoa_push_hid_event(mouse->aoa, &hid_event)) {
|
||||||
sc_hid_event_destroy(&hid_event);
|
sc_hid_event_destroy(&hid_event);
|
||||||
LOGW("Could not request HID event (mouse motion)");
|
LOGW("Could request HID event");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ sc_mouse_processor_process_mouse_click(struct sc_mouse_processor *mp,
|
|||||||
|
|
||||||
if (!sc_aoa_push_hid_event(mouse->aoa, &hid_event)) {
|
if (!sc_aoa_push_hid_event(mouse->aoa, &hid_event)) {
|
||||||
sc_hid_event_destroy(&hid_event);
|
sc_hid_event_destroy(&hid_event);
|
||||||
LOGW("Could not request HID event (mouse click)");
|
LOGW("Could request HID event");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ sc_mouse_processor_process_mouse_scroll(struct sc_mouse_processor *mp,
|
|||||||
|
|
||||||
if (!sc_aoa_push_hid_event(mouse->aoa, &hid_event)) {
|
if (!sc_aoa_push_hid_event(mouse->aoa, &hid_event)) {
|
||||||
sc_hid_event_destroy(&hid_event);
|
sc_hid_event_destroy(&hid_event);
|
||||||
LOGW("Could not request HID event (mouse scroll)");
|
LOGW("Could request HID event");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,36 +29,32 @@ sc_usb_on_disconnected(struct sc_usb *usb, void *userdata) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum scrcpy_exit_code
|
static bool
|
||||||
event_loop(struct scrcpy_otg *s) {
|
event_loop(struct scrcpy_otg *s) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
while (SDL_WaitEvent(&event)) {
|
while (SDL_WaitEvent(&event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case EVENT_USB_DEVICE_DISCONNECTED:
|
case EVENT_USB_DEVICE_DISCONNECTED:
|
||||||
LOGW("Device disconnected");
|
LOGW("Device disconnected");
|
||||||
return SCRCPY_EXIT_DISCONNECTED;
|
return false;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
LOGD("User requested to quit");
|
LOGD("User requested to quit");
|
||||||
return SCRCPY_EXIT_SUCCESS;
|
return true;
|
||||||
default:
|
default:
|
||||||
sc_screen_otg_handle_event(&s->screen_otg, &event);
|
sc_screen_otg_handle_event(&s->screen_otg, &event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SCRCPY_EXIT_FAILURE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum scrcpy_exit_code
|
bool
|
||||||
scrcpy_otg(struct scrcpy_options *options) {
|
scrcpy_otg(struct scrcpy_options *options) {
|
||||||
static struct scrcpy_otg scrcpy_otg;
|
static struct scrcpy_otg scrcpy_otg;
|
||||||
struct scrcpy_otg *s = &scrcpy_otg;
|
struct scrcpy_otg *s = &scrcpy_otg;
|
||||||
|
|
||||||
const char *serial = options->serial;
|
const char *serial = options->serial;
|
||||||
|
|
||||||
if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1")) {
|
|
||||||
LOGW("Could not enable linear filtering");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Minimal SDL initialization
|
// Minimal SDL initialization
|
||||||
if (SDL_Init(SDL_INIT_EVENTS)) {
|
if (SDL_Init(SDL_INIT_EVENTS)) {
|
||||||
LOGE("Could not initialize SDL: %s", SDL_GetError());
|
LOGE("Could not initialize SDL: %s", SDL_GetError());
|
||||||
@@ -71,7 +67,7 @@ scrcpy_otg(struct scrcpy_options *options) {
|
|||||||
LOGW("Could not enable mouse focus clickthrough");
|
LOGW("Could not enable mouse focus clickthrough");
|
||||||
}
|
}
|
||||||
|
|
||||||
enum scrcpy_exit_code ret = SCRCPY_EXIT_FAILURE;
|
bool ret = false;
|
||||||
|
|
||||||
struct sc_hid_keyboard *keyboard = NULL;
|
struct sc_hid_keyboard *keyboard = NULL;
|
||||||
struct sc_hid_mouse *mouse = NULL;
|
struct sc_hid_mouse *mouse = NULL;
|
||||||
@@ -94,7 +90,7 @@ scrcpy_otg(struct scrcpy_options *options) {
|
|||||||
};
|
};
|
||||||
bool ok = sc_usb_init(&s->usb);
|
bool ok = sc_usb_init(&s->usb);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return SCRCPY_EXIT_FAILURE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sc_usb_device usb_device;
|
struct sc_usb_device usb_device;
|
||||||
@@ -166,8 +162,6 @@ scrcpy_otg(struct scrcpy_options *options) {
|
|||||||
.always_on_top = options->always_on_top,
|
.always_on_top = options->always_on_top,
|
||||||
.window_x = options->window_x,
|
.window_x = options->window_x,
|
||||||
.window_y = options->window_y,
|
.window_y = options->window_y,
|
||||||
.window_width = options->window_width,
|
|
||||||
.window_height = options->window_height,
|
|
||||||
.window_borderless = options->window_borderless,
|
.window_borderless = options->window_borderless,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "scrcpy.h"
|
|
||||||
|
|
||||||
enum scrcpy_exit_code
|
bool
|
||||||
scrcpy_otg(struct scrcpy_options *options);
|
scrcpy_otg(struct scrcpy_options *options);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -69,10 +69,10 @@ sc_screen_otg_init(struct sc_screen_otg *screen,
|
|||||||
? params->window_x : (int) SDL_WINDOWPOS_UNDEFINED;
|
? params->window_x : (int) SDL_WINDOWPOS_UNDEFINED;
|
||||||
int y = params->window_y != SC_WINDOW_POSITION_UNDEFINED
|
int y = params->window_y != SC_WINDOW_POSITION_UNDEFINED
|
||||||
? params->window_y : (int) SDL_WINDOWPOS_UNDEFINED;
|
? params->window_y : (int) SDL_WINDOWPOS_UNDEFINED;
|
||||||
int width = params->window_width ? params->window_width : 256;
|
int width = 256;
|
||||||
int height = params->window_height ? params->window_height : 256;
|
int height = 256;
|
||||||
|
|
||||||
uint32_t window_flags = SDL_WINDOW_ALLOW_HIGHDPI;
|
uint32_t window_flags = 0;
|
||||||
if (params->always_on_top) {
|
if (params->always_on_top) {
|
||||||
window_flags |= SDL_WINDOW_ALWAYS_ON_TOP;
|
window_flags |= SDL_WINDOW_ALWAYS_ON_TOP;
|
||||||
}
|
}
|
||||||
@@ -97,11 +97,6 @@ sc_screen_otg_init(struct sc_screen_otg *screen,
|
|||||||
if (icon) {
|
if (icon) {
|
||||||
SDL_SetWindowIcon(screen->window, icon);
|
SDL_SetWindowIcon(screen->window, icon);
|
||||||
|
|
||||||
if (SDL_RenderSetLogicalSize(screen->renderer, icon->w, icon->h)) {
|
|
||||||
LOGW("Could not set renderer logical size: %s", SDL_GetError());
|
|
||||||
// don't fail
|
|
||||||
}
|
|
||||||
|
|
||||||
screen->texture = SDL_CreateTextureFromSurface(screen->renderer, icon);
|
screen->texture = SDL_CreateTextureFromSurface(screen->renderer, icon);
|
||||||
scrcpy_icon_destroy(icon);
|
scrcpy_icon_destroy(icon);
|
||||||
if (!screen->texture) {
|
if (!screen->texture) {
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ struct sc_screen_otg_params {
|
|||||||
bool always_on_top;
|
bool always_on_top;
|
||||||
int16_t window_x; // accepts SC_WINDOW_POSITION_UNDEFINED
|
int16_t window_x; // accepts SC_WINDOW_POSITION_UNDEFINED
|
||||||
int16_t window_y; // accepts SC_WINDOW_POSITION_UNDEFINED
|
int16_t window_y; // accepts SC_WINDOW_POSITION_UNDEFINED
|
||||||
uint16_t window_width;
|
|
||||||
uint16_t window_height;
|
|
||||||
bool window_borderless;
|
bool window_borderless;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ read_string(libusb_device_handle *handle, uint8_t desc_index) {
|
|||||||
(unsigned char *) buffer,
|
(unsigned char *) buffer,
|
||||||
sizeof(buffer));
|
sizeof(buffer));
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
LOGD("Read string: libusb error: %s", libusb_strerror(result));
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// generic circular buffer (bounded queue) implementation
|
// generic circular buffer (bounded queue) implementation
|
||||||
#ifndef SC_CBUF_H
|
#ifndef CBUF_H
|
||||||
#define SC_CBUF_H
|
#define CBUF_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef SC_NET_H
|
#ifndef NET_H
|
||||||
#define SC_NET_H
|
#define NET_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "adb/adb_device.h"
|
#include "adb/adb_device.h"
|
||||||
#include "adb/adb_parser.h"
|
#include "adb/adb_parser.h"
|
||||||
|
|
||||||
static void test_adb_devices(void) {
|
static void test_adb_devices() {
|
||||||
char output[] =
|
char output[] =
|
||||||
"List of devices attached\n"
|
"List of devices attached\n"
|
||||||
"0123456789abcdef device usb:2-1 product:MyProduct model:MyModel "
|
"0123456789abcdef device usb:2-1 product:MyProduct model:MyModel "
|
||||||
@@ -31,7 +31,7 @@ static void test_adb_devices(void) {
|
|||||||
sc_adb_devices_destroy(&vec);
|
sc_adb_devices_destroy(&vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_adb_devices_cr(void) {
|
static void test_adb_devices_cr() {
|
||||||
char output[] =
|
char output[] =
|
||||||
"List of devices attached\r\n"
|
"List of devices attached\r\n"
|
||||||
"0123456789abcdef device usb:2-1 product:MyProduct model:MyModel "
|
"0123456789abcdef device usb:2-1 product:MyProduct model:MyModel "
|
||||||
@@ -57,7 +57,7 @@ static void test_adb_devices_cr(void) {
|
|||||||
sc_adb_devices_destroy(&vec);
|
sc_adb_devices_destroy(&vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_adb_devices_daemon_start(void) {
|
static void test_adb_devices_daemon_start() {
|
||||||
char output[] =
|
char output[] =
|
||||||
"* daemon not running; starting now at tcp:5037\n"
|
"* daemon not running; starting now at tcp:5037\n"
|
||||||
"* daemon started successfully\n"
|
"* daemon started successfully\n"
|
||||||
@@ -78,7 +78,7 @@ static void test_adb_devices_daemon_start(void) {
|
|||||||
sc_adb_devices_destroy(&vec);
|
sc_adb_devices_destroy(&vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_adb_devices_daemon_start_mixed(void) {
|
static void test_adb_devices_daemon_start_mixed() {
|
||||||
char output[] =
|
char output[] =
|
||||||
"List of devices attached\n"
|
"List of devices attached\n"
|
||||||
"adb server version (41) doesn't match this client (39); killing...\n"
|
"adb server version (41) doesn't match this client (39); killing...\n"
|
||||||
@@ -105,7 +105,7 @@ static void test_adb_devices_daemon_start_mixed(void) {
|
|||||||
sc_adb_devices_destroy(&vec);
|
sc_adb_devices_destroy(&vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_adb_devices_without_eol(void) {
|
static void test_adb_devices_without_eol() {
|
||||||
char output[] =
|
char output[] =
|
||||||
"List of devices attached\n"
|
"List of devices attached\n"
|
||||||
"0123456789abcdef device usb:2-1 product:MyProduct model:MyModel "
|
"0123456789abcdef device usb:2-1 product:MyProduct model:MyModel "
|
||||||
@@ -124,7 +124,7 @@ static void test_adb_devices_without_eol(void) {
|
|||||||
sc_adb_devices_destroy(&vec);
|
sc_adb_devices_destroy(&vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_adb_devices_without_header(void) {
|
static void test_adb_devices_without_header() {
|
||||||
char output[] =
|
char output[] =
|
||||||
"0123456789abcdef device usb:2-1 product:MyProduct model:MyModel "
|
"0123456789abcdef device usb:2-1 product:MyProduct model:MyModel "
|
||||||
"device:MyDevice transport_id:1\n";
|
"device:MyDevice transport_id:1\n";
|
||||||
@@ -134,7 +134,7 @@ static void test_adb_devices_without_header(void) {
|
|||||||
assert(!ok);
|
assert(!ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_adb_devices_corrupted(void) {
|
static void test_adb_devices_corrupted() {
|
||||||
char output[] =
|
char output[] =
|
||||||
"List of devices attached\n"
|
"List of devices attached\n"
|
||||||
"corrupted_garbage\n";
|
"corrupted_garbage\n";
|
||||||
@@ -145,7 +145,7 @@ static void test_adb_devices_corrupted(void) {
|
|||||||
assert(vec.size == 0);
|
assert(vec.size == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_adb_devices_spaces(void) {
|
static void test_adb_devices_spaces() {
|
||||||
char output[] =
|
char output[] =
|
||||||
"List of devices attached\n"
|
"List of devices attached\n"
|
||||||
"0123456789abcdef unauthorized usb:1-4 transport_id:3\n";
|
"0123456789abcdef unauthorized usb:1-4 transport_id:3\n";
|
||||||
@@ -163,81 +163,81 @@ static void test_adb_devices_spaces(void) {
|
|||||||
sc_adb_devices_destroy(&vec);
|
sc_adb_devices_destroy(&vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_get_ip_single_line(void) {
|
static void test_get_ip_single_line() {
|
||||||
char ip_route[] = "192.168.1.0/24 dev wlan0 proto kernel scope link src "
|
char ip_route[] = "192.168.1.0/24 dev wlan0 proto kernel scope link src "
|
||||||
"192.168.12.34\r\r\n";
|
"192.168.12.34\r\r\n";
|
||||||
|
|
||||||
char *ip = sc_adb_parse_device_ip(ip_route);
|
char *ip = sc_adb_parse_device_ip_from_output(ip_route);
|
||||||
assert(ip);
|
assert(ip);
|
||||||
assert(!strcmp(ip, "192.168.12.34"));
|
assert(!strcmp(ip, "192.168.12.34"));
|
||||||
free(ip);
|
free(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_get_ip_single_line_without_eol(void) {
|
static void test_get_ip_single_line_without_eol() {
|
||||||
char ip_route[] = "192.168.1.0/24 dev wlan0 proto kernel scope link src "
|
char ip_route[] = "192.168.1.0/24 dev wlan0 proto kernel scope link src "
|
||||||
"192.168.12.34";
|
"192.168.12.34";
|
||||||
|
|
||||||
char *ip = sc_adb_parse_device_ip(ip_route);
|
char *ip = sc_adb_parse_device_ip_from_output(ip_route);
|
||||||
assert(ip);
|
assert(ip);
|
||||||
assert(!strcmp(ip, "192.168.12.34"));
|
assert(!strcmp(ip, "192.168.12.34"));
|
||||||
free(ip);
|
free(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_get_ip_single_line_with_trailing_space(void) {
|
static void test_get_ip_single_line_with_trailing_space() {
|
||||||
char ip_route[] = "192.168.1.0/24 dev wlan0 proto kernel scope link src "
|
char ip_route[] = "192.168.1.0/24 dev wlan0 proto kernel scope link src "
|
||||||
"192.168.12.34 \n";
|
"192.168.12.34 \n";
|
||||||
|
|
||||||
char *ip = sc_adb_parse_device_ip(ip_route);
|
char *ip = sc_adb_parse_device_ip_from_output(ip_route);
|
||||||
assert(ip);
|
assert(ip);
|
||||||
assert(!strcmp(ip, "192.168.12.34"));
|
assert(!strcmp(ip, "192.168.12.34"));
|
||||||
free(ip);
|
free(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_get_ip_multiline_first_ok(void) {
|
static void test_get_ip_multiline_first_ok() {
|
||||||
char ip_route[] = "192.168.1.0/24 dev wlan0 proto kernel scope link src "
|
char ip_route[] = "192.168.1.0/24 dev wlan0 proto kernel scope link src "
|
||||||
"192.168.1.2\r\n"
|
"192.168.1.2\r\n"
|
||||||
"10.0.0.0/24 dev rmnet proto kernel scope link src "
|
"10.0.0.0/24 dev rmnet proto kernel scope link src "
|
||||||
"10.0.0.2\r\n";
|
"10.0.0.2\r\n";
|
||||||
|
|
||||||
char *ip = sc_adb_parse_device_ip(ip_route);
|
char *ip = sc_adb_parse_device_ip_from_output(ip_route);
|
||||||
assert(ip);
|
assert(ip);
|
||||||
assert(!strcmp(ip, "192.168.1.2"));
|
assert(!strcmp(ip, "192.168.1.2"));
|
||||||
free(ip);
|
free(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_get_ip_multiline_second_ok(void) {
|
static void test_get_ip_multiline_second_ok() {
|
||||||
char ip_route[] = "10.0.0.0/24 dev rmnet proto kernel scope link src "
|
char ip_route[] = "10.0.0.0/24 dev rmnet proto kernel scope link src "
|
||||||
"10.0.0.3\r\n"
|
"10.0.0.3\r\n"
|
||||||
"192.168.1.0/24 dev wlan0 proto kernel scope link src "
|
"192.168.1.0/24 dev wlan0 proto kernel scope link src "
|
||||||
"192.168.1.3\r\n";
|
"192.168.1.3\r\n";
|
||||||
|
|
||||||
char *ip = sc_adb_parse_device_ip(ip_route);
|
char *ip = sc_adb_parse_device_ip_from_output(ip_route);
|
||||||
assert(ip);
|
assert(ip);
|
||||||
assert(!strcmp(ip, "192.168.1.3"));
|
assert(!strcmp(ip, "192.168.1.3"));
|
||||||
free(ip);
|
free(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_get_ip_no_wlan(void) {
|
static void test_get_ip_no_wlan() {
|
||||||
char ip_route[] = "192.168.1.0/24 dev rmnet proto kernel scope link src "
|
char ip_route[] = "192.168.1.0/24 dev rmnet proto kernel scope link src "
|
||||||
"192.168.12.34\r\r\n";
|
"192.168.12.34\r\r\n";
|
||||||
|
|
||||||
char *ip = sc_adb_parse_device_ip(ip_route);
|
char *ip = sc_adb_parse_device_ip_from_output(ip_route);
|
||||||
assert(!ip);
|
assert(!ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_get_ip_no_wlan_without_eol(void) {
|
static void test_get_ip_no_wlan_without_eol() {
|
||||||
char ip_route[] = "192.168.1.0/24 dev rmnet proto kernel scope link src "
|
char ip_route[] = "192.168.1.0/24 dev rmnet proto kernel scope link src "
|
||||||
"192.168.12.34";
|
"192.168.12.34";
|
||||||
|
|
||||||
char *ip = sc_adb_parse_device_ip(ip_route);
|
char *ip = sc_adb_parse_device_ip_from_output(ip_route);
|
||||||
assert(!ip);
|
assert(!ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_get_ip_truncated(void) {
|
static void test_get_ip_truncated() {
|
||||||
char ip_route[] = "192.168.1.0/24 dev rmnet proto kernel scope link src "
|
char ip_route[] = "192.168.1.0/24 dev rmnet proto kernel scope link src "
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
char *ip = sc_adb_parse_device_ip(ip_route);
|
char *ip = sc_adb_parse_device_ip_from_output(ip_route);
|
||||||
assert(!ip);
|
assert(!ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,6 +262,4 @@ int main(int argc, char *argv[]) {
|
|||||||
test_get_ip_no_wlan();
|
test_get_ip_no_wlan();
|
||||||
test_get_ip_no_wlan_without_eol();
|
test_get_ip_no_wlan_without_eol();
|
||||||
test_get_ip_truncated();
|
test_get_ip_truncated();
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,6 @@ ffmpeg_avcodec = 'avcodec-58'
|
|||||||
ffmpeg_avformat = 'avformat-58'
|
ffmpeg_avformat = 'avformat-58'
|
||||||
ffmpeg_avutil = 'avutil-56'
|
ffmpeg_avutil = 'avutil-56'
|
||||||
prebuilt_ffmpeg = 'ffmpeg-win32-4.3.1'
|
prebuilt_ffmpeg = 'ffmpeg-win32-4.3.1'
|
||||||
prebuilt_sdl2 = 'SDL2-2.0.22/i686-w64-mingw32'
|
prebuilt_sdl2 = 'SDL2-2.0.20/i686-w64-mingw32'
|
||||||
prebuilt_libusb_root = 'libusb-1.0.26'
|
prebuilt_libusb_root = 'libusb-1.0.25'
|
||||||
prebuilt_libusb = prebuilt_libusb_root + '/MinGW-Win32'
|
prebuilt_libusb = prebuilt_libusb_root + '/MinGW32'
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ 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-win64-5.0.1'
|
prebuilt_ffmpeg = 'ffmpeg-win64-5.0'
|
||||||
prebuilt_sdl2 = 'SDL2-2.0.22/x86_64-w64-mingw32'
|
prebuilt_sdl2 = 'SDL2-2.0.20/x86_64-w64-mingw32'
|
||||||
prebuilt_libusb_root = 'libusb-1.0.26'
|
prebuilt_libusb_root = 'libusb-1.0.25'
|
||||||
prebuilt_libusb = prebuilt_libusb_root + '/MinGW-x64'
|
prebuilt_libusb = prebuilt_libusb_root + '/MinGW64'
|
||||||
|
|||||||
@@ -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.24/scrcpy-server-v1.24
|
PREBUILT_SERVER_URL=https://github.com/Genymobile/scrcpy/releases/download/v1.23/scrcpy-server-v1.23
|
||||||
PREBUILT_SERVER_SHA256=ae74a81ea79c0dc7250e586627c278c0a9a8c5de46c9fb5c38c167fb1a36f056
|
PREBUILT_SERVER_SHA256=2a913fd47478c0b306fca507cb0beb625e49a19ff9fc7ab904e36ef5b9fe7e68
|
||||||
|
|
||||||
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,5 +1,5 @@
|
|||||||
project('scrcpy', 'c',
|
project('scrcpy', 'c',
|
||||||
version: '1.24',
|
version: '1.23',
|
||||||
meson_version: '>= 0.48',
|
meson_version: '>= 0.48',
|
||||||
default_options: [
|
default_options: [
|
||||||
'c_std=c11',
|
'c_std=c11',
|
||||||
|
|||||||
32
release.mk
32
release.mk
@@ -75,10 +75,12 @@ prepare-deps-win64:
|
|||||||
@app/prebuilt-deps/prepare-libusb.sh
|
@app/prebuilt-deps/prepare-libusb.sh
|
||||||
|
|
||||||
build-win32: prepare-deps-win32
|
build-win32: prepare-deps-win32
|
||||||
|
# -Dusb=false because of libusb-win32 build issue, cf #3011
|
||||||
[ -d "$(WIN32_BUILD_DIR)" ] || ( mkdir "$(WIN32_BUILD_DIR)" && \
|
[ -d "$(WIN32_BUILD_DIR)" ] || ( mkdir "$(WIN32_BUILD_DIR)" && \
|
||||||
meson "$(WIN32_BUILD_DIR)" \
|
meson "$(WIN32_BUILD_DIR)" \
|
||||||
--cross-file cross_win32.txt \
|
--cross-file cross_win32.txt \
|
||||||
--buildtype release --strip -Db_lto=true \
|
--buildtype release --strip -Db_lto=true \
|
||||||
|
-Dusb=false \
|
||||||
-Dcompile_server=false \
|
-Dcompile_server=false \
|
||||||
-Dportable=true )
|
-Dportable=true )
|
||||||
ninja -C "$(WIN32_BUILD_DIR)"
|
ninja -C "$(WIN32_BUILD_DIR)"
|
||||||
@@ -105,11 +107,11 @@ dist-win32: build-server build-win32
|
|||||||
cp app/prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/avformat-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/avformat-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/swresample-3.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/swresample-3.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/swscale-5.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/ffmpeg-win32-4.3.1/bin/swscale-5.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/platform-tools-33.0.1/adb.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/platform-tools-31.0.3/adb.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/platform-tools-33.0.1/AdbWinApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/platform-tools-31.0.3/AdbWinApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/platform-tools-33.0.1/AdbWinUsbApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/platform-tools-31.0.3/AdbWinUsbApi.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/SDL2-2.0.22/i686-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/SDL2-2.0.20/i686-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/libusb-1.0.26/MinGW-Win32/msys-usb-1.0.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
|
#cp app/prebuilt-deps/data/libusb-1.0.25/MinGW32/dll/libusb-1.0.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)"
|
||||||
@@ -119,16 +121,16 @@ dist-win64: build-server build-win64
|
|||||||
cp app/data/scrcpy-noconsole.vbs "$(DIST)/$(WIN64_TARGET_DIR)"
|
cp app/data/scrcpy-noconsole.vbs "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||||
cp app/data/icon.png "$(DIST)/$(WIN64_TARGET_DIR)"
|
cp app/data/icon.png "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||||
cp app/data/open_a_terminal_here.bat "$(DIST)/$(WIN64_TARGET_DIR)"
|
cp app/data/open_a_terminal_here.bat "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||||
cp app/prebuilt-deps/data/ffmpeg-win64-5.0.1/bin/avutil-57.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/ffmpeg-win64-5.0/bin/avutil-57.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/ffmpeg-win64-5.0.1/bin/avcodec-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/ffmpeg-win64-5.0/bin/avcodec-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/ffmpeg-win64-5.0.1/bin/avformat-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/ffmpeg-win64-5.0/bin/avformat-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/ffmpeg-win64-5.0.1/bin/swresample-4.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/ffmpeg-win64-5.0/bin/swresample-4.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/ffmpeg-win64-5.0.1/bin/swscale-6.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/ffmpeg-win64-5.0/bin/swscale-6.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/platform-tools-33.0.1/adb.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/platform-tools-31.0.3/adb.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/platform-tools-33.0.1/AdbWinApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/platform-tools-31.0.3/AdbWinApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/platform-tools-33.0.1/AdbWinUsbApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/platform-tools-31.0.3/AdbWinUsbApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/SDL2-2.0.22/x86_64-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/SDL2-2.0.20/x86_64-w64-mingw32/bin/SDL2.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
cp app/prebuilt-deps/data/libusb-1.0.26/MinGW-x64/msys-usb-1.0.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
cp app/prebuilt-deps/data/libusb-1.0.25/MinGW64/dll/libusb-1.0.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
|
||||||
|
|
||||||
zip-win32: dist-win32
|
zip-win32: dist-win32
|
||||||
cd "$(DIST)/$(WIN32_TARGET_DIR)"; \
|
cd "$(DIST)/$(WIN32_TARGET_DIR)"; \
|
||||||
|
|||||||
2
run
2
run
@@ -20,6 +20,6 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SCRCPY_ICON_PATH="app/data/icon.png" \
|
SCRCPY_ICON_PATH="data/icon.png" \
|
||||||
SCRCPY_SERVER_PATH="$BUILDDIR/server/scrcpy-server" \
|
SCRCPY_SERVER_PATH="$BUILDDIR/server/scrcpy-server" \
|
||||||
"$BUILDDIR/app/scrcpy" "$@"
|
"$BUILDDIR/app/scrcpy" "$@"
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ android {
|
|||||||
applicationId "com.genymobile.scrcpy"
|
applicationId "com.genymobile.scrcpy"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 31
|
targetSdkVersion 31
|
||||||
versionCode 12400
|
versionCode 12300
|
||||||
versionName "1.24"
|
versionName "1.23"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
@@ -19,6 +19,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
testImplementation 'junit:junit:4.13.1'
|
testImplementation 'junit:junit:4.13.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
SCRCPY_DEBUG=false
|
SCRCPY_DEBUG=false
|
||||||
SCRCPY_VERSION_NAME=1.24
|
SCRCPY_VERSION_NAME=1.23
|
||||||
|
|
||||||
PLATFORM=${ANDROID_PLATFORM:-31}
|
PLATFORM=${ANDROID_PLATFORM:-31}
|
||||||
BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-31.0.0}
|
BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-31.0.0}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ public class Controller {
|
|||||||
private final DesktopConnection connection;
|
private final DesktopConnection connection;
|
||||||
private final DeviceMessageSender sender;
|
private final DeviceMessageSender sender;
|
||||||
private final boolean clipboardAutosync;
|
private final boolean clipboardAutosync;
|
||||||
private final boolean powerOn;
|
|
||||||
|
|
||||||
private final KeyCharacterMap charMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
|
private final KeyCharacterMap charMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
|
||||||
|
|
||||||
@@ -33,11 +32,10 @@ public class Controller {
|
|||||||
|
|
||||||
private boolean keepPowerModeOff;
|
private boolean keepPowerModeOff;
|
||||||
|
|
||||||
public Controller(Device device, DesktopConnection connection, boolean clipboardAutosync, boolean powerOn) {
|
public Controller(Device device, DesktopConnection connection, boolean clipboardAutosync) {
|
||||||
this.device = device;
|
this.device = device;
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
this.clipboardAutosync = clipboardAutosync;
|
this.clipboardAutosync = clipboardAutosync;
|
||||||
this.powerOn = powerOn;
|
|
||||||
initPointers();
|
initPointers();
|
||||||
sender = new DeviceMessageSender(connection);
|
sender = new DeviceMessageSender(connection);
|
||||||
}
|
}
|
||||||
@@ -58,7 +56,7 @@ public class Controller {
|
|||||||
|
|
||||||
public void control() throws IOException {
|
public void control() throws IOException {
|
||||||
// on start, power on the device
|
// on start, power on the device
|
||||||
if (powerOn && !Device.isScreenOn()) {
|
if (!Device.isScreenOn()) {
|
||||||
device.pressReleaseKeycode(KeyEvent.KEYCODE_POWER, Device.INJECT_MODE_ASYNC);
|
device.pressReleaseKeycode(KeyEvent.KEYCODE_POWER, Device.INJECT_MODE_ASYNC);
|
||||||
|
|
||||||
// dirty hack
|
// dirty hack
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ public class Options {
|
|||||||
private boolean clipboardAutosync = true;
|
private boolean clipboardAutosync = true;
|
||||||
private boolean downsizeOnError = true;
|
private boolean downsizeOnError = true;
|
||||||
private boolean cleanup = true;
|
private boolean cleanup = true;
|
||||||
private boolean powerOn = true;
|
|
||||||
|
|
||||||
// Options not used by the scrcpy client, but useful to use scrcpy-server directly
|
// Options not used by the scrcpy client, but useful to use scrcpy-server directly
|
||||||
private boolean sendDeviceMeta = true; // send device name and size
|
private boolean sendDeviceMeta = true; // send device name and size
|
||||||
@@ -165,14 +164,6 @@ public class Options {
|
|||||||
this.cleanup = cleanup;
|
this.cleanup = cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getPowerOn() {
|
|
||||||
return powerOn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPowerOn(boolean powerOn) {
|
|
||||||
this.powerOn = powerOn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getSendDeviceMeta() {
|
public boolean getSendDeviceMeta() {
|
||||||
return sendDeviceMeta;
|
return sendDeviceMeta;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public final class Server {
|
|||||||
Thread controllerThread = null;
|
Thread controllerThread = null;
|
||||||
Thread deviceMessageSenderThread = null;
|
Thread deviceMessageSenderThread = null;
|
||||||
if (control) {
|
if (control) {
|
||||||
final Controller controller = new Controller(device, connection, options.getClipboardAutosync(), options.getPowerOn());
|
final Controller controller = new Controller(device, connection, options.getClipboardAutosync());
|
||||||
|
|
||||||
// asynchronous
|
// asynchronous
|
||||||
controllerThread = startController(controller);
|
controllerThread = startController(controller);
|
||||||
@@ -248,10 +248,6 @@ public final class Server {
|
|||||||
boolean cleanup = Boolean.parseBoolean(value);
|
boolean cleanup = Boolean.parseBoolean(value);
|
||||||
options.setCleanup(cleanup);
|
options.setCleanup(cleanup);
|
||||||
break;
|
break;
|
||||||
case "power_on":
|
|
||||||
boolean powerOn = Boolean.parseBoolean(value);
|
|
||||||
options.setPowerOn(powerOn);
|
|
||||||
break;
|
|
||||||
case "send_device_meta":
|
case "send_device_meta":
|
||||||
boolean sendDeviceMeta = Boolean.parseBoolean(value);
|
boolean sendDeviceMeta = Boolean.parseBoolean(value);
|
||||||
options.setSendDeviceMeta(sendDeviceMeta);
|
options.setSendDeviceMeta(sendDeviceMeta);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.genymobile.scrcpy.wrappers;
|
|||||||
|
|
||||||
import com.genymobile.scrcpy.Ln;
|
import com.genymobile.scrcpy.Ln;
|
||||||
|
|
||||||
|
import android.os.IInterface;
|
||||||
import android.view.InputEvent;
|
import android.view.InputEvent;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@@ -13,18 +14,24 @@ public final class InputManager {
|
|||||||
public static final int INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT = 1;
|
public static final int INJECT_INPUT_EVENT_MODE_WAIT_FOR_RESULT = 1;
|
||||||
public static final int INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH = 2;
|
public static final int INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH = 2;
|
||||||
|
|
||||||
private final android.hardware.input.InputManager manager;
|
private final IInterface manager;
|
||||||
private Method injectInputEventMethod;
|
private Method injectInputEventMethod;
|
||||||
|
private boolean alternativeInjectInputEventMethod;
|
||||||
|
|
||||||
private static Method setDisplayIdMethod;
|
private static Method setDisplayIdMethod;
|
||||||
|
|
||||||
public InputManager(android.hardware.input.InputManager manager) {
|
public InputManager(IInterface manager) {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Method getInjectInputEventMethod() throws NoSuchMethodException {
|
private Method getInjectInputEventMethod() throws NoSuchMethodException {
|
||||||
if (injectInputEventMethod == null) {
|
if (injectInputEventMethod == null) {
|
||||||
injectInputEventMethod = manager.getClass().getMethod("injectInputEvent", InputEvent.class, int.class);
|
try {
|
||||||
|
injectInputEventMethod = manager.getClass().getMethod("injectInputEvent", InputEvent.class, int.class);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
injectInputEventMethod = manager.getClass().getMethod("injectInputEvent", InputEvent.class, int.class, int.class);
|
||||||
|
alternativeInjectInputEventMethod = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return injectInputEventMethod;
|
return injectInputEventMethod;
|
||||||
}
|
}
|
||||||
@@ -32,6 +39,10 @@ public final class InputManager {
|
|||||||
public boolean injectInputEvent(InputEvent inputEvent, int mode) {
|
public boolean injectInputEvent(InputEvent inputEvent, int mode) {
|
||||||
try {
|
try {
|
||||||
Method method = getInjectInputEventMethod();
|
Method method = getInjectInputEventMethod();
|
||||||
|
if (alternativeInjectInputEventMethod) {
|
||||||
|
// See <https://github.com/Genymobile/scrcpy/issues/2250>
|
||||||
|
return (boolean) method.invoke(manager, inputEvent, mode, 0);
|
||||||
|
}
|
||||||
return (boolean) method.invoke(manager, inputEvent, mode);
|
return (boolean) method.invoke(manager, inputEvent, mode);
|
||||||
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
|
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
|
||||||
Ln.e("Could not invoke method", e);
|
Ln.e("Could not invoke method", e);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import android.annotation.SuppressLint;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.IInterface;
|
import android.os.IInterface;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
@SuppressLint("PrivateApi,DiscouragedPrivateApi")
|
@SuppressLint("PrivateApi,DiscouragedPrivateApi")
|
||||||
@@ -57,13 +56,7 @@ public final class ServiceManager {
|
|||||||
|
|
||||||
public InputManager getInputManager() {
|
public InputManager getInputManager() {
|
||||||
if (inputManager == null) {
|
if (inputManager == null) {
|
||||||
try {
|
inputManager = new InputManager(getService("input", "android.hardware.input.IInputManager"));
|
||||||
Method getInstanceMethod = android.hardware.input.InputManager.class.getDeclaredMethod("getInstance");
|
|
||||||
android.hardware.input.InputManager im = (android.hardware.input.InputManager) getInstanceMethod.invoke(null);
|
|
||||||
inputManager = new InputManager(im);
|
|
||||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
|
||||||
throw new AssertionError(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return inputManager;
|
return inputManager;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user