Commit graph

23 commits

Author SHA1 Message Date
Romain Vimont
680d2cc940 Extract command argv building
This simplifies adb_execute_p().
2021-11-25 22:22:34 +01:00
Romain Vimont
b0eb1a55d6 Fix adb get-serialno error handling
If pipe read fails, return.
2021-11-25 22:22:34 +01:00
Romain Vimont
3653fb6b15 Add OutOfMemory log helper
Add a special LOG_OOM() function to log all OutOfMemory errors (i.e.
allocations returning NULL).
2021-11-24 22:06:49 +01:00
Romain Vimont
3fdbd994e0 Privatize low-level adb functions
Only expose the interruptible user-friendly API.
2021-11-19 07:25:03 +01:00
Romain Vimont
b7559744a7 Expose new user-friendly adb functions
Expose interruptible adb functions which return the expected result
directly, without exposing the process (sc_pid) to the caller.
2021-11-18 22:08:15 +01:00
Romain Vimont
afb5a5e80f Rename adb functions to adb_exec_*
This paves the way to replace them by more user-friendly functions that
will call them internally.
2021-11-18 21:47:17 +01:00
Romain Vimont
13fd693b50 Simplify adb_execute_p()
Only pass the stdout pipe as parameter, scrcpy never writes to stdin or
reads from stderr of an adb process.
2021-11-18 19:43:10 +01:00
Romain Vimont
0426ae885c Make "adb get-serialno" interruptible
All process executions must be interruptible, so that Ctrl+c reacts
immediately.
2021-11-18 19:41:41 +01:00
Romain Vimont
9619ade706 Generalize string trunctation util function
Add an additional argument to let the client pass the possible end
chars.
2021-11-18 18:48:16 +01:00
Romain Vimont
f2781a8b6d Expose util function to truncate first line
Move the local implementation from adb functions to the string util
functions.
2021-11-18 18:48:16 +01:00
Romain Vimont
632bd5697b Add missing error handling
If "adb get-serialno" fails, attempting to read from the uninitialized
pipe is incorrect.
2021-11-18 18:32:15 +01:00
Romain Vimont
057c7a4df4 Move str_util to str
Simplify naming.
2021-11-14 01:22:22 +01:00
Romain Vimont
979ce64dc0 Improve string util API
Use prefixed names and improve documentation.
2021-11-14 01:22:22 +01:00
Romain Vimont
aa011832c1 Improve process API
Prefix symbols and constants names and improve documentation.
2021-11-12 22:44:37 +01:00
Romain Vimont
fcc04f967b Improve file API
Prefix symbols and constants names and improve documentation.
2021-11-12 22:44:37 +01:00
Romain Vimont
d4c262301f Move functions from process to file
Move filesystem-related functions from process.[ch] to file.[ch].
2021-11-12 22:44:37 +01:00
Romain Vimont
d55015e4cf Expose function to get the device serial
Expose adb_get_serialno() to retrieve the device serial via the command
"adb getserialno".
2021-10-26 21:30:04 +02:00
Romain Vimont
96b18dabaa Expose adb execution with redirection
Expose the redirection feature to the adb API.
2021-10-26 21:30:04 +02:00
Wirtos_new
a9d9cbf8b5 Replace VLA by dynamic allocation
And increase the command buffer size.

Refs #1358 <https://github.com/Genymobile/scrcpy/issues/1358#issuecomment-862989748>
PR #2405 <https://github.com/Genymobile/scrcpy/pull/2405>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-06-20 21:16:42 +02:00
Wirtos_new
fda32928c1 Rename cmd to argv
This is more explicit.

PR #2405 <https://github.com/Genymobile/scrcpy/pull/2405>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-06-20 21:16:42 +02:00
Romain Vimont
30e619d37f Replace SDL_strdup() by strdup()
The functions SDL_malloc(), SDL_free() and SDL_strdup() were used only
because strdup() was not available everywhere.

Now that it is available, use the native version of these functions.
2021-02-17 09:54:03 +01:00
Romain Vimont
59feb2a15c Group common includes into common.h
Include config.h and compat.h in common.h, and include common.h from all
source files.
2021-01-08 19:22:10 +01:00
Romain Vimont
4bd9da4c93 Split command into process and adb
The process API provides the system-specific implementation, the adb API
uses it to expose adb commands.
2021-01-08 16:44:21 +01:00
Renamed from app/src/command.c (Browse further)