Increase display id range

Some devices use big display id values.

Refs #2009 <https://github.com/Genymobile/scrcpy/issues/2009>
This commit is contained in:
Romain Vimont 2021-01-04 08:16:32 +01:00
parent ed130e05d5
commit aa8b571389
4 changed files with 7 additions and 7 deletions

View file

@ -478,14 +478,14 @@ parse_port_range(const char *s, struct sc_port_range *port_range) {
} }
static bool static bool
parse_display_id(const char *s, uint16_t *display_id) { parse_display_id(const char *s, uint32_t *display_id) {
long value; 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) { if (!ok) {
return false; return false;
} }
*display_id = (uint16_t) value; *display_id = (uint32_t) value;
return true; return true;
} }

View file

@ -65,7 +65,7 @@ struct scrcpy_options {
int16_t window_y; // SC_WINDOW_POSITION_UNDEFINED for "auto" int16_t window_y; // SC_WINDOW_POSITION_UNDEFINED for "auto"
uint16_t window_width; uint16_t window_width;
uint16_t window_height; uint16_t window_height;
uint16_t display_id; uint32_t display_id;
bool show_touches; bool show_touches;
bool fullscreen; bool fullscreen;
bool always_on_top; bool always_on_top;

View file

@ -258,12 +258,12 @@ execute_server(struct server *server, const struct server_params *params) {
char bit_rate_string[11]; char bit_rate_string[11];
char max_fps_string[6]; char max_fps_string[6];
char lock_video_orientation_string[5]; 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(max_size_string, "%"PRIu16, params->max_size);
sprintf(bit_rate_string, "%"PRIu32, params->bit_rate); sprintf(bit_rate_string, "%"PRIu32, params->bit_rate);
sprintf(max_fps_string, "%"PRIu16, params->max_fps); sprintf(max_fps_string, "%"PRIu16, params->max_fps);
sprintf(lock_video_orientation_string, "%"PRIi8, params->lock_video_orientation); 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[] = { const char *const cmd[] = {
"shell", "shell",
"CLASSPATH=" DEVICE_SERVER_PATH, "CLASSPATH=" DEVICE_SERVER_PATH,

View file

@ -43,7 +43,7 @@ struct server_params {
uint16_t max_fps; uint16_t max_fps;
int8_t lock_video_orientation; int8_t lock_video_orientation;
bool control; bool control;
uint16_t display_id; uint32_t display_id;
bool show_touches; bool show_touches;
bool stay_awake; bool stay_awake;
bool force_adb_forward; bool force_adb_forward;