2
0
mirror of https://github.com/Genymobile/scrcpy synced 2025-09-01 23:05:19 +00:00

Add --no-cleanup option

It might be useful not to cleanup on exit, for example to leave the
screen turned off, or keep the server binary on the device (via the
server option "cleanup=false").

Fixes #1764 <https://github.com/Genymobile/scrcpy/issues/1764>
PR #3020 <https://github.com/Genymobile/scrcpy/pull/3020>
This commit is contained in:
Romain Vimont
2022-02-13 17:17:01 +01:00
parent bb991f829c
commit ccbe370cc5
9 changed files with 46 additions and 5 deletions

View File

@@ -54,6 +54,7 @@
#define OPT_RAW_KEY_EVENTS 1034
#define OPT_NO_DOWNSIZE_ON_ERROR 1035
#define OPT_OTG 1036
#define OPT_NO_CLEANUP 1037
struct sc_option {
char shortopt;
@@ -250,6 +251,14 @@ static const struct sc_option options[] = {
"is preserved.\n"
"Default is 0 (unlimited).",
},
{
.longopt_id = OPT_NO_CLEANUP,
.longopt = "no-cleanup",
.text = "By default, scrcpy removes the server binary from the device "
"and restores the device state (show touches, stay awake and "
"power mode) on exit.\n"
"This option disables this cleanup."
},
{
.longopt_id = OPT_NO_CLIPBOARD_AUTOSYNC,
.longopt = "no-clipboard-autosync",
@@ -1535,6 +1544,9 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
case OPT_NO_DOWNSIZE_ON_ERROR:
opts->downsize_on_error = false;
break;
case OPT_NO_CLEANUP:
opts->cleanup = false;
break;
case OPT_OTG:
#ifdef HAVE_USB
opts->otg = true;