Romain Vimont
3ada5c51bc
Rename scrcpy threads
...
Prefix the name of threads by "scrcpy-". This improves readability in
the output of `top -H` for example.
Limit the thread names to 16 bytes, because it is limited on some
platforms.
3 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 >
3 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).
3 years ago
Romain Vimont
73e0311d14
Add missing return on file_handler failure
...
Mistake introduced by 84334cf7db
.
3 years ago
Romain Vimont
ce225f019a
Use new user-friendly adb API
...
Replace the adb_exec_*() calls by the new adb functions to simplify.
3 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.
3 years ago
Romain Vimont
84334cf7db
Use sc_intr in file_handler
...
Replace manual interruption handling by the recent sc_intr mechanism.
3 years ago
Romain Vimont
0ba2686e1d
Simplify file_handler
...
Call the target functions directly.
3 years ago
Romain Vimont
55648d4d64
Improve file_handler readability
...
Use local variables as short name aliases.
3 years ago
Romain Vimont
443cb14d6e
Assume non-NULL serial in file_handler
...
The previous commit guarantees to always initialize the serial, so the
file_handle may assume it is never NULL.
3 years ago
Romain Vimont
aa011832c1
Improve process API
...
Prefix symbols and constants names and improve documentation.
3 years ago
Romain Vimont
a1f2094787
Push to /sdcard/Download/ by default
...
Change the default push target from /sdcard/ to /sdcard/Download/.
Pushing to the root of /sdcard/ is not very convenient, many apps do not
expose its content directly.
It can still be changed by --push-target.
PR #2384 <https://github.com/Genymobile/scrcpy/pull/2384 >
3 years ago
Romain Vimont
f6320c7e31
Wrap SDL thread functions into scrcpy-specific API
...
The goal is to expose a consistent API for system tools, and paves the
way to make the "core" independant of SDL in the future.
4 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.
4 years ago
Romain Vimont
d8e9ad20b0
Improve file handler error message
...
Terminating the file handler current process may be either a "push" or
"install" command.
4 years ago
Romain Vimont
7afd149f4b
Fix file_handler process race condition
...
The current process could be waited both by run_file_handler() and
file_handler_stop().
To avoid the race condition, wait the process without closing, then
close with mutex locked.
4 years ago
Romain Vimont
6a50231698
Expose a single process_wait()
...
There were two versions: process_wait() and process_wait_noclose().
Expose a single version with a flag (it was already implemented that way
internally).
4 years ago
Romain Vimont
b8edcf52b0
Simplify process_wait()
...
The function process_wait() returned a bool (true if the process
terminated successfully) and provided the exit code via an output
parameter exit_code.
But the returned value was always equivalent to exit_code == 0, so just
return the exit code instead.
4 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.
4 years ago
Romain Vimont
821c175730
Rename process_simple_wait to process_wait
...
Adding "simple" in the function name brings no benefit.
4 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.
4 years ago
Romain Vimont
510caff0cd
Replace SDL_assert() by assert()
...
SDL_assert() open a dialog on assertion failure.
There is no reason not to use assert() directly.
5 years ago
Romain Vimont
dfd0707a29
Move utilities to util/
5 years ago
Romain Vimont
a90ccbdf3b
Add option to change the push target
...
A drag & drop always pushed the file to /sdcard/.
Add an option to customize the target directory.
Fixes <https://github.com/Genymobile/scrcpy/issues/659 >
5 years ago
Romain Vimont
056e47e752
Replace "cannot" by "could not"
5 years ago
Romain Vimont
073181b294
Use cbuf for file handler request queue
...
Replace the file_handler_request_queue implementation by cbuf.
5 years ago
Romain Vimont
507b0bcccf
Fix memory leak on error
...
The variable condition was not destroyed on strdup() failure.
5 years ago
Romain Vimont
a41dd6c79f
Make owned filename a pointer-to-non-const
...
The file handler owns the filename string, so it needs to free it.
Therefore, it should not be a pointer-to-const.
5 years ago
Romain Vimont
c3779d8513
Make owned serial a pointer-to-non-const
...
The file handler owns the serial, so it needs to free it. Therefore, it
should not be a pointer-to-const.
5 years ago
Romain Vimont
b3bd5f1b80
Remove useless casts to (void *)
5 years ago
Romain Vimont
dfed1b250e
Replace SDL types by C99 standard types
...
Scrcpy is a C11 project. Use the C99 standard types instead of the
SDL-specific types:
SDL_bool -> bool
SintXX -> intXX_t
UintXX -> uintXX_t
6 years ago
Romain Vimont
aeda583a2c
Update code style
...
Limit source code to 80 chars, and declare functions return type and
modifiers on a separate line.
This allows to avoid very long lines, and all function names are
aligned.
(We do this on VLC, and I like it.)
6 years ago
Romain Vimont
536b31829a
Separate multi-words filenames by '_'
...
Rename foobar.ext to foo_bar.ext.
<https://github.com/Genymobile/scrcpy/pull/226#discussion_r209454865 >
6 years ago
Romain Vimont
6581f9feb9
Make request_queue functions static
...
These functions are local to file_handler.c.
6 years ago
Romain Vimont
359685b1db
Simplify SDL_assert() calls
...
SDL_assert() already prevents "unused variable" warnings.
6 years ago
Romain Vimont
4527be4cde
Add missing include config.h
...
When config.h is not included, BUILD_DEBUG is not set.
6 years ago
npes87184
66f45f9dae
Support drag&drop a file to transfer it to device
...
Signed-off-by: npes87184 <npes87184@gmail.com>
6 years ago
npes87184
aa97eed24b
installer -> file_handler
...
Signed-off-by: npes87184 <npes87184@gmail.com>
6 years ago