Compare commits
1 Commits
exit_code
...
zsh_comple
Author | SHA1 | Date | |
---|---|---|---|
e393cc36f6 |
6
BUILD.md
6
BUILD.md
@ -272,10 +272,10 @@ install` must be run as root)._
|
||||
|
||||
#### Option 2: Use prebuilt server
|
||||
|
||||
- [`scrcpy-server-v1.23`][direct-scrcpy-server]
|
||||
_(SHA-256: 2a913fd47478c0b306fca507cb0beb625e49a19ff9fc7ab904e36ef5b9fe7e68)_
|
||||
- [`scrcpy-server-v1.22`][direct-scrcpy-server]
|
||||
_(SHA-256: c05d273eec7533c0e106282e0254cf04e7f5e8f0c2920ca39448865fab2a419b)_
|
||||
|
||||
[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.23/scrcpy-server-v1.23
|
||||
[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.22/scrcpy-server-v1.22
|
||||
|
||||
Download the prebuilt server somewhere, and specify its path during the Meson
|
||||
configuration:
|
||||
|
88
FAQ.md
88
FAQ.md
@ -4,16 +4,23 @@
|
||||
|
||||
Here are the common reported problems and their status.
|
||||
|
||||
If you encounter any error, the first step is to upgrade to the latest version.
|
||||
|
||||
|
||||
## `adb` issues
|
||||
|
||||
`scrcpy` execute `adb` commands to initialize the connection with the device. If
|
||||
`adb` fails, then scrcpy will not work.
|
||||
|
||||
In that case, it will print this error:
|
||||
|
||||
> ERROR: "adb get-serialno" returned with value 1
|
||||
|
||||
This is typically not a bug in _scrcpy_, but a problem in your environment.
|
||||
|
||||
To find out the cause, execute:
|
||||
|
||||
```bash
|
||||
adb devices
|
||||
```
|
||||
|
||||
### `adb` not found
|
||||
|
||||
@ -23,30 +30,13 @@ On Windows, the current directory is in your `PATH`, and `adb.exe` is included
|
||||
in the release, so it should work out-of-the-box.
|
||||
|
||||
|
||||
### Device not detected
|
||||
|
||||
> ERROR: Could not find any ADB device
|
||||
|
||||
Check that you correctly enabled [adb debugging][enable-adb].
|
||||
|
||||
Your device must be detected by `adb`:
|
||||
|
||||
```
|
||||
adb devices
|
||||
```
|
||||
|
||||
If your device is not detected, you may need some [drivers] (on Windows). There is a separate [USB driver for Google devices][google-usb-driver].
|
||||
|
||||
[enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling
|
||||
[drivers]: https://developer.android.com/studio/run/oem-usb.html
|
||||
[google-usb-driver]: https://developer.android.com/studio/run/win-usb
|
||||
|
||||
|
||||
### Device unauthorized
|
||||
|
||||
> ERROR: Device is unauthorized:
|
||||
> ERROR: --> (usb) 0123456789abcdef unauthorized
|
||||
> ERROR: A popup should open on the device to request authorization.
|
||||
|
||||
> error: device unauthorized.
|
||||
> This adb server's $ADB_VENDOR_KEYS is not set
|
||||
> Try 'adb kill-server' if that seems wrong.
|
||||
> Otherwise check for a confirmation dialog on your device.
|
||||
|
||||
When connecting, a popup should open on the device. You must authorize USB
|
||||
debugging.
|
||||
@ -56,27 +46,29 @@ If it does not open, check [stackoverflow][device-unauthorized].
|
||||
[device-unauthorized]: https://stackoverflow.com/questions/23081263/adb-android-device-unauthorized
|
||||
|
||||
|
||||
### Device not detected
|
||||
|
||||
> error: no devices/emulators found
|
||||
|
||||
Check that you correctly enabled [adb debugging][enable-adb].
|
||||
|
||||
If your device is not detected, you may need some [drivers] (on Windows). There is a separate [USB driver for Google devices][google-usb-driver].
|
||||
|
||||
[enable-adb]: https://developer.android.com/studio/command-line/adb.html#Enabling
|
||||
[drivers]: https://developer.android.com/studio/run/oem-usb.html
|
||||
[google-usb-driver]: https://developer.android.com/studio/run/win-usb
|
||||
|
||||
|
||||
### Several devices connected
|
||||
|
||||
If several devices are connected, you will encounter this error:
|
||||
|
||||
ERROR: Multiple (2) ADB devices:
|
||||
ERROR: --> (usb) 0123456789abcdef device Nexus_5
|
||||
ERROR: --> (tcpip) 192.168.1.5:5555 device GM1913
|
||||
ERROR: Select a device via -s (--serial), -d (--select-usb) or -e (--select-tcpip)
|
||||
> error: more than one device/emulator
|
||||
|
||||
In that case, you can either provide the identifier of the device you want to
|
||||
mirror:
|
||||
the identifier of the device you want to mirror must be provided:
|
||||
|
||||
```bash
|
||||
scrcpy -s 0123456789abcdef
|
||||
```
|
||||
|
||||
Or request the single USB (or TCP/IP) device:
|
||||
|
||||
```bash
|
||||
scrcpy -d # USB device
|
||||
scrcpy -e # TCP/IP device
|
||||
scrcpy -s 01234567890abcdef
|
||||
```
|
||||
|
||||
Note that if your device is connected over TCP/IP, you might get this message:
|
||||
@ -158,24 +150,22 @@ screen, then you might get poor quality, especially visible on text (see [#40]).
|
||||
|
||||
[#40]: https://github.com/Genymobile/scrcpy/issues/40
|
||||
|
||||
This problem should be fixed in scrcpy v1.22: **update to the latest version**.
|
||||
To improve downscaling quality, trilinear filtering is enabled automatically
|
||||
if the renderer is OpenGL and if it supports mipmapping.
|
||||
|
||||
On older versions, you must configure the [scaling behavior]:
|
||||
On Windows, you might want to force OpenGL:
|
||||
|
||||
```
|
||||
scrcpy --render-driver=opengl
|
||||
```
|
||||
|
||||
You may also need to configure the [scaling behavior]:
|
||||
|
||||
> `scrcpy.exe` > Properties > Compatibility > Change high DPI settings >
|
||||
> Override high DPI scaling behavior > Scaling performed by: _Application_.
|
||||
|
||||
[scaling behavior]: https://github.com/Genymobile/scrcpy/issues/40#issuecomment-424466723
|
||||
|
||||
Also, to improve downscaling quality, trilinear filtering is enabled
|
||||
automatically if the renderer is OpenGL and if it supports mipmapping.
|
||||
|
||||
On Windows, you might want to force OpenGL to enable mipmapping:
|
||||
|
||||
```
|
||||
scrcpy --render-driver=opengl
|
||||
```
|
||||
|
||||
|
||||
### Issue with Wayland
|
||||
|
||||
|
1016
README.de.md
1016
README.de.md
File diff suppressed because it is too large
Load Diff
70
README.md
70
README.md
@ -1,6 +1,6 @@
|
||||
# scrcpy (v1.23)
|
||||
# scrcpy (v1.22)
|
||||
|
||||
<img src="app/data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
||||
<img src="data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
||||
|
||||
_pronounced "**scr**een **c**o**py**"_
|
||||
|
||||
@ -32,8 +32,10 @@ Its features include:
|
||||
- [configurable quality](#capture-configuration)
|
||||
- device screen [as a webcam (V4L2)](#v4l2loopback) (Linux-only)
|
||||
- [physical keyboard simulation (HID)](#physical-keyboard-simulation-hid)
|
||||
(Linux-only)
|
||||
- [physical mouse simulation (HID)](#physical-mouse-simulation-hid)
|
||||
- [OTG mode](#otg)
|
||||
(Linux-only)
|
||||
- [OTG mode](#otg) (Linux-only)
|
||||
- and more…
|
||||
|
||||
## Requirements
|
||||
@ -106,10 +108,10 @@ process][BUILD_simple]).
|
||||
For Windows, for simplicity, a prebuilt archive with all the dependencies
|
||||
(including `adb`) is available:
|
||||
|
||||
- [`scrcpy-win64-v1.23.zip`][direct-win64]
|
||||
_(SHA-256: d2f601b1d0157faf65153d8a093d827fd65aec5d5842d677ac86fb2b5b7704cc)_
|
||||
- [`scrcpy-win64-v1.22.zip`][direct-win64]
|
||||
_(SHA-256: ce4d9b8cc761e29862c4a72d8ad6f538bdd1f1831d15fd1f36633cd3b403db82)_
|
||||
|
||||
[direct-win64]: https://github.com/Genymobile/scrcpy/releases/download/v1.23/scrcpy-win64-v1.23.zip
|
||||
[direct-win64]: https://github.com/Genymobile/scrcpy/releases/download/v1.22/scrcpy-win64-v1.22.zip
|
||||
|
||||
It is also available in [Chocolatey]:
|
||||
|
||||
@ -404,30 +406,18 @@ connect to the device before starting.
|
||||
Alternatively, it is possible to enable the TCP/IP connection manually using
|
||||
`adb`:
|
||||
|
||||
1. Plug the device into a USB port on your computer.
|
||||
2. Connect the device to the same Wi-Fi network as your computer.
|
||||
3. Get your device IP address, in Settings → About phone → Status, or by
|
||||
1. Connect the device to the same Wi-Fi as your computer.
|
||||
2. Get your device IP address, in Settings → About phone → Status, or by
|
||||
executing this command:
|
||||
|
||||
```bash
|
||||
adb shell ip route | awk '{print $9}'
|
||||
```
|
||||
|
||||
4. Enable adb over TCP/IP on your device: `adb tcpip 5555`.
|
||||
5. Unplug your device.
|
||||
6. Connect to your device: `adb connect DEVICE_IP:5555` _(replace `DEVICE_IP`
|
||||
with the device IP address you found)_.
|
||||
7. Run `scrcpy` as usual.
|
||||
|
||||
Since Android 11, a [Wireless debugging option][adb-wireless] allows to bypass
|
||||
having to physically connect your device directly to your computer.
|
||||
|
||||
[adb-wireless]: https://developer.android.com/studio/command-line/adb#connect-to-a-device-over-wi-fi-android-11+
|
||||
|
||||
If the connection randomly drops, run your `scrcpy` command to reconnect. If it
|
||||
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
|
||||
none found, try running `adb disconnect` and then run those two commands again.
|
||||
3. Enable adb over TCP/IP on your device: `adb tcpip 5555`.
|
||||
4. Unplug your device.
|
||||
5. Connect to your device: `adb connect DEVICE_IP:5555` _(replace `DEVICE_IP`)_.
|
||||
6. Run `scrcpy` as usual.
|
||||
|
||||
It may be useful to decrease the bit-rate and the definition:
|
||||
|
||||
@ -817,17 +807,14 @@ a location inverted through the center of the screen.
|
||||
By default, scrcpy uses Android key or text injection: it works everywhere, but
|
||||
is limited to ASCII.
|
||||
|
||||
Alternatively, scrcpy can simulate a physical USB keyboard on Android to provide
|
||||
a better input experience (using [USB HID over AOAv2][hid-aoav2]): the virtual
|
||||
On Linux, scrcpy can simulate a physical USB keyboard on Android to provide a
|
||||
better input experience (using [USB HID over AOAv2][hid-aoav2]): the virtual
|
||||
keyboard is disabled and it works for all characters and IME.
|
||||
|
||||
[hid-aoav2]: https://source.android.com/devices/accessories/aoa2#hid-support
|
||||
|
||||
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
|
||||
is not possible to open a USB device if it is already open by another process
|
||||
like the adb daemon).
|
||||
However, it only works if the device is connected by USB, and is currently only
|
||||
supported on Linux.
|
||||
|
||||
To enable this mode:
|
||||
|
||||
@ -860,7 +847,8 @@ a physical keyboard is connected).
|
||||
#### Physical mouse simulation (HID)
|
||||
|
||||
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, and
|
||||
is currently only supported on Linux.
|
||||
|
||||
By default, scrcpy uses Android mouse events injection, using absolute
|
||||
coordinates. By simulating a physical mouse, a mouse pointer appears on the
|
||||
@ -913,7 +901,7 @@ scrcpy --otg # keyboard and mouse
|
||||
```
|
||||
|
||||
Like `--hid-keyboard` and `--hid-mouse`, it only works if the device is
|
||||
connected by USB.
|
||||
connected by USB, and is currently only supported on Linux.
|
||||
|
||||
|
||||
#### Text injection preference
|
||||
@ -1105,9 +1093,7 @@ See [BUILD].
|
||||
|
||||
## Common issues
|
||||
|
||||
See the [FAQ].md).
|
||||
|
||||
[FAQ]: FAQ.md
|
||||
See the [FAQ](FAQ.md).
|
||||
|
||||
|
||||
## Developers
|
||||
@ -1142,22 +1128,10 @@ Read the [developers page].
|
||||
[article-intro]: https://blog.rom1v.com/2018/03/introducing-scrcpy/
|
||||
[article-tcpip]: https://www.genymotion.com/blog/open-source-project-scrcpy-now-works-wirelessly/
|
||||
|
||||
## Contact
|
||||
|
||||
If you encounter a bug, please read the [FAQ] first, then open an [issue].
|
||||
|
||||
[issue]: https://github.com/Genymobile/scrcpy/issues
|
||||
|
||||
For general questions or discussions, you could also use:
|
||||
|
||||
- Reddit: [`r/scrcpy`](https://www.reddit.com/r/scrcpy)
|
||||
- Twitter: [`@scrcpy_app`](https://twitter.com/scrcpy_app)
|
||||
|
||||
## Translations
|
||||
|
||||
This README is available in other languages:
|
||||
|
||||
- [Deutsch (German, `de`) - v1.22](README.de.md)
|
||||
- [Indonesian (Indonesia, `id`) - v1.16](README.id.md)
|
||||
- [Italiano (Italiano, `it`) - v1.19](README.it.md)
|
||||
- [日本語 (Japanese, `jp`) - v1.19](README.jp.md)
|
||||
|
@ -1,121 +0,0 @@
|
||||
_scrcpy() {
|
||||
local cur prev words cword
|
||||
local opts="
|
||||
--always-on-top
|
||||
-b --bit-rate=
|
||||
--codec-options=
|
||||
--crop=
|
||||
-d --select-usb
|
||||
--disable-screensaver
|
||||
--display=
|
||||
--display-buffer=
|
||||
-e --select-tcpip
|
||||
--encoder=
|
||||
--force-adb-forward
|
||||
--forward-all-clicks
|
||||
-f --fullscreen
|
||||
-K --hid-keyboard
|
||||
-h --help
|
||||
--legacy-paste
|
||||
--lock-video-orientation
|
||||
--lock-video-orientation=
|
||||
--max-fps=
|
||||
-M --hid-mouse
|
||||
-m --max-size=
|
||||
--no-cleanup
|
||||
--no-clipboard-on-error
|
||||
--no-downsize-on-error
|
||||
-n --no-control
|
||||
-N --no-display
|
||||
--no-key-repeat
|
||||
--no-mipmaps
|
||||
--otg
|
||||
-p --port=
|
||||
--power-off-on-close
|
||||
--prefer-text
|
||||
--print-fps
|
||||
--push-target=
|
||||
--raw-key-events
|
||||
-r --record=
|
||||
--record-format=
|
||||
--render-driver=
|
||||
--rotation=
|
||||
-s --serial=
|
||||
--shortcut-mod=
|
||||
-S --turn-screen-off
|
||||
-t --show-touches
|
||||
--tcpip
|
||||
--tcpip=
|
||||
--tunnel-host=
|
||||
--tunnel-port=
|
||||
--v4l2-buffer=
|
||||
--v4l2-sink=
|
||||
-V --verbosity=
|
||||
-v --version
|
||||
-w --stay-awake
|
||||
--window-borderless
|
||||
--window-title=
|
||||
--window-x=
|
||||
--window-y=
|
||||
--window-width=
|
||||
--window-height="
|
||||
|
||||
_init_completion -s || return
|
||||
|
||||
case "$prev" in
|
||||
--lock-video-orientation)
|
||||
COMPREPLY=($(compgen -W 'unlocked initial 0 1 2 3' -- "$cur"))
|
||||
return
|
||||
;;
|
||||
-r|--record)
|
||||
COMPREPLY=($(compgen -f -- "$cur"))
|
||||
return
|
||||
;;
|
||||
--record-format)
|
||||
COMPREPLY=($(compgen -W 'mkv mp4' -- "$cur"))
|
||||
return
|
||||
;;
|
||||
--render-driver)
|
||||
COMPREPLY=($(compgen -W 'direct3d opengl opengles2 opengles metal software' -- "$cur"))
|
||||
return
|
||||
;;
|
||||
--rotation)
|
||||
COMPREPLY=($(compgen -W '0 1 2 3' -- "$cur"))
|
||||
return
|
||||
;;
|
||||
--shortcut-mod)
|
||||
# Only auto-complete a single key
|
||||
COMPREPLY=($(compgen -W 'lctrl rctrl lalt ralt lsuper rsuper' -- "$cur"))
|
||||
return
|
||||
;;
|
||||
-V|--verbosity)
|
||||
COMPREPLY=($(compgen -W 'verbose debug info warn error' -- "$cur"))
|
||||
return
|
||||
;;
|
||||
-b|--bitrate \
|
||||
|--codec-options \
|
||||
|--crop \
|
||||
|--display \
|
||||
|--display-buffer \
|
||||
|--encoder \
|
||||
|--max-fps \
|
||||
|-m|--max-size \
|
||||
|-p|--port \
|
||||
|--push-target \
|
||||
|-s|--serial \
|
||||
|--tunnel-host \
|
||||
|--tunnel-port \
|
||||
|--v4l2-buffer \
|
||||
|--v4l2-sink \
|
||||
|--tcpip \
|
||||
|--window-*)
|
||||
# Option accepting an argument, but nothing to auto-complete
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||
}
|
||||
|
||||
complete -F _scrcpy scrcpy
|
@ -48,9 +48,9 @@ arguments=(
|
||||
'--rotation=[Set the initial display rotation]:rotation values:(0 1 2 3)'
|
||||
{-s,--serial=}'[The device serial number \(mandatory for multiple devices only\)]'
|
||||
'--shortcut-mod=[\[key1,key2+key3,...\] Specify the modifiers to use for scrcpy shortcuts]:shortcut mod:(lctrl rctrl lalt ralt lsuper rsuper)'
|
||||
'--tcpip[\(optional \[ip\:port\]\) Configure and connect the device over TCP/IP]'
|
||||
{-S,--turn-screen-off}'[Turn the device screen off immediately]'
|
||||
{-t,--show-touches}'[Show physical touches]'
|
||||
'--tcpip[\(optional \[ip\:port\]\) Configure and connect the device over TCP/IP]'
|
||||
'--tunnel-host=[Set the IP address of the adb tunnel to reach the scrcpy server]'
|
||||
'--tunnel-port=[Set the TCP port of the adb tunnel to reach the scrcpy server]'
|
||||
'--v4l2-buffer=[Add a buffering delay \(in milliseconds\) before pushing frames]'
|
||||
|
@ -229,8 +229,6 @@ install_data('data/icon.png',
|
||||
install_dir: 'share/icons/hicolor/256x256/apps')
|
||||
install_data('data/zsh-completion/_scrcpy',
|
||||
install_dir: 'share/zsh/site-functions')
|
||||
install_data('data/bash-completion/scrcpy',
|
||||
install_dir: 'share/bash-completion/completions')
|
||||
|
||||
|
||||
### TESTS
|
||||
|
@ -13,7 +13,7 @@ BEGIN
|
||||
VALUE "LegalCopyright", "Romain Vimont, Genymobile"
|
||||
VALUE "OriginalFilename", "scrcpy.exe"
|
||||
VALUE "ProductName", "scrcpy"
|
||||
VALUE "ProductVersion", "1.23"
|
||||
VALUE "ProductVersion", "1.22"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -355,12 +355,6 @@ Set the initial window height.
|
||||
|
||||
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
|
||||
|
||||
In the following list, MOD is the shortcut modifier. By default, it's (left)
|
||||
|
@ -422,20 +422,6 @@ static const struct sc_option options[] = {
|
||||
"on exit.\n"
|
||||
"It only shows physical touches (not clicks from scrcpy).",
|
||||
},
|
||||
{
|
||||
.longopt_id = OPT_TCPIP,
|
||||
.longopt = "tcpip",
|
||||
.argdesc = "ip[:port]",
|
||||
.optional_arg = true,
|
||||
.text = "Configure and reconnect the device over TCP/IP.\n"
|
||||
"If a destination address is provided, then scrcpy connects to "
|
||||
"this address before starting. The device must listen on the "
|
||||
"given TCP port (default is 5555).\n"
|
||||
"If no destination address is provided, then scrcpy attempts "
|
||||
"to find the IP address of the current device (typically "
|
||||
"connected over USB), enables TCP/IP mode, then connects to "
|
||||
"this address before starting.",
|
||||
},
|
||||
{
|
||||
.longopt_id = OPT_TUNNEL_HOST,
|
||||
.longopt = "tunnel-host",
|
||||
@ -497,6 +483,20 @@ static const struct sc_option options[] = {
|
||||
.text = "Keep the device on while scrcpy is running, when the device "
|
||||
"is plugged in.",
|
||||
},
|
||||
{
|
||||
.longopt_id = OPT_TCPIP,
|
||||
.longopt = "tcpip",
|
||||
.argdesc = "ip[:port]",
|
||||
.optional_arg = true,
|
||||
.text = "Configure and reconnect the device over TCP/IP.\n"
|
||||
"If a destination address is provided, then scrcpy connects to "
|
||||
"this address before starting. The device must listen on the "
|
||||
"given TCP port (default is 5555).\n"
|
||||
"If no destination address is provided, then scrcpy attempts "
|
||||
"to find the IP address of the current device (typically "
|
||||
"connected over USB), enables TCP/IP mode, then connects to "
|
||||
"this address before starting.",
|
||||
},
|
||||
{
|
||||
.longopt_id = OPT_WINDOW_BORDERLESS,
|
||||
.longopt = "window-borderless",
|
||||
|
@ -40,19 +40,19 @@ main(int argc, char *argv[]) {
|
||||
#endif
|
||||
|
||||
if (!scrcpy_parse_args(&args, argc, argv)) {
|
||||
return SCRCPY_EXIT_FAILURE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
sc_set_log_level(args.opts.log_level);
|
||||
|
||||
if (args.help) {
|
||||
scrcpy_print_usage(argv[0]);
|
||||
return SCRCPY_EXIT_SUCCESS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args.version) {
|
||||
scrcpy_print_version();
|
||||
return SCRCPY_EXIT_SUCCESS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef SCRCPY_LAVF_REQUIRES_REGISTER_ALL
|
||||
@ -66,17 +66,17 @@ main(int argc, char *argv[]) {
|
||||
#endif
|
||||
|
||||
if (avformat_network_init()) {
|
||||
return SCRCPY_EXIT_FAILURE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#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);
|
||||
#else
|
||||
enum scrcpy_exit_code ret = scrcpy(&args.opts);
|
||||
bool ok = scrcpy(&args.opts);
|
||||
#endif
|
||||
|
||||
avformat_network_deinit(); // ignore failure
|
||||
|
||||
return ret;
|
||||
return ok ? 0 : 1;
|
||||
}
|
||||
|
@ -149,41 +149,38 @@ sdl_configure(bool display, bool disable_screensaver) {
|
||||
}
|
||||
}
|
||||
|
||||
static enum scrcpy_exit_code
|
||||
static bool
|
||||
event_loop(struct scrcpy *s) {
|
||||
SDL_Event event;
|
||||
while (SDL_WaitEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case EVENT_STREAM_STOPPED:
|
||||
LOGW("Device disconnected");
|
||||
return SCRCPY_EXIT_DISCONNECTED;
|
||||
return false;
|
||||
case SDL_QUIT:
|
||||
LOGD("User requested to quit");
|
||||
return SCRCPY_EXIT_SUCCESS;
|
||||
return true;
|
||||
default:
|
||||
sc_screen_handle_event(&s->screen, &event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return SCRCPY_EXIT_FAILURE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return true on success, false on error
|
||||
static bool
|
||||
await_for_server(bool *connected) {
|
||||
await_for_server(void) {
|
||||
SDL_Event event;
|
||||
while (SDL_WaitEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case SDL_QUIT:
|
||||
LOGD("User requested to quit");
|
||||
*connected = false;
|
||||
return true;
|
||||
return false;
|
||||
case EVENT_SERVER_CONNECTION_FAILED:
|
||||
LOGE("Server connection failed");
|
||||
return false;
|
||||
case EVENT_SERVER_CONNECTED:
|
||||
LOGD("Server connected");
|
||||
*connected = true;
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
@ -265,7 +262,7 @@ sc_server_on_disconnected(struct sc_server *server, void *userdata) {
|
||||
// event
|
||||
}
|
||||
|
||||
enum scrcpy_exit_code
|
||||
bool
|
||||
scrcpy(struct scrcpy_options *options) {
|
||||
static struct scrcpy scrcpy;
|
||||
struct scrcpy *s = &scrcpy;
|
||||
@ -273,12 +270,12 @@ scrcpy(struct scrcpy_options *options) {
|
||||
// Minimal SDL initialization
|
||||
if (SDL_Init(SDL_INIT_EVENTS)) {
|
||||
LOGE("Could not initialize SDL: %s", SDL_GetError());
|
||||
return SCRCPY_EXIT_FAILURE;
|
||||
return false;
|
||||
}
|
||||
|
||||
atexit(SDL_Quit);
|
||||
|
||||
enum scrcpy_exit_code ret = SCRCPY_EXIT_FAILURE;
|
||||
bool ret = false;
|
||||
|
||||
bool server_started = false;
|
||||
bool file_pusher_initialized = false;
|
||||
@ -332,7 +329,7 @@ scrcpy(struct scrcpy_options *options) {
|
||||
.on_disconnected = sc_server_on_disconnected,
|
||||
};
|
||||
if (!sc_server_init(&s->server, ¶ms, &cbs, NULL)) {
|
||||
return SCRCPY_EXIT_FAILURE;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sc_server_start(&s->server)) {
|
||||
@ -354,14 +351,7 @@ scrcpy(struct scrcpy_options *options) {
|
||||
sdl_configure(options->display, options->disable_screensaver);
|
||||
|
||||
// Await for server without blocking Ctrl+C handling
|
||||
bool connected;
|
||||
if (!await_for_server(&connected)) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!connected) {
|
||||
// This is not an error, user requested to quit
|
||||
ret = SCRCPY_EXIT_SUCCESS;
|
||||
if (!await_for_server()) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
@ -6,18 +6,7 @@
|
||||
#include <stdbool.h>
|
||||
#include "options.h"
|
||||
|
||||
enum scrcpy_exit_code {
|
||||
// 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
|
||||
bool
|
||||
scrcpy(struct scrcpy_options *options);
|
||||
|
||||
#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)) {
|
||||
sc_hid_event_destroy(&hid_event);
|
||||
LOGW("Could not request HID event (mod lock state)");
|
||||
LOGW("Could request HID event");
|
||||
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)) {
|
||||
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)) {
|
||||
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)) {
|
||||
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)) {
|
||||
sc_hid_event_destroy(&hid_event);
|
||||
LOGW("Could not request HID event (mouse scroll)");
|
||||
LOGW("Could request HID event");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,26 +29,26 @@ sc_usb_on_disconnected(struct sc_usb *usb, void *userdata) {
|
||||
}
|
||||
}
|
||||
|
||||
static enum scrcpy_exit_code
|
||||
static bool
|
||||
event_loop(struct scrcpy_otg *s) {
|
||||
SDL_Event event;
|
||||
while (SDL_WaitEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case EVENT_USB_DEVICE_DISCONNECTED:
|
||||
LOGW("Device disconnected");
|
||||
return SCRCPY_EXIT_DISCONNECTED;
|
||||
return false;
|
||||
case SDL_QUIT:
|
||||
LOGD("User requested to quit");
|
||||
return SCRCPY_EXIT_SUCCESS;
|
||||
return true;
|
||||
default:
|
||||
sc_screen_otg_handle_event(&s->screen_otg, &event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return SCRCPY_EXIT_FAILURE;
|
||||
return false;
|
||||
}
|
||||
|
||||
enum scrcpy_exit_code
|
||||
bool
|
||||
scrcpy_otg(struct scrcpy_options *options) {
|
||||
static struct scrcpy_otg scrcpy_otg;
|
||||
struct scrcpy_otg *s = &scrcpy_otg;
|
||||
@ -67,7 +67,7 @@ scrcpy_otg(struct scrcpy_options *options) {
|
||||
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_mouse *mouse = NULL;
|
||||
@ -90,7 +90,7 @@ scrcpy_otg(struct scrcpy_options *options) {
|
||||
};
|
||||
bool ok = sc_usb_init(&s->usb);
|
||||
if (!ok) {
|
||||
return SCRCPY_EXIT_FAILURE;
|
||||
return false;
|
||||
}
|
||||
|
||||
struct sc_usb_device usb_device;
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "options.h"
|
||||
#include "scrcpy.h"
|
||||
|
||||
enum scrcpy_exit_code
|
||||
bool
|
||||
scrcpy_otg(struct scrcpy_options *options);
|
||||
|
||||
#endif
|
||||
|
@ -15,7 +15,6 @@ read_string(libusb_device_handle *handle, uint8_t desc_index) {
|
||||
(unsigned char *) buffer,
|
||||
sizeof(buffer));
|
||||
if (result < 0) {
|
||||
LOGD("Read string: libusb error: %s", libusb_strerror(result));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// Adapted from vlc_vector:
|
||||
// <https://code.videolan.org/videolan/vlc/-/blob/0857947abaed9c89810cd96353aaa1b7e6ba3b0d/include/vlc_vector.h>
|
||||
|
@ -2,8 +2,8 @@
|
||||
set -e
|
||||
|
||||
BUILDDIR=build-auto
|
||||
PREBUILT_SERVER_URL=https://github.com/Genymobile/scrcpy/releases/download/v1.23/scrcpy-server-v1.23
|
||||
PREBUILT_SERVER_SHA256=2a913fd47478c0b306fca507cb0beb625e49a19ff9fc7ab904e36ef5b9fe7e68
|
||||
PREBUILT_SERVER_URL=https://github.com/Genymobile/scrcpy/releases/download/v1.22/scrcpy-server-v1.22
|
||||
PREBUILT_SERVER_SHA256=c05d273eec7533c0e106282e0254cf04e7f5e8f0c2920ca39448865fab2a419b
|
||||
|
||||
echo "[scrcpy] Downloading prebuilt server..."
|
||||
wget "$PREBUILT_SERVER_URL" -O scrcpy-server
|
||||
|
@ -1,5 +1,5 @@
|
||||
project('scrcpy', 'c',
|
||||
version: '1.23',
|
||||
version: '1.22',
|
||||
meson_version: '>= 0.48',
|
||||
default_options: [
|
||||
'c_std=c11',
|
||||
|
@ -6,8 +6,8 @@ android {
|
||||
applicationId "com.genymobile.scrcpy"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 31
|
||||
versionCode 12300
|
||||
versionName "1.23"
|
||||
versionCode 12200
|
||||
versionName "1.22"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
|
@ -12,7 +12,7 @@
|
||||
set -e
|
||||
|
||||
SCRCPY_DEBUG=false
|
||||
SCRCPY_VERSION_NAME=1.23
|
||||
SCRCPY_VERSION_NAME=1.22
|
||||
|
||||
PLATFORM=${ANDROID_PLATFORM:-31}
|
||||
BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-31.0.0}
|
||||
|
@ -11,6 +11,7 @@ import java.util.Locale;
|
||||
|
||||
public final class Server {
|
||||
|
||||
|
||||
private Server() {
|
||||
// not instantiable
|
||||
}
|
||||
|
Reference in New Issue
Block a user