From aa8b5713896935e2dfe22ab01e21b84d660c22a1 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 4 Jan 2021 08:16:32 +0100 Subject: [PATCH] Increase display id range Some devices use big display id values. Refs #2009 --- app/src/cli.c | 6 +++--- app/src/scrcpy.h | 2 +- app/src/server.c | 4 ++-- app/src/server.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/cli.c b/app/src/cli.c index f01b7941f8..694282a2bf 100644 --- a/app/src/cli.c +++ b/app/src/cli.c @@ -478,14 +478,14 @@ parse_port_range(const char *s, struct sc_port_range *port_range) { } static bool -parse_display_id(const char *s, uint16_t *display_id) { +parse_display_id(const char *s, uint32_t *display_id) { long value; - bool ok = parse_integer_arg(s, &value, false, 0, 0xFFFF, "display id"); + bool ok = parse_integer_arg(s, &value, false, 0, 0x7FFFFFFF, "display id"); if (!ok) { return false; } - *display_id = (uint16_t) value; + *display_id = (uint32_t) value; return true; } diff --git a/app/src/scrcpy.h b/app/src/scrcpy.h index 8548d1f708..c1d7b61230 100644 --- a/app/src/scrcpy.h +++ b/app/src/scrcpy.h @@ -65,7 +65,7 @@ struct scrcpy_options { int16_t window_y; // SC_WINDOW_POSITION_UNDEFINED for "auto" uint16_t window_width; uint16_t window_height; - uint16_t display_id; + uint32_t display_id; bool show_touches; bool fullscreen; bool always_on_top; diff --git a/app/src/server.c b/app/src/server.c index cac7b367c5..217e7e41eb 100644 --- a/app/src/server.c +++ b/app/src/server.c @@ -258,12 +258,12 @@ execute_server(struct server *server, const struct server_params *params) { char bit_rate_string[11]; char max_fps_string[6]; char lock_video_orientation_string[5]; - char display_id_string[6]; + char display_id_string[11]; sprintf(max_size_string, "%"PRIu16, params->max_size); sprintf(bit_rate_string, "%"PRIu32, params->bit_rate); sprintf(max_fps_string, "%"PRIu16, params->max_fps); sprintf(lock_video_orientation_string, "%"PRIi8, params->lock_video_orientation); - sprintf(display_id_string, "%"PRIu16, params->display_id); + sprintf(display_id_string, "%"PRIu32, params->display_id); const char *const cmd[] = { "shell", "CLASSPATH=" DEVICE_SERVER_PATH, diff --git a/app/src/server.h b/app/src/server.h index 9b558aee92..c97a91537c 100644 --- a/app/src/server.h +++ b/app/src/server.h @@ -43,7 +43,7 @@ struct server_params { uint16_t max_fps; int8_t lock_video_orientation; bool control; - uint16_t display_id; + uint32_t display_id; bool show_touches; bool stay_awake; bool force_adb_forward;