Romain Vimont
8e4d3beb01
Fix return value on adb commands error
4 years ago
Romain Vimont
800ba33ff4
Add function to read an adb property
...
This will allow to read the property "service.adb.tcp.port" to know if
the TCP/IP mode is enabled on the device, and which listening port is
used.
PR #2827 <https://github.com/Genymobile/scrcpy/pull/2827 >
4 years ago
Romain Vimont
8543d842ea
Add function to switch device to TCP/IP mode
...
Expose a function to execute "adb tcpip <port>".
PR #2827 <https://github.com/Genymobile/scrcpy/pull/2827 >
4 years ago
Romain Vimont
f609b406c9
Add function to find the device IP address
...
Parse the result of "adb shell ip route" to find the device IP address.
PR #2827 <https://github.com/Genymobile/scrcpy/pull/2827 >
4 years ago
Romain Vimont
3bf6fd2894
Workaround "adb connect" error detection
...
"adb connect" always returns successfully (with exit code 0), even in
case of failure.
As a workaround, capture its output and check if it starts with
"connected".
PR #2827 <https://github.com/Genymobile/scrcpy/pull/2827 >
4 years ago
Romain Vimont
bfce22414f
Add adb connect and disconnect
...
PR #2827 <https://github.com/Genymobile/scrcpy/pull/2827 >
4 years ago
Romain Vimont
e6e6f865a0
Add adb flag to disable execution error logs
...
In addition to disable stdout and stderr of the child process, add a
flag to disable the error log printed by scrcpy if the command failed.
This will we useful for commands which are expected to fail in some
cases (like "adb disconnect" if the device is not connected).
PR #2827 <https://github.com/Genymobile/scrcpy/pull/2827 >
4 years ago
Romain Vimont
e3d4aa8c5d
Use flags for adb commands
...
Explicitly indicate, for each adb call, if stdout and stderr must be
inherited.
PR #2827 <https://github.com/Genymobile/scrcpy/pull/2827 >
4 years ago
Romain Vimont
f801d8b312
Expose flags for process execution
...
Let the caller decide if stdout and stderr must be inherited on process
creation, i.e. if stdout and stderr of the child process should be
printed in the scrcpy console.
This allows to get output and errors for specific adb commands depending
on the context.
PR #2827 <https://github.com/Genymobile/scrcpy/pull/2827 >
4 years ago
Romain Vimont
3e54773c48
Remove intermediate static functions from adb.c
...
They can easily be inlined into the public functions.
4 years ago
Romain Vimont
904f0ae61e
Check process success locally for adb commands
...
Remove sc_process_check_success() from the process API, it is too
specific.
4 years ago
Romain Vimont
680d2cc940
Extract command argv building
...
This simplifies adb_execute_p().
4 years ago
Romain Vimont
b0eb1a55d6
Fix adb get-serialno error handling
...
If pipe read fails, return.
4 years ago
Romain Vimont
3653fb6b15
Add OutOfMemory log helper
...
Add a special LOG_OOM() function to log all OutOfMemory errors (i.e.
allocations returning NULL).
4 years ago
Romain Vimont
3fdbd994e0
Privatize low-level adb functions
...
Only expose the interruptible user-friendly API.
4 years ago
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.
4 years ago
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.
4 years ago
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.
4 years ago
Romain Vimont
0426ae885c
Make "adb get-serialno" interruptible
...
All process executions must be interruptible, so that Ctrl+c reacts
immediately.
4 years ago
Romain Vimont
9619ade706
Generalize string trunctation util function
...
Add an additional argument to let the client pass the possible end
chars.
4 years ago
Romain Vimont
f2781a8b6d
Expose util function to truncate first line
...
Move the local implementation from adb functions to the string util
functions.
4 years ago
Romain Vimont
632bd5697b
Add missing error handling
...
If "adb get-serialno" fails, attempting to read from the uninitialized
pipe is incorrect.
4 years ago
Romain Vimont
057c7a4df4
Move str_util to str
...
Simplify naming.
4 years ago
Romain Vimont
979ce64dc0
Improve string util API
...
Use prefixed names and improve documentation.
4 years ago
Romain Vimont
aa011832c1
Improve process API
...
Prefix symbols and constants names and improve documentation.
4 years ago
Romain Vimont
fcc04f967b
Improve file API
...
Prefix symbols and constants names and improve documentation.
4 years ago
Romain Vimont
d4c262301f
Move functions from process to file
...
Move filesystem-related functions from process.[ch] to file.[ch].
4 years ago
Romain Vimont
d55015e4cf
Expose function to get the device serial
...
Expose adb_get_serialno() to retrieve the device serial via the command
"adb getserialno".
4 years ago
Romain Vimont
96b18dabaa
Expose adb execution with redirection
...
Expose the redirection feature to the adb API.
4 years ago
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>
5 years ago
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>
5 years ago
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.
5 years ago
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.
5 years ago
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.
5 years ago