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

Commit 4c38a921 authored by Josh Gao's avatar Josh Gao Committed by Gerrit Code Review
Browse files

Merge changes I21eefab9,I0ac7d78a

* changes:
  adb: move usb_* to client/usb_*.
  adb: reorganize adbd USB handling code.
parents 9e60a54f 456e1ad4
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -81,22 +81,36 @@ LIBADB_windows_CFLAGS := \

LIBADB_darwin_SRC_FILES := \
    sysdeps_unix.cpp \
    usb_osx.cpp \
    client/usb_osx.cpp \

LIBADB_linux_SRC_FILES := \
    sysdeps_unix.cpp \
    usb_linux.cpp \
    client/usb_linux.cpp \

LIBADB_windows_SRC_FILES := \
    sysdeps_win32.cpp \
    sysdeps/win32/errno.cpp \
    sysdeps/win32/stat.cpp \
    usb_windows.cpp \
    client/usb_windows.cpp \

LIBADB_TEST_windows_SRCS := \
    sysdeps/win32/errno_test.cpp \
    sysdeps_win32_test.cpp \

include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_MODULE := libadbd_usb
LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0
LOCAL_SRC_FILES := daemon/usb.cpp

LOCAL_SANITIZE := $(adb_target_sanitize)

# Even though we're building a static library (and thus there's no link step for
# this to take effect), this adds the includes to our path.
LOCAL_STATIC_LIBRARIES := libcrypto_utils libcrypto libbase

include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_CLANG := true
LOCAL_MODULE := libadbd
@@ -105,7 +119,6 @@ LOCAL_SRC_FILES := \
    $(LIBADB_SRC_FILES) \
    adbd_auth.cpp \
    jdwp_service.cpp \
    usb_linux_client.cpp \

LOCAL_SANITIZE := $(adb_target_sanitize)

@@ -113,6 +126,8 @@ LOCAL_SANITIZE := $(adb_target_sanitize)
# this to take effect), this adds the includes to our path.
LOCAL_STATIC_LIBRARIES := libcrypto_utils libcrypto libbase

LOCAL_WHOLE_STATIC_LIBRARIES := libadbd_usb

include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
@@ -346,3 +361,5 @@ LOCAL_STATIC_LIBRARIES := \
    libdebuggerd_handler \

include $(BUILD_EXECUTABLE)

include $(call first-makefiles-under,$(LOCAL_PATH))
+0 −0

File moved.

+0 −0

File moved.

+0 −0

File moved.

+7 −27
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#include <android-base/properties.h>

#include "adb.h"
#include "daemon/usb.h"
#include "transport.h"

using namespace std::chrono_literals;
@@ -60,26 +61,6 @@ using namespace std::chrono_literals;

static int dummy_fd = -1;

struct usb_handle {
    usb_handle() : kicked(false) {
    }

    std::condition_variable notify;
    std::mutex lock;
    std::atomic<bool> kicked;
    bool open_new_connection = true;

    int (*write)(usb_handle *h, const void *data, int len);
    int (*read)(usb_handle *h, void *data, int len);
    void (*kick)(usb_handle *h);
    void (*close)(usb_handle *h);

    // FunctionFS
    int control = -1;
    int bulk_out = -1; /* "out" from the host's perspective => source for adbd */
    int bulk_in = -1;  /* "in" from the host's perspective => sink for adbd */
};

struct func_desc {
    struct usb_interface_descriptor intf;
    struct usb_endpoint_descriptor_no_audio source;
@@ -223,7 +204,6 @@ static struct usb_os_desc_header os_desc_header = {
    .Reserved = cpu_to_le32(0),
};


#define STR_INTERFACE_ "ADB Interface"

static const struct {
@@ -245,7 +225,7 @@ static const struct {
    },
};

static bool init_functionfs(struct usb_handle* h) {
bool init_functionfs(struct usb_handle* h) {
    ssize_t ret;
    struct desc_v1 v1_descriptor;
    struct desc_v2 v2_descriptor;
Loading