Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa76c462 authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Give enum types CamelCase names for clarity."

parents 4eccbace 3bd73c12
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -696,7 +696,7 @@ int launch_server(int server_port)
// Try to handle a network forwarding request.
// This returns 1 on success, 0 on failure, and -1 to indicate this is not
// a forwarding-related request.
int handle_forward_request(const char* service, transport_type ttype, char* serial, int reply_fd)
int handle_forward_request(const char* service, TransportType type, char* serial, int reply_fd)
{
    if (!strcmp(service, "list-forward")) {
        // Create the list of forward redirections.
@@ -757,13 +757,13 @@ int handle_forward_request(const char* service, transport_type ttype, char* seri
        }

        std::string error_msg;
        transport = acquire_one_transport(CS_ANY, ttype, serial, &error_msg);
        transport = acquire_one_transport(CS_ANY, type, serial, &error_msg);
        if (!transport) {
            SendFail(reply_fd, error_msg);
            return 1;
        }

        install_status_t r;
        InstallStatus r;
        if (createForward) {
            r = install_listener(local, remote, transport, no_rebind);
        } else {
@@ -796,7 +796,7 @@ int handle_forward_request(const char* service, transport_type ttype, char* seri
    return 0;
}

int handle_host_request(char *service, transport_type ttype, char* serial, int reply_fd, asocket *s)
int handle_host_request(char *service, TransportType type, char* serial, int reply_fd, asocket *s)
{
    if(!strcmp(service, "kill")) {
        fprintf(stderr,"adb server killed by remote request\n");
@@ -813,7 +813,7 @@ int handle_host_request(char *service, transport_type ttype, char* serial, int r
    // "transport-local:" is used for switching transport to the only local transport
    // "transport-any:" is used for switching transport to the only transport
    if (!strncmp(service, "transport", strlen("transport"))) {
        transport_type type = kTransportAny;
        TransportType type = kTransportAny;

        if (!strncmp(service, "transport-usb", strlen("transport-usb"))) {
            type = kTransportUsb;
@@ -890,7 +890,7 @@ int handle_host_request(char *service, transport_type ttype, char* serial, int r

    if(!strncmp(service,"get-serialno",strlen("get-serialno"))) {
        const char *out = "unknown";
        transport = acquire_one_transport(CS_ANY, ttype, serial, NULL);
        transport = acquire_one_transport(CS_ANY, type, serial, NULL);
        if (transport && transport->serial) {
            out = transport->serial;
        }
@@ -900,7 +900,7 @@ int handle_host_request(char *service, transport_type ttype, char* serial, int r
    }
    if(!strncmp(service,"get-devpath",strlen("get-devpath"))) {
        const char *out = "unknown";
        transport = acquire_one_transport(CS_ANY, ttype, serial, NULL);
        transport = acquire_one_transport(CS_ANY, type, serial, NULL);
        if (transport && transport->devpath) {
            out = transport->devpath;
        }
@@ -917,14 +917,14 @@ int handle_host_request(char *service, transport_type ttype, char* serial, int r
    }

    if(!strncmp(service,"get-state",strlen("get-state"))) {
        transport = acquire_one_transport(CS_ANY, ttype, serial, NULL);
        transport = acquire_one_transport(CS_ANY, type, serial, NULL);
        SendOkay(reply_fd);
        SendProtocolString(reply_fd, transport->connection_state_name());
        return 0;
    }
#endif // ADB_HOST

    int ret = handle_forward_request(service, ttype, serial, reply_fd);
    int ret = handle_forward_request(service, type, serial, reply_fd);
    if (ret >= 0)
      return ret - 1;
    return -1;
+4 −9
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ struct adisconnect
** object, it's a special value used to indicate that a client wants to
** connect to a service implemented within the ADB server itself.
*/
enum transport_type {
enum TransportType {
        kTransportUsb,
        kTransportLocal,
        kTransportAny,
@@ -187,7 +187,7 @@ struct atransport
    unsigned sync_token;
    int connection_state;
    int online;
    transport_type type;
    TransportType type;

        /* usb handle or socket fd as needed */
    usb_handle *usb;
@@ -284,7 +284,7 @@ asocket* create_jdwp_tracker_service_socket();
int       create_jdwp_connection_fd(int  jdwp_pid);
#endif

int handle_forward_request(const char* service, transport_type ttype, char* serial, int reply_fd);
int handle_forward_request(const char* service, TransportType type, char* serial, int reply_fd);

#if !ADB_HOST
void framebuffer_service(int fd, void *cookie);
@@ -353,11 +353,6 @@ extern const char *adb_device_banner;
extern int HOST;
extern int SHELL_EXIT_NOTIFY_FD;

enum subproc_mode {
    SUBPROC_PTY = 0,
    SUBPROC_RAW = 1,
} ;

#define CHUNK_SIZE (64*1024)

#if !ADB_HOST
@@ -371,7 +366,7 @@ enum subproc_mode {
#define USB_FFS_ADB_IN    USB_FFS_ADB_EP(ep2)
#endif

int handle_host_request(char *service, transport_type ttype, char* serial, int reply_fd, asocket *s);
int handle_host_request(char *service, TransportType type, char* serial, int reply_fd, asocket *s);

void handle_online(atransport *t);
void handle_offline(atransport *t);
+2 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@

#include "adb_io.h"

static transport_type __adb_transport = kTransportAny;
static TransportType __adb_transport = kTransportAny;
static const char* __adb_serial = NULL;

static int __adb_server_port = DEFAULT_ADB_PORT;
@@ -64,7 +64,7 @@ static bool ReadProtocolString(int fd, std::string* s, std::string* error) {
    return true;
}

void adb_set_transport(transport_type type, const char* serial)
void adb_set_transport(TransportType type, const char* serial)
{
    __adb_transport = type;
    __adb_serial = serial;
+2 −3
Original line number Diff line number Diff line
@@ -21,9 +21,8 @@ int adb_command(const std::string& service, std::string* error);
// Returns true on success; returns false and fills 'error' on failure.
bool adb_query(const std::string& service, std::string* result, std::string* error);

/* Set the preferred transport to connect to.
*/
void adb_set_transport(transport_type type, const char* serial);
// Set the preferred transport to connect to.
void adb_set_transport(TransportType type, const char* serial);

/* Set TCP specifics of the transport to use
*/
+2 −3
Original line number Diff line number Diff line
@@ -160,8 +160,7 @@ std::string format_listeners() {
    return result;
}

install_status_t remove_listener(const char *local_name, atransport* transport)
{
InstallStatus remove_listener(const char *local_name, atransport* transport) {
    alistener *l;

    for (l = listener_list.next; l != &listener_list; l = l->next) {
@@ -185,7 +184,7 @@ void remove_all_listeners(void)
    }
}

install_status_t install_listener(const std::string& local_name,
InstallStatus install_listener(const std::string& local_name,
                                  const char *connect_to,
                                  atransport* transport,
                                  int no_rebind)
Loading