Rename adb functions to adb_exec_*
This paves the way to replace them by more user-friendly functions that will call them internally.
This commit is contained in:
parent
84334cf7db
commit
afb5a5e80f
5 changed files with 26 additions and 26 deletions
|
@ -148,8 +148,8 @@ adb_execute(const char *serial, const char *const adb_cmd[], size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_forward(const char *serial, uint16_t local_port,
|
adb_exec_forward(const char *serial, uint16_t local_port,
|
||||||
const char *device_socket_name) {
|
const char *device_socket_name) {
|
||||||
char local[4 + 5 + 1]; // tcp:PORT
|
char local[4 + 5 + 1]; // tcp:PORT
|
||||||
char remote[108 + 14 + 1]; // localabstract:NAME
|
char remote[108 + 14 + 1]; // localabstract:NAME
|
||||||
sprintf(local, "tcp:%" PRIu16, local_port);
|
sprintf(local, "tcp:%" PRIu16, local_port);
|
||||||
|
@ -159,7 +159,7 @@ adb_forward(const char *serial, uint16_t local_port,
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_forward_remove(const char *serial, uint16_t local_port) {
|
adb_exec_forward_remove(const char *serial, uint16_t local_port) {
|
||||||
char local[4 + 5 + 1]; // tcp:PORT
|
char local[4 + 5 + 1]; // tcp:PORT
|
||||||
sprintf(local, "tcp:%" PRIu16, local_port);
|
sprintf(local, "tcp:%" PRIu16, local_port);
|
||||||
const char *const adb_cmd[] = {"forward", "--remove", local};
|
const char *const adb_cmd[] = {"forward", "--remove", local};
|
||||||
|
@ -167,8 +167,8 @@ adb_forward_remove(const char *serial, uint16_t local_port) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_reverse(const char *serial, const char *device_socket_name,
|
adb_exec_reverse(const char *serial, const char *device_socket_name,
|
||||||
uint16_t local_port) {
|
uint16_t local_port) {
|
||||||
char local[4 + 5 + 1]; // tcp:PORT
|
char local[4 + 5 + 1]; // tcp:PORT
|
||||||
char remote[108 + 14 + 1]; // localabstract:NAME
|
char remote[108 + 14 + 1]; // localabstract:NAME
|
||||||
sprintf(local, "tcp:%" PRIu16, local_port);
|
sprintf(local, "tcp:%" PRIu16, local_port);
|
||||||
|
@ -178,7 +178,7 @@ adb_reverse(const char *serial, const char *device_socket_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_reverse_remove(const char *serial, const char *device_socket_name) {
|
adb_exec_reverse_remove(const char *serial, const char *device_socket_name) {
|
||||||
char remote[108 + 14 + 1]; // localabstract:NAME
|
char remote[108 + 14 + 1]; // localabstract:NAME
|
||||||
snprintf(remote, sizeof(remote), "localabstract:%s", device_socket_name);
|
snprintf(remote, sizeof(remote), "localabstract:%s", device_socket_name);
|
||||||
const char *const adb_cmd[] = {"reverse", "--remove", remote};
|
const char *const adb_cmd[] = {"reverse", "--remove", remote};
|
||||||
|
@ -186,7 +186,7 @@ adb_reverse_remove(const char *serial, const char *device_socket_name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_push(const char *serial, const char *local, const char *remote) {
|
adb_exec_push(const char *serial, const char *local, const char *remote) {
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
// Windows will parse the string, so the paths must be quoted
|
// Windows will parse the string, so the paths must be quoted
|
||||||
// (see sys/win/command.c)
|
// (see sys/win/command.c)
|
||||||
|
@ -213,7 +213,7 @@ adb_push(const char *serial, const char *local, const char *remote) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_install(const char *serial, const char *local) {
|
adb_exec_install(const char *serial, const char *local) {
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
// Windows will parse the string, so the local name must be quoted
|
// Windows will parse the string, so the local name must be quoted
|
||||||
// (see sys/win/command.c)
|
// (see sys/win/command.c)
|
||||||
|
@ -234,7 +234,7 @@ adb_install(const char *serial, const char *local) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_get_serialno(sc_pipe *pout) {
|
adb_exec_get_serialno(sc_pipe *pout) {
|
||||||
const char *const adb_cmd[] = {"get-serialno"};
|
const char *const adb_cmd[] = {"get-serialno"};
|
||||||
return adb_execute_p(NULL, adb_cmd, ARRAY_LEN(adb_cmd), pout);
|
return adb_execute_p(NULL, adb_cmd, ARRAY_LEN(adb_cmd), pout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,24 +16,24 @@ adb_execute_p(const char *serial, const char *const adb_cmd[], size_t len,
|
||||||
sc_pipe *pout);
|
sc_pipe *pout);
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_forward(const char *serial, uint16_t local_port,
|
adb_exec_forward(const char *serial, uint16_t local_port,
|
||||||
const char *device_socket_name);
|
const char *device_socket_name);
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_forward_remove(const char *serial, uint16_t local_port);
|
adb_exec_forward_remove(const char *serial, uint16_t local_port);
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_reverse(const char *serial, const char *device_socket_name,
|
adb_exec_reverse(const char *serial, const char *device_socket_name,
|
||||||
uint16_t local_port);
|
uint16_t local_port);
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_reverse_remove(const char *serial, const char *device_socket_name);
|
adb_exec_reverse_remove(const char *serial, const char *device_socket_name);
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_push(const char *serial, const char *local, const char *remote);
|
adb_exec_push(const char *serial, const char *local, const char *remote);
|
||||||
|
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_install(const char *serial, const char *local);
|
adb_exec_install(const char *serial, const char *local);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute `adb get-serialno`
|
* Execute `adb get-serialno`
|
||||||
|
@ -41,6 +41,6 @@ adb_install(const char *serial, const char *local);
|
||||||
* The result can be read from the output parameter `pout`.
|
* The result can be read from the output parameter `pout`.
|
||||||
*/
|
*/
|
||||||
sc_pid
|
sc_pid
|
||||||
adb_get_serialno(sc_pipe *pout);
|
adb_exec_get_serialno(sc_pipe *pout);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
static bool
|
static bool
|
||||||
enable_tunnel_reverse(struct sc_intr *intr, const char *serial,
|
enable_tunnel_reverse(struct sc_intr *intr, const char *serial,
|
||||||
uint16_t local_port) {
|
uint16_t local_port) {
|
||||||
sc_pid pid = adb_reverse(serial, SC_SOCKET_NAME, local_port);
|
sc_pid pid = adb_exec_reverse(serial, SC_SOCKET_NAME, local_port);
|
||||||
return sc_process_check_success_intr(intr, pid, "adb reverse", true);
|
return sc_process_check_success_intr(intr, pid, "adb reverse", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
disable_tunnel_reverse(struct sc_intr *intr, const char *serial) {
|
disable_tunnel_reverse(struct sc_intr *intr, const char *serial) {
|
||||||
sc_pid pid = adb_reverse_remove(serial, SC_SOCKET_NAME);
|
sc_pid pid = adb_exec_reverse_remove(serial, SC_SOCKET_NAME);
|
||||||
return sc_process_check_success_intr(intr, pid, "adb reverse --remove",
|
return sc_process_check_success_intr(intr, pid, "adb reverse --remove",
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
@ -26,14 +26,14 @@ disable_tunnel_reverse(struct sc_intr *intr, const char *serial) {
|
||||||
static bool
|
static bool
|
||||||
enable_tunnel_forward(struct sc_intr *intr, const char *serial,
|
enable_tunnel_forward(struct sc_intr *intr, const char *serial,
|
||||||
uint16_t local_port) {
|
uint16_t local_port) {
|
||||||
sc_pid pid = adb_forward(serial, local_port, SC_SOCKET_NAME);
|
sc_pid pid = adb_exec_forward(serial, local_port, SC_SOCKET_NAME);
|
||||||
return sc_process_check_success_intr(intr, pid, "adb forward", true);
|
return sc_process_check_success_intr(intr, pid, "adb forward", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
disable_tunnel_forward(struct sc_intr *intr, const char *serial,
|
disable_tunnel_forward(struct sc_intr *intr, const char *serial,
|
||||||
uint16_t local_port) {
|
uint16_t local_port) {
|
||||||
sc_pid pid = adb_forward_remove(serial, local_port);
|
sc_pid pid = adb_exec_forward_remove(serial, local_port);
|
||||||
return sc_process_check_success_intr(intr, pid, "adb forward --remove",
|
return sc_process_check_success_intr(intr, pid, "adb forward --remove",
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,10 +129,10 @@ run_file_handler(void *data) {
|
||||||
sc_pid pid;
|
sc_pid pid;
|
||||||
if (req.action == ACTION_INSTALL_APK) {
|
if (req.action == ACTION_INSTALL_APK) {
|
||||||
LOGI("Installing %s...", req.file);
|
LOGI("Installing %s...", req.file);
|
||||||
pid = adb_install(serial, req.file);
|
pid = adb_exec_install(serial, req.file);
|
||||||
} else {
|
} else {
|
||||||
LOGI("Pushing %s...", req.file);
|
LOGI("Pushing %s...", req.file);
|
||||||
pid = adb_push(serial, req.file, push_target);
|
pid = adb_exec_push(serial, req.file, push_target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.action == ACTION_INSTALL_APK) {
|
if (req.action == ACTION_INSTALL_APK) {
|
||||||
|
|
|
@ -112,7 +112,7 @@ push_server(struct sc_intr *intr, const char *serial) {
|
||||||
free(server_path);
|
free(server_path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sc_pid pid = adb_push(serial, server_path, SC_DEVICE_SERVER_PATH);
|
sc_pid pid = adb_exec_push(serial, server_path, SC_DEVICE_SERVER_PATH);
|
||||||
free(server_path);
|
free(server_path);
|
||||||
return sc_process_check_success_intr(intr, pid, "adb push", true);
|
return sc_process_check_success_intr(intr, pid, "adb push", true);
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,7 @@ sc_server_on_terminated(void *userdata) {
|
||||||
static char *
|
static char *
|
||||||
sc_server_get_serialno(struct sc_intr *intr) {
|
sc_server_get_serialno(struct sc_intr *intr) {
|
||||||
sc_pipe pout;
|
sc_pipe pout;
|
||||||
sc_pid pid = adb_get_serialno(&pout);
|
sc_pid pid = adb_exec_get_serialno(&pout);
|
||||||
if (pid == SC_PROCESS_NONE) {
|
if (pid == SC_PROCESS_NONE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue