Display and control your Android device
Add --orientation
Romain Vimontb43a9e8e7a70
diff --git a/app/data/bash-completion/scrcpy b/app/data/bash-completion/scrcpyindex f08df996..0c854310 100644--- a/app/data/bash-completion/scrcpy+++ b/app/data/bash-completion/scrcpy@@ -51,6 +51,7 @@ _scrcpy() {--no-power-on--no-video--no-video-playback+ --orientation=--otg-p --port=--pause-on-exit@@ -114,6 +115,7 @@ _scrcpy() {COMPREPLY=($(compgen -W 'front back external' -- "$cur"))return;;+ --orientation--display-orientation)COMPREPLY=($(compgen -> '0 90 180 270 flip0 flip90 flip180 flip270' -- "$cur"))returndiff --git a/app/data/zsh-completion/_scrcpy b/app/data/zsh-completion/_scrcpyindex 0e39f96b..3c7ca217 100644--- a/app/data/zsh-completion/_scrcpy+++ b/app/data/zsh-completion/_scrcpy@@ -57,6 +57,7 @@ arguments=('--no-power-on[Do not power on the device on start]''--no-video[Disable video forwarding]''--no-video-playback[Disable video playback]'+ '--orientation=[Set the video orientation]:orientation values:(0 90 180 270 flip0 flip90 flip180 flip270)''--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]''--pause-on-exit=[Make scrcpy pause before exiting]:mode:(true false if-error)'diff --git a/app/scrcpy.1 b/app/scrcpy.1index 1a9386ee..0c34b4e2 100644--- a/app/scrcpy.1+++ b/app/scrcpy.1@@ -299,6 +299,10 @@ Disable video forwarding..B \-\-no\-video\-playbackDisable video playback on the computer.+.TP+.BI "\-\-orientation " value+Same as --display-orientation=value --record-orientation=value.+.TP.B \-\-otgRun 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.diff --git a/app/src/cli.c b/app/src/cli.cindex fb0f43d5..f57b75ef 100644--- a/app/src/cli.c+++ b/app/src/cli.c@@ -92,6 +92,7 @@ enum {OPT_CAMERA_HIGH_SPEED,OPT_DISPLAY_ORIENTATION,OPT_RECORD_ORIENTATION,+ OPT_ORIENTATION,};struct sc_option {@@ -525,6 +526,13 @@ static const struct sc_option options[] = {.longopt = "no-video-playback",.text = "Disable video playback on the computer.",},+ {+ .longopt_id = OPT_ORIENTATION,+ .longopt = "orientation",+ .argdesc = "value",+ .text = "Same as --display-orientation=value "+ "--record-orientation=value.",+ },{.longopt_id = OPT_OTG,.longopt = "otg",@@ -2146,6 +2154,14 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],return false;}break;+ case OPT_ORIENTATION:+ enum sc_orientation orientation;+ if (!parse_orientation(optarg, &orientation)) {+ return false;+ }+ opts->display_orientation = orientation;+ opts->record_orientation = orientation;+ break;case OPT_RENDER_DRIVER:opts->render_driver = optarg;break;