Compare commits
26 Commits
bash_compl
...
upgrade
Author | SHA1 | Date | |
---|---|---|---|
4db97531e8 | |||
b8d78743f7 | |||
6a4a4a283d | |||
7d8b72d4a6 | |||
fa5b2a29e9 | |||
0c94887075 | |||
88543cb545 | |||
aaf3869a54 | |||
c3d45c8397 | |||
e56f2ac7a9 | |||
4ce7af42c6 | |||
b1dbc30072 | |||
b3f5dfe1de | |||
1f4c801f3c | |||
8d91cda4f6 | |||
59656fe649 | |||
e4bb2b8728 | |||
adbe7908c6 | |||
49434da36e | |||
7deccef1c2 | |||
977735f916 | |||
71ef5cc0a9 | |||
4ab4548769 | |||
0e22032710 | |||
7a138c6929 | |||
b58b566fa5 |
6
BUILD.md
6
BUILD.md
@ -272,10 +272,10 @@ install` must be run as root)._
|
|||||||
|
|
||||||
#### Option 2: Use prebuilt server
|
#### Option 2: Use prebuilt server
|
||||||
|
|
||||||
- [`scrcpy-server-v1.22`][direct-scrcpy-server]
|
- [`scrcpy-server-v1.23`][direct-scrcpy-server]
|
||||||
_(SHA-256: c05d273eec7533c0e106282e0254cf04e7f5e8f0c2920ca39448865fab2a419b)_
|
_(SHA-256: 2a913fd47478c0b306fca507cb0beb625e49a19ff9fc7ab904e36ef5b9fe7e68)_
|
||||||
|
|
||||||
[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.22/scrcpy-server-v1.22
|
[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:
|
||||||
|
20
FAQ.md
20
FAQ.md
@ -158,22 +158,24 @@ screen, then you might get poor quality, especially visible on text (see [#40]).
|
|||||||
|
|
||||||
[#40]: https://github.com/Genymobile/scrcpy/issues/40
|
[#40]: https://github.com/Genymobile/scrcpy/issues/40
|
||||||
|
|
||||||
To improve downscaling quality, trilinear filtering is enabled automatically
|
This problem should be fixed in scrcpy v1.22: **update to the latest version**.
|
||||||
if the renderer is OpenGL and if it supports mipmapping.
|
|
||||||
|
|
||||||
On Windows, you might want to force OpenGL:
|
On older versions, you must configure the [scaling behavior]:
|
||||||
|
|
||||||
```
|
|
||||||
scrcpy --render-driver=opengl
|
|
||||||
```
|
|
||||||
|
|
||||||
You may also need to configure the [scaling behavior]:
|
|
||||||
|
|
||||||
> `scrcpy.exe` > Properties > Compatibility > Change high DPI settings >
|
> `scrcpy.exe` > Properties > Compatibility > Change high DPI settings >
|
||||||
> Override high DPI scaling behavior > Scaling performed by: _Application_.
|
> Override high DPI scaling behavior > Scaling performed by: _Application_.
|
||||||
|
|
||||||
[scaling behavior]: https://github.com/Genymobile/scrcpy/issues/40#issuecomment-424466723
|
[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
|
### Issue with Wayland
|
||||||
|
|
||||||
|
1016
README.de.md
Normal file
1016
README.de.md
Normal file
File diff suppressed because it is too large
Load Diff
29
README.md
29
README.md
@ -1,6 +1,6 @@
|
|||||||
# scrcpy (v1.22)
|
# scrcpy (v1.23)
|
||||||
|
|
||||||
<img src="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" />
|
||||||
|
|
||||||
_pronounced "**scr**een **c**o**py**"_
|
_pronounced "**scr**een **c**o**py**"_
|
||||||
|
|
||||||
@ -106,10 +106,10 @@ process][BUILD_simple]).
|
|||||||
For Windows, for simplicity, a prebuilt archive with all the dependencies
|
For Windows, for simplicity, a prebuilt archive with all the dependencies
|
||||||
(including `adb`) is available:
|
(including `adb`) is available:
|
||||||
|
|
||||||
- [`scrcpy-win64-v1.22.zip`][direct-win64]
|
- [`scrcpy-win64-v1.23.zip`][direct-win64]
|
||||||
_(SHA-256: ce4d9b8cc761e29862c4a72d8ad6f538bdd1f1831d15fd1f36633cd3b403db82)_
|
_(SHA-256: d2f601b1d0157faf65153d8a093d827fd65aec5d5842d677ac86fb2b5b7704cc)_
|
||||||
|
|
||||||
[direct-win64]: https://github.com/Genymobile/scrcpy/releases/download/v1.22/scrcpy-win64-v1.22.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]:
|
||||||
|
|
||||||
@ -448,6 +448,9 @@ 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
|
||||||
@ -1105,7 +1108,9 @@ See [BUILD].
|
|||||||
|
|
||||||
## Common issues
|
## Common issues
|
||||||
|
|
||||||
See the [FAQ](FAQ.md).
|
See the [FAQ].md).
|
||||||
|
|
||||||
|
[FAQ]: FAQ.md
|
||||||
|
|
||||||
|
|
||||||
## Developers
|
## Developers
|
||||||
@ -1140,10 +1145,22 @@ Read the [developers page].
|
|||||||
[article-intro]: https://blog.rom1v.com/2018/03/introducing-scrcpy/
|
[article-intro]: https://blog.rom1v.com/2018/03/introducing-scrcpy/
|
||||||
[article-tcpip]: https://www.genymotion.com/blog/open-source-project-scrcpy-now-works-wirelessly/
|
[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
|
## Translations
|
||||||
|
|
||||||
This README is available in other languages:
|
This README is available in other languages:
|
||||||
|
|
||||||
|
- [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.19](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)
|
||||||
|
@ -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 + '/dll'
|
libusb_bin_dir = meson.current_source_dir() + '/prebuilt-deps/data/' + prebuilt_libusb
|
||||||
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('libusb-1.0', dirs: libusb_bin_dir),
|
cc.find_library('msys-usb-1.0', dirs: libusb_bin_dir),
|
||||||
],
|
],
|
||||||
include_directories: include_directories(libusb_include_dir)
|
include_directories: include_directories(libusb_include_dir)
|
||||||
)
|
)
|
||||||
|
@ -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-31.0.3
|
DEP_DIR=platform-tools-33.0.1
|
||||||
|
|
||||||
FILENAME=platform-tools_r31.0.3-windows.zip
|
FILENAME=platform-tools_r33.0.1-windows.zip
|
||||||
SHA256SUM=0f4b8fdd26af2c3733539d6eebb3c2ed499ea1d4bb1f4e0ecc2d6016961a6e24
|
SHA256SUM=c1f02d42ea24ef4ff2a405ae7370e764ef4546f9b3e4520f5571a00ed5012c42
|
||||||
|
|
||||||
if [[ -d "$DEP_DIR" ]]
|
if [[ -d "$DEP_DIR" ]]
|
||||||
then
|
then
|
||||||
|
@ -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.25
|
DEP_DIR=libusb-1.0.26
|
||||||
|
|
||||||
FILENAME=libusb-1.0.25.7z
|
FILENAME=libusb-1.0.26-binaries.7z
|
||||||
SHA256SUM=3d1c98416f454026034b2b5d67f8a294053898cb70a8b489874e75b136c6674d
|
SHA256SUM=9c242696342dbde9cdc47239391f71833939bf9f7aa2bbb28cdaabe890465ec5
|
||||||
|
|
||||||
if [[ -d "$DEP_DIR" ]]
|
if [[ -d "$DEP_DIR" ]]
|
||||||
then
|
then
|
||||||
@ -17,12 +17,18 @@ then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
get_file "https://github.com/libusb/libusb/releases/download/v1.0.25/$FILENAME" "$FILENAME" "$SHA256SUM"
|
get_file "https://github.com/libusb/libusb/releases/download/v1.0.26/$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" \
|
||||||
MinGW32/dll/libusb-1.0.dll \
|
libusb-1.0.26-binaries/libusb-MinGW-Win32/bin/msys-usb-1.0.dll \
|
||||||
MinGW64/dll/libusb-1.0.dll \
|
libusb-1.0.26-binaries/libusb-MinGW-x64/bin/msys-usb-1.0.dll \
|
||||||
include /
|
libusb-1.0.26-binaries/libusb-MinGW-x64/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
|
||||||
|
@ -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.22"
|
VALUE "ProductVersion", "1.23"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
10
app/scrcpy.1
10
app/scrcpy.1
@ -355,6 +355,12 @@ 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)
|
||||||
@ -471,6 +477,10 @@ 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,9 +473,12 @@ 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_is_serial_tcpip(device->serial);
|
return sc_adb_device_get_type(device->serial) ==
|
||||||
|
SC_ADB_DEVICE_TYPE_USB;
|
||||||
case SC_ADB_DEVICE_SELECT_TCPIP:
|
case SC_ADB_DEVICE_SELECT_TCPIP:
|
||||||
return sc_adb_is_serial_tcpip(device->serial);
|
// Both emulators and TCP/IP devices are selected via -e
|
||||||
|
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;
|
||||||
@ -509,8 +512,10 @@ 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 ? "-->" : " ";
|
||||||
const char *type = sc_adb_is_serial_tcpip(d->serial) ? "(tcpip)"
|
bool is_usb =
|
||||||
: " (usb)";
|
sc_adb_device_get_type(d->serial) == SC_ADB_DEVICE_TYPE_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 : "");
|
||||||
}
|
}
|
||||||
@ -531,6 +536,8 @@ 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;
|
||||||
@ -705,8 +712,3 @@ sc_adb_get_device_ip(struct sc_intr *intr, const char *serial, unsigned flags) {
|
|||||||
|
|
||||||
return sc_adb_parse_device_ip_from_output(buf);
|
return sc_adb_parse_device_ip_from_output(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
sc_adb_is_serial_tcpip(const char *serial) {
|
|
||||||
return strchr(serial, ':');
|
|
||||||
}
|
|
||||||
|
@ -114,13 +114,4 @@ 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,6 +1,7 @@
|
|||||||
#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) {
|
||||||
@ -25,3 +26,18 @@ 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,6 +15,12 @@ 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
|
||||||
@ -35,4 +41,10 @@ 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
|
||||||
|
@ -80,6 +80,11 @@ 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;
|
||||||
@ -655,6 +660,11 @@ 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",
|
||||||
@ -662,7 +672,22 @@ 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 *
|
||||||
@ -901,6 +926,25 @@ 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
|
||||||
@ -939,6 +983,11 @@ 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
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef COMMON_H
|
#ifndef SC_COMMON_H
|
||||||
#define COMMON_H
|
#define SC_COMMON_H
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef COMPAT_H
|
#ifndef SC_COMPAT_H
|
||||||
#define COMPAT_H
|
#define SC_COMPAT_H
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef CONTROLMSG_H
|
#ifndef SC_CONTROLMSG_H
|
||||||
#define CONTROLMSG_H
|
#define SC_CONTROLMSG_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef CONTROLLER_H
|
#ifndef SC_CONTROLLER_H
|
||||||
#define CONTROLLER_H
|
#define SC_CONTROLLER_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef DEVICEMSG_H
|
#ifndef SC_DEVICEMSG_H
|
||||||
#define DEVICEMSG_H
|
#define SC_DEVICEMSG_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef FPSCOUNTER_H
|
#ifndef SC_FPSCOUNTER_H
|
||||||
#define FPSCOUNTER_H
|
#define SC_FPSCOUNTER_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef ICON_H
|
#ifndef SC_ICON_H
|
||||||
#define ICON_H
|
#define SC_ICON_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef INPUTMANAGER_H
|
#ifndef SC_INPUTMANAGER_H
|
||||||
#define INPUTMANAGER_H
|
#define SC_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 1;
|
return SCRCPY_EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 0;
|
return SCRCPY_EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.version) {
|
if (args.version) {
|
||||||
scrcpy_print_version();
|
scrcpy_print_version();
|
||||||
return 0;
|
return SCRCPY_EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#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 1;
|
return SCRCPY_EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_USB
|
#ifdef HAVE_USB
|
||||||
bool ok = args.opts.otg ? scrcpy_otg(&args.opts)
|
enum scrcpy_exit_code ret = args.opts.otg ? scrcpy_otg(&args.opts)
|
||||||
: scrcpy(&args.opts);
|
: scrcpy(&args.opts);
|
||||||
#else
|
#else
|
||||||
bool ok = scrcpy(&args.opts);
|
enum scrcpy_exit_code ret = scrcpy(&args.opts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
avformat_network_deinit(); // ignore failure
|
avformat_network_deinit(); // ignore failure
|
||||||
|
|
||||||
return ok ? 0 : 1;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -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(PREFIX) - 1;
|
version += sizeof(OPENGL_ES_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);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef RECEIVER_H
|
#ifndef SC_RECEIVER_H
|
||||||
#define RECEIVER_H
|
#define SC_RECEIVER_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -149,38 +149,41 @@ sdl_configure(bool display, bool disable_screensaver) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static enum scrcpy_exit_code
|
||||||
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 false;
|
return SCRCPY_EXIT_DISCONNECTED;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
LOGD("User requested to quit");
|
LOGD("User requested to quit");
|
||||||
return true;
|
return SCRCPY_EXIT_SUCCESS;
|
||||||
default:
|
default:
|
||||||
sc_screen_handle_event(&s->screen, &event);
|
sc_screen_handle_event(&s->screen, &event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return SCRCPY_EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return true on success, false on error
|
||||||
static bool
|
static bool
|
||||||
await_for_server(void) {
|
await_for_server(bool *connected) {
|
||||||
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");
|
||||||
return false;
|
*connected = 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;
|
||||||
@ -262,7 +265,7 @@ sc_server_on_disconnected(struct sc_server *server, void *userdata) {
|
|||||||
// event
|
// event
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
enum scrcpy_exit_code
|
||||||
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;
|
||||||
@ -270,12 +273,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 false;
|
return SCRCPY_EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
atexit(SDL_Quit);
|
atexit(SDL_Quit);
|
||||||
|
|
||||||
bool ret = false;
|
enum scrcpy_exit_code ret = SCRCPY_EXIT_FAILURE;
|
||||||
|
|
||||||
bool server_started = false;
|
bool server_started = false;
|
||||||
bool file_pusher_initialized = false;
|
bool file_pusher_initialized = false;
|
||||||
@ -329,7 +332,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 false;
|
return SCRCPY_EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sc_server_start(&s->server)) {
|
if (!sc_server_start(&s->server)) {
|
||||||
@ -351,7 +354,14 @@ 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
|
||||||
if (!await_for_server()) {
|
bool connected;
|
||||||
|
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,7 +6,18 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
bool
|
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
|
||||||
scrcpy(struct scrcpy_options *options);
|
scrcpy(struct scrcpy_options *options);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -649,7 +649,8 @@ 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 = sc_adb_is_serial_tcpip(serial);
|
bool is_already_tcpip =
|
||||||
|
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);
|
||||||
@ -707,7 +708,15 @@ 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 {
|
||||||
selector.type = SC_ADB_DEVICE_SELECT_ALL;
|
// No explicit selection, check $ANDROID_SERIAL
|
||||||
|
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);
|
||||||
|
@ -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 request HID event");
|
LOGW("Could not request HID event (mod lock state)");
|
||||||
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 request HID event");
|
LOGW("Could not request HID event (key)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 request HID event");
|
LOGW("Could not request HID event (mouse motion)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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 request HID event");
|
LOGW("Could not request HID event (mouse click)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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 request HID event");
|
LOGW("Could not request HID event (mouse scroll)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,26 +29,26 @@ sc_usb_on_disconnected(struct sc_usb *usb, void *userdata) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static enum scrcpy_exit_code
|
||||||
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 false;
|
return SCRCPY_EXIT_DISCONNECTED;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
LOGD("User requested to quit");
|
LOGD("User requested to quit");
|
||||||
return true;
|
return SCRCPY_EXIT_SUCCESS;
|
||||||
default:
|
default:
|
||||||
sc_screen_otg_handle_event(&s->screen_otg, &event);
|
sc_screen_otg_handle_event(&s->screen_otg, &event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return SCRCPY_EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
enum scrcpy_exit_code
|
||||||
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;
|
||||||
@ -67,7 +67,7 @@ scrcpy_otg(struct scrcpy_options *options) {
|
|||||||
LOGW("Could not enable mouse focus clickthrough");
|
LOGW("Could not enable mouse focus clickthrough");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ret = false;
|
enum scrcpy_exit_code ret = SCRCPY_EXIT_FAILURE;
|
||||||
|
|
||||||
struct sc_hid_keyboard *keyboard = NULL;
|
struct sc_hid_keyboard *keyboard = NULL;
|
||||||
struct sc_hid_mouse *mouse = NULL;
|
struct sc_hid_mouse *mouse = NULL;
|
||||||
@ -90,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 false;
|
return SCRCPY_EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sc_usb_device usb_device;
|
struct sc_usb_device usb_device;
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
#include "scrcpy.h"
|
||||||
|
|
||||||
bool
|
enum scrcpy_exit_code
|
||||||
scrcpy_otg(struct scrcpy_options *options);
|
scrcpy_otg(struct scrcpy_options *options);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -15,6 +15,7 @@ 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 CBUF_H
|
#ifndef SC_CBUF_H
|
||||||
#define CBUF_H
|
#define SC_CBUF_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef NET_H
|
#ifndef SC_NET_H
|
||||||
#define NET_H
|
#define SC_NET_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
// Adapted from vlc_vector:
|
// Adapted from vlc_vector:
|
||||||
// <https://code.videolan.org/videolan/vlc/-/blob/0857947abaed9c89810cd96353aaa1b7e6ba3b0d/include/vlc_vector.h>
|
// <https://code.videolan.org/videolan/vlc/-/blob/0857947abaed9c89810cd96353aaa1b7e6ba3b0d/include/vlc_vector.h>
|
||||||
|
@ -21,5 +21,5 @@ 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.20/i686-w64-mingw32'
|
prebuilt_sdl2 = 'SDL2-2.0.20/i686-w64-mingw32'
|
||||||
prebuilt_libusb_root = 'libusb-1.0.25'
|
prebuilt_libusb_root = 'libusb-1.0.26'
|
||||||
prebuilt_libusb = prebuilt_libusb_root + '/MinGW32'
|
prebuilt_libusb = prebuilt_libusb_root + '/MinGW-Win32'
|
||||||
|
@ -21,5 +21,5 @@ ffmpeg_avformat = 'avformat-59'
|
|||||||
ffmpeg_avutil = 'avutil-57'
|
ffmpeg_avutil = 'avutil-57'
|
||||||
prebuilt_ffmpeg = 'ffmpeg-win64-5.0'
|
prebuilt_ffmpeg = 'ffmpeg-win64-5.0'
|
||||||
prebuilt_sdl2 = 'SDL2-2.0.20/x86_64-w64-mingw32'
|
prebuilt_sdl2 = 'SDL2-2.0.20/x86_64-w64-mingw32'
|
||||||
prebuilt_libusb_root = 'libusb-1.0.25'
|
prebuilt_libusb_root = 'libusb-1.0.26'
|
||||||
prebuilt_libusb = prebuilt_libusb_root + '/MinGW64'
|
prebuilt_libusb = prebuilt_libusb_root + '/MinGW-x64'
|
||||||
|
@ -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.22/scrcpy-server-v1.22
|
PREBUILT_SERVER_URL=https://github.com/Genymobile/scrcpy/releases/download/v1.23/scrcpy-server-v1.23
|
||||||
PREBUILT_SERVER_SHA256=c05d273eec7533c0e106282e0254cf04e7f5e8f0c2920ca39448865fab2a419b
|
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.22',
|
version: '1.23',
|
||||||
meson_version: '>= 0.48',
|
meson_version: '>= 0.48',
|
||||||
default_options: [
|
default_options: [
|
||||||
'c_std=c11',
|
'c_std=c11',
|
||||||
|
@ -75,12 +75,10 @@ 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)"
|
||||||
@ -111,7 +109,7 @@ dist-win32: build-server build-win32
|
|||||||
cp app/prebuilt-deps/data/platform-tools-31.0.3/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-31.0.3/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.20/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.25/MinGW32/dll/libusb-1.0.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)/"
|
||||||
|
|
||||||
dist-win64: build-server build-win64
|
dist-win64: build-server build-win64
|
||||||
mkdir -p "$(DIST)/$(WIN64_TARGET_DIR)"
|
mkdir -p "$(DIST)/$(WIN64_TARGET_DIR)"
|
||||||
@ -130,7 +128,7 @@ dist-win64: build-server build-win64
|
|||||||
cp app/prebuilt-deps/data/platform-tools-31.0.3/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-31.0.3/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.20/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.25/MinGW64/dll/libusb-1.0.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)/"
|
||||||
|
|
||||||
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="data/icon.png" \
|
SCRCPY_ICON_PATH="app/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 12200
|
versionCode 12300
|
||||||
versionName "1.22"
|
versionName "1.23"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
SCRCPY_DEBUG=false
|
SCRCPY_DEBUG=false
|
||||||
SCRCPY_VERSION_NAME=1.22
|
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}
|
||||||
|
@ -2,7 +2,6 @@ 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;
|
||||||
@ -14,24 +13,18 @@ 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 IInterface manager;
|
private final android.hardware.input.InputManager manager;
|
||||||
private Method injectInputEventMethod;
|
private Method injectInputEventMethod;
|
||||||
private boolean alternativeInjectInputEventMethod;
|
|
||||||
|
|
||||||
private static Method setDisplayIdMethod;
|
private static Method setDisplayIdMethod;
|
||||||
|
|
||||||
public InputManager(IInterface manager) {
|
public InputManager(android.hardware.input.InputManager manager) {
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Method getInjectInputEventMethod() throws NoSuchMethodException {
|
private Method getInjectInputEventMethod() throws NoSuchMethodException {
|
||||||
if (injectInputEventMethod == null) {
|
if (injectInputEventMethod == null) {
|
||||||
try {
|
injectInputEventMethod = manager.getClass().getMethod("injectInputEvent", InputEvent.class, int.class);
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -39,10 +32,6 @@ 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,6 +4,7 @@ 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")
|
||||||
@ -56,7 +57,13 @@ public final class ServiceManager {
|
|||||||
|
|
||||||
public InputManager getInputManager() {
|
public InputManager getInputManager() {
|
||||||
if (inputManager == null) {
|
if (inputManager == null) {
|
||||||
inputManager = new InputManager(getService("input", "android.hardware.input.IInputManager"));
|
try {
|
||||||
|
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