The process API provides the system-specific implementation, the adb API uses it to expose adb commands.master
parent
aa8b571389
commit
4bd9da4c93
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef SC_ADB_H
|
||||||
|
#define SC_ADB_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "util/process.h"
|
||||||
|
|
||||||
|
process_t
|
||||||
|
adb_execute(const char *serial, const char *const adb_cmd[], size_t len);
|
||||||
|
|
||||||
|
process_t
|
||||||
|
adb_forward(const char *serial, uint16_t local_port,
|
||||||
|
const char *device_socket_name);
|
||||||
|
|
||||||
|
process_t
|
||||||
|
adb_forward_remove(const char *serial, uint16_t local_port);
|
||||||
|
|
||||||
|
process_t
|
||||||
|
adb_reverse(const char *serial, const char *device_socket_name,
|
||||||
|
uint16_t local_port);
|
||||||
|
|
||||||
|
process_t
|
||||||
|
adb_reverse_remove(const char *serial, const char *device_socket_name);
|
||||||
|
|
||||||
|
process_t
|
||||||
|
adb_push(const char *serial, const char *local, const char *remote);
|
||||||
|
|
||||||
|
process_t
|
||||||
|
adb_install(const char *serial, const char *local);
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
#include "process.h"
|
||||||
|
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
bool
|
||||||
|
process_check_success(process_t proc, const char *name) {
|
||||||
|
if (proc == PROCESS_NONE) {
|
||||||
|
LOGE("Could not execute \"%s\"", name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
exit_code_t exit_code;
|
||||||
|
if (!process_simple_wait(proc, &exit_code)) {
|
||||||
|
if (exit_code != NO_EXIT_CODE) {
|
||||||
|
LOGE("\"%s\" returned with value %" PRIexitcode, name, exit_code);
|
||||||
|
} else {
|
||||||
|
LOGE("\"%s\" exited unexpectedly", name);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Loading…
Reference in new issue