2021-01-03 13:55:15 +00:00
|
|
|
#ifndef SC_ADB_H
|
|
|
|
#define SC_ADB_H
|
|
|
|
|
2021-01-08 18:24:51 +00:00
|
|
|
#include "common.h"
|
|
|
|
|
2021-01-03 13:55:15 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
2021-11-18 21:08:15 +00:00
|
|
|
#include "util/intr.h"
|
2021-01-03 13:55:15 +00:00
|
|
|
|
2021-11-24 21:27:28 +00:00
|
|
|
#define SC_ADB_NO_STDOUT (1 << 0)
|
|
|
|
#define SC_ADB_NO_STDERR (1 << 1)
|
2021-11-25 21:05:38 +00:00
|
|
|
#define SC_ADB_NO_LOGERR (1 << 2)
|
2021-11-24 21:27:28 +00:00
|
|
|
|
2021-11-11 16:48:41 +00:00
|
|
|
sc_pid
|
2021-11-24 21:27:28 +00:00
|
|
|
adb_execute(const char *serial, const char *const adb_cmd[], size_t len,
|
|
|
|
unsigned flags);
|
2021-01-03 13:55:15 +00:00
|
|
|
|
2021-11-18 21:08:15 +00:00
|
|
|
bool
|
|
|
|
adb_forward(struct sc_intr *intr, const char *serial, uint16_t local_port,
|
2021-11-24 21:27:28 +00:00
|
|
|
const char *device_socket_name, unsigned flags);
|
2021-11-18 21:08:15 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
adb_forward_remove(struct sc_intr *intr, const char *serial,
|
2021-11-24 21:27:28 +00:00
|
|
|
uint16_t local_port, unsigned flags);
|
2021-11-18 21:08:15 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
adb_reverse(struct sc_intr *intr, const char *serial,
|
2021-11-24 21:27:28 +00:00
|
|
|
const char *device_socket_name, uint16_t local_port,
|
|
|
|
unsigned flags);
|
2021-11-18 21:08:15 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
adb_reverse_remove(struct sc_intr *intr, const char *serial,
|
2021-11-24 21:27:28 +00:00
|
|
|
const char *device_socket_name, unsigned flags);
|
2021-11-18 21:08:15 +00:00
|
|
|
|
|
|
|
bool
|
|
|
|
adb_push(struct sc_intr *intr, const char *serial, const char *local,
|
2021-11-24 21:27:28 +00:00
|
|
|
const char *remote, unsigned flags);
|
2021-11-18 21:08:15 +00:00
|
|
|
|
|
|
|
bool
|
2021-11-24 21:27:28 +00:00
|
|
|
adb_install(struct sc_intr *intr, const char *serial, const char *local,
|
|
|
|
unsigned flags);
|
2021-11-18 21:08:15 +00:00
|
|
|
|
2021-11-25 21:13:39 +00:00
|
|
|
/**
|
|
|
|
* Execute `adb tcpip <port>`
|
|
|
|
*/
|
|
|
|
bool
|
|
|
|
adb_tcpip(struct sc_intr *intr, const char *serial, uint16_t port,
|
|
|
|
unsigned flags);
|
|
|
|
|
2021-11-24 21:39:46 +00:00
|
|
|
/**
|
|
|
|
* Execute `adb connect <ip_port>`
|
|
|
|
*
|
|
|
|
* `ip_port` may not be NULL.
|
|
|
|
*/
|
|
|
|
bool
|
|
|
|
adb_connect(struct sc_intr *intr, const char *ip_port, unsigned flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute `adb disconnect [<ip_port>]`
|
|
|
|
*
|
|
|
|
* If `ip_port` is NULL, execute `adb disconnect`.
|
|
|
|
* Otherwise, execute `adb disconnect <ip_port>`.
|
|
|
|
*/
|
|
|
|
bool
|
|
|
|
adb_disconnect(struct sc_intr *intr, const char *ip_port, unsigned flags);
|
|
|
|
|
2021-11-25 21:18:36 +00:00
|
|
|
/**
|
|
|
|
* Execute `adb getprop <prop>`
|
|
|
|
*/
|
|
|
|
char *
|
|
|
|
adb_getprop(struct sc_intr *intr, const char *serial, const char *prop,
|
|
|
|
unsigned flags);
|
|
|
|
|
2021-11-18 21:08:15 +00:00
|
|
|
/**
|
|
|
|
* Execute `adb get-serialno`
|
|
|
|
*
|
|
|
|
* Return the result, to be freed by the caller, or NULL on error.
|
|
|
|
*/
|
|
|
|
char *
|
2021-11-24 21:27:28 +00:00
|
|
|
adb_get_serialno(struct sc_intr *intr, unsigned flags);
|
2021-11-18 21:08:15 +00:00
|
|
|
|
2021-11-25 21:11:59 +00:00
|
|
|
/**
|
|
|
|
* Attempt to retrieve the device IP
|
|
|
|
*
|
|
|
|
* Return the IP as a string of the form "xxx.xxx.xxx.xxx", to be freed by the
|
|
|
|
* caller, or NULL on error.
|
|
|
|
*/
|
|
|
|
char *
|
|
|
|
adb_get_device_ip(struct sc_intr *intr, const char *serial, unsigned flags);
|
|
|
|
|
2021-01-03 13:55:15 +00:00
|
|
|
#endif
|