Compare commits

..

9 Commits

Author SHA1 Message Date
Romain Vimont
be6c6325d9 hw_dec 2022-03-14 21:29:07 +01:00
Romain Vimont
b1dbc30072 Document exit status in --help
Refs #3085 <https://github.com/Genymobile/scrcpy/pull/3085>
2022-03-10 09:13:21 +01:00
martin f. krafft
b3f5dfe1de Add specific exit code for device disconnection
Modify the return logic such that exit code 1 is used when the initial
connection fails, but if a session is established, and then the device
disconnects, exit code 2 is emitted.

Fixes #3083 <https://github.com/Genymobile/scrcpy/issues/3083>
PR #3085 <https://github.com/Genymobile/scrcpy/pull/3085>
Signed-off-by: martin f. krafft <madduck@madduck.net>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2022-03-06 22:19:46 +01:00
Romain Vimont
1f4c801f3c Report server connection state
We must distinguish 3 cases for await_for_server():
 - an error occurred
 - no error occurred, the device is connected
 - no error occurred, the device is not connected (user requested to
   quit)

For this purpose, use an additional output parameter to indicate if the
device is connected (only set when no error occurs).

Refs #3085 <https://github.com/Genymobile/scrcpy/pull/3085>
2022-03-06 22:16:13 +01:00
Romain Vimont
8d91cda4f6 Improve HID event push error message
On HID event push failure, add the event type in the error message.
2022-02-24 23:28:20 +01:00
Romain Vimont
59656fe649 Fix typo in error message 2022-02-24 23:26:12 +01:00
Romain Vimont
e4bb2b8728 Add libusb error log
Log libusb_get_string_descriptor_ascii() errors.

Refs #3050 <https://github.com/Genymobile/scrcpy/issues/3050>
2022-02-24 23:25:02 +01:00
Romain Vimont
adbe7908c6 Fix icon path in README
The data/ directory was moved to app/data/.

Refs 36c75e15b8
2022-02-23 01:21:18 +01:00
Romain Vimont
49434da36e Update links to v1.23 2022-02-22 23:48:00 +01:00
16 changed files with 178 additions and 51 deletions

View File

@@ -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:

View File

@@ -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]:

View File

@@ -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)

View File

@@ -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;
@@ -662,7 +667,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 +921,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 +978,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

View File

@@ -2,6 +2,7 @@
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#include <libavutil/pixdesc.h>
#include "events.h" #include "events.h"
#include "video_buffer.h" #include "video_buffer.h"
@@ -11,6 +12,39 @@
/** Downcast packet_sink to decoder */ /** Downcast packet_sink to decoder */
#define DOWNCAST(SINK) container_of(SINK, struct sc_decoder, packet_sink) #define DOWNCAST(SINK) container_of(SINK, struct sc_decoder, packet_sink)
static int hw_decoder_init(struct sc_decoder *decoder, const enum AVHWDeviceType type)
{
int err = 0;
AVBufferRef *hw_device_ctx;
if ((err = av_hwdevice_ctx_create(&hw_device_ctx, type,
NULL, NULL, 0)) < 0) {
LOGE("Failed to create specified HW device.");
return err;
}
decoder->codec_ctx->hw_device_ctx = av_buffer_ref(hw_device_ctx);
return err;
}
static enum AVPixelFormat get_hw_format(AVCodecContext *ctx,
const enum AVPixelFormat *pix_fmts)
{
(void) ctx;
const enum AVPixelFormat *p;
LOGD("== get_hw_format ==");
for (p = pix_fmts; *p != AV_PIX_FMT_NONE; p++) {
LOGD("==== %s (%d)", av_get_pix_fmt_name(*p), *p);
if (*p == AV_PIX_FMT_VAAPI)
return *p;
}
LOGE("Failed to get HW surface format.");
return AV_PIX_FMT_NONE;
}
static void static void
sc_decoder_close_first_sinks(struct sc_decoder *decoder, unsigned count) { sc_decoder_close_first_sinks(struct sc_decoder *decoder, unsigned count) {
while (count) { while (count) {
@@ -48,6 +82,10 @@ sc_decoder_open(struct sc_decoder *decoder, const AVCodec *codec) {
decoder->codec_ctx->flags |= AV_CODEC_FLAG_LOW_DELAY; decoder->codec_ctx->flags |= AV_CODEC_FLAG_LOW_DELAY;
int r = hw_decoder_init(decoder, AV_HWDEVICE_TYPE_VAAPI);
assert(!r);
decoder->codec_ctx->get_format = get_hw_format;
if (avcodec_open2(decoder->codec_ctx, codec, NULL) < 0) { if (avcodec_open2(decoder->codec_ctx, codec, NULL) < 0) {
LOGE("Could not open codec"); LOGE("Could not open codec");
avcodec_free_context(&decoder->codec_ctx); avcodec_free_context(&decoder->codec_ctx);
@@ -62,6 +100,9 @@ sc_decoder_open(struct sc_decoder *decoder, const AVCodec *codec) {
return false; return false;
} }
decoder->hw_frame = av_frame_alloc();
assert(decoder->hw_frame);
if (!sc_decoder_open_sinks(decoder)) { if (!sc_decoder_open_sinks(decoder)) {
LOGE("Could not open decoder sinks"); LOGE("Could not open decoder sinks");
av_frame_free(&decoder->frame); av_frame_free(&decoder->frame);
@@ -76,6 +117,7 @@ sc_decoder_open(struct sc_decoder *decoder, const AVCodec *codec) {
static void static void
sc_decoder_close(struct sc_decoder *decoder) { sc_decoder_close(struct sc_decoder *decoder) {
sc_decoder_close_sinks(decoder); sc_decoder_close_sinks(decoder);
av_frame_free(&decoder->hw_frame);
av_frame_free(&decoder->frame); av_frame_free(&decoder->frame);
avcodec_close(decoder->codec_ctx); avcodec_close(decoder->codec_ctx);
avcodec_free_context(&decoder->codec_ctx); avcodec_free_context(&decoder->codec_ctx);
@@ -107,15 +149,26 @@ sc_decoder_push(struct sc_decoder *decoder, const AVPacket *packet) {
LOGE("Could not send video packet: %d", ret); LOGE("Could not send video packet: %d", ret);
return false; return false;
} }
ret = avcodec_receive_frame(decoder->codec_ctx, decoder->frame); ret = avcodec_receive_frame(decoder->codec_ctx, decoder->hw_frame);
if (!ret) { if (!ret) {
// a frame was received // a frame was received
sc_tick t = sc_tick_now();
ret = av_hwframe_transfer_data(decoder->frame, decoder->hw_frame, 0);
if (ret < 0) {
LOGE("HWFRAME transfer fail");
return false;
}
LOGD("av_hwframe_transfer_data: %ld", sc_tick_now() - t);
bool ok = push_frame_to_sinks(decoder, decoder->frame); bool ok = push_frame_to_sinks(decoder, decoder->frame);
// A frame lost should not make the whole pipeline fail. The error, if // A frame lost should not make the whole pipeline fail. The error, if
// any, is already logged. // any, is already logged.
(void) ok; (void) ok;
av_frame_unref(decoder->frame); av_frame_unref(decoder->frame);
av_frame_unref(decoder->hw_frame);
} else if (ret != AVERROR(EAGAIN)) { } else if (ret != AVERROR(EAGAIN)) {
LOGE("Could not receive video frame: %d", ret); LOGE("Could not receive video frame: %d", ret);
return false; return false;

View File

@@ -19,6 +19,7 @@ struct sc_decoder {
AVCodecContext *codec_ctx; AVCodecContext *codec_ctx;
AVFrame *frame; AVFrame *frame;
AVFrame *hw_frame;
}; };
void void

View File

@@ -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;
} }

View File

@@ -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, &params, &cbs, NULL)) { if (!sc_server_init(&s->server, &params, &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;
} }

View File

@@ -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

View File

@@ -244,7 +244,7 @@ static inline SDL_Texture *
create_texture(struct sc_screen *screen) { create_texture(struct sc_screen *screen) {
SDL_Renderer *renderer = screen->renderer; SDL_Renderer *renderer = screen->renderer;
struct sc_size size = screen->frame_size; struct sc_size size = screen->frame_size;
SDL_Texture *texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_Texture *texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_NV12,
SDL_TEXTUREACCESS_STREAMING, SDL_TEXTUREACCESS_STREAMING,
size.width, size.height); size.width, size.height);
if (!texture) { if (!texture) {
@@ -711,10 +711,11 @@ prepare_for_frame(struct sc_screen *screen, struct sc_size new_frame_size) {
// write the frame into the texture // write the frame into the texture
static void static void
update_texture(struct sc_screen *screen, const AVFrame *frame) { update_texture(struct sc_screen *screen, const AVFrame *frame) {
SDL_UpdateYUVTexture(screen->texture, NULL, // SDL_UpdateYUVTexture(screen->texture, NULL,
frame->data[0], frame->linesize[0], // frame->data[0], frame->linesize[0],
frame->data[1], frame->linesize[1], // frame->data[1], frame->linesize[1],
frame->data[2], frame->linesize[2]); // frame->data[2], frame->linesize[2]);
SDL_UpdateTexture(screen->texture, NULL, frame->data[0], frame->linesize[0]);
if (screen->mipmaps) { if (screen->mipmaps) {
SDL_GL_BindTexture(screen->texture, NULL, NULL); SDL_GL_BindTexture(screen->texture, NULL, NULL);

View File

@@ -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)");
} }
} }
} }

View File

@@ -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)");
} }
} }

View File

@@ -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;

View File

@@ -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

View File

@@ -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;
} }

View File

@@ -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