Loading adb/Android.mk +2 −2 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ LIBADB_windows_SRC_FILES := \ usb_windows.cpp \ include $(CLEAR_VARS) LOCAL_CLANG := $(ADB_CLANG) LOCAL_CLANG := true LOCAL_MODULE := libadbd LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0 LOCAL_SRC_FILES := \ Loading @@ -57,7 +57,7 @@ LOCAL_SRC_FILES := \ fdevent.cpp \ jdwp_service.cpp \ qemu_tracing.cpp \ usb_linux_client.c \ usb_linux_client.cpp \ include $(BUILD_STATIC_LIBRARY) Loading adb/usb_linux_client.c→adb/usb_linux_client.cpp +15 −29 Original line number Diff line number Diff line Loading @@ -239,12 +239,7 @@ static void usb_adb_kick(usb_handle *h) static void usb_adb_init() { usb_handle *h; adb_thread_t tid; int fd; h = calloc(1, sizeof(usb_handle)); usb_handle* h = reinterpret_cast<usb_handle*>(calloc(1, sizeof(usb_handle))); h->write = usb_adb_write; h->read = usb_adb_read; h->kick = usb_adb_kick; Loading @@ -258,7 +253,7 @@ static void usb_adb_init() // We never touch this file again - just leave it open // indefinitely so the kernel will know when we are running // and when we are not. fd = unix_open("/dev/android_adb_enable", O_RDWR); int fd = unix_open("/dev/android_adb_enable", O_RDWR); if (fd < 0) { D("failed to open /dev/android_adb_enable\n"); } else { Loading @@ -266,6 +261,7 @@ static void usb_adb_init() } D("[ usb_init - starting thread ]\n"); adb_thread_t tid; if(adb_thread_create(&tid, usb_adb_open_thread, h)){ fatal_errno("cannot create usb thread"); } Loading Loading @@ -375,7 +371,7 @@ static void *usb_ffs_open_thread(void *x) return 0; } static int bulk_write(int bulk_in, const char *buf, size_t length) static int bulk_write(int bulk_in, const uint8_t* buf, size_t length) { size_t count = 0; int ret; Loading @@ -396,20 +392,17 @@ static int bulk_write(int bulk_in, const char *buf, size_t length) static int usb_ffs_write(usb_handle* h, const void* data, int len) { int n; D("about to write (fd=%d, len=%d)\n", h->bulk_in, len); n = bulk_write(h->bulk_in, data, len); int n = bulk_write(h->bulk_in, reinterpret_cast<const uint8_t*>(data), len); if (n != len) { D("ERROR: fd = %d, n = %d, errno = %d (%s)\n", h->bulk_in, n, errno, strerror(errno)); D("ERROR: fd = %d, n = %d: %s\n", h->bulk_in, n, strerror(errno)); return -1; } D("[ done fd=%d ]\n", h->bulk_in); return 0; } static int bulk_read(int bulk_out, char *buf, size_t length) static int bulk_read(int bulk_out, uint8_t* buf, size_t length) { size_t count = 0; int ret; Loading @@ -432,13 +425,10 @@ static int bulk_read(int bulk_out, char *buf, size_t length) static int usb_ffs_read(usb_handle* h, void* data, int len) { int n; D("about to read (fd=%d, len=%d)\n", h->bulk_out, len); n = bulk_read(h->bulk_out, data, len); int n = bulk_read(h->bulk_out, reinterpret_cast<uint8_t*>(data), len); if (n != len) { D("ERROR: fd = %d, n = %d, errno = %d (%s)\n", h->bulk_out, n, errno, strerror(errno)); D("ERROR: fd = %d, n = %d: %s\n", h->bulk_out, n, strerror(errno)); return -1; } D("[ done fd=%d ]\n", h->bulk_out); Loading Loading @@ -473,17 +463,12 @@ static void usb_ffs_kick(usb_handle *h) static void usb_ffs_init() { usb_handle *h; adb_thread_t tid; D("[ usb_init - using FunctionFS ]\n"); h = calloc(1, sizeof(usb_handle)); usb_handle* h = reinterpret_cast<usb_handle*>(calloc(1, sizeof(usb_handle))); h->write = usb_ffs_write; h->read = usb_ffs_read; h->kick = usb_ffs_kick; h->control = -1; h->bulk_out = -1; h->bulk_out = -1; Loading @@ -492,6 +477,7 @@ static void usb_ffs_init() adb_mutex_init(&h->lock, 0); D("[ usb_init - starting thread ]\n"); adb_thread_t tid; if (adb_thread_create(&tid, usb_ffs_open_thread, h)){ fatal_errno("[ cannot create usb thread ]\n"); } Loading Loading
adb/Android.mk +2 −2 Original line number Diff line number Diff line Loading @@ -48,7 +48,7 @@ LIBADB_windows_SRC_FILES := \ usb_windows.cpp \ include $(CLEAR_VARS) LOCAL_CLANG := $(ADB_CLANG) LOCAL_CLANG := true LOCAL_MODULE := libadbd LOCAL_CFLAGS := $(LIBADB_CFLAGS) -DADB_HOST=0 LOCAL_SRC_FILES := \ Loading @@ -57,7 +57,7 @@ LOCAL_SRC_FILES := \ fdevent.cpp \ jdwp_service.cpp \ qemu_tracing.cpp \ usb_linux_client.c \ usb_linux_client.cpp \ include $(BUILD_STATIC_LIBRARY) Loading
adb/usb_linux_client.c→adb/usb_linux_client.cpp +15 −29 Original line number Diff line number Diff line Loading @@ -239,12 +239,7 @@ static void usb_adb_kick(usb_handle *h) static void usb_adb_init() { usb_handle *h; adb_thread_t tid; int fd; h = calloc(1, sizeof(usb_handle)); usb_handle* h = reinterpret_cast<usb_handle*>(calloc(1, sizeof(usb_handle))); h->write = usb_adb_write; h->read = usb_adb_read; h->kick = usb_adb_kick; Loading @@ -258,7 +253,7 @@ static void usb_adb_init() // We never touch this file again - just leave it open // indefinitely so the kernel will know when we are running // and when we are not. fd = unix_open("/dev/android_adb_enable", O_RDWR); int fd = unix_open("/dev/android_adb_enable", O_RDWR); if (fd < 0) { D("failed to open /dev/android_adb_enable\n"); } else { Loading @@ -266,6 +261,7 @@ static void usb_adb_init() } D("[ usb_init - starting thread ]\n"); adb_thread_t tid; if(adb_thread_create(&tid, usb_adb_open_thread, h)){ fatal_errno("cannot create usb thread"); } Loading Loading @@ -375,7 +371,7 @@ static void *usb_ffs_open_thread(void *x) return 0; } static int bulk_write(int bulk_in, const char *buf, size_t length) static int bulk_write(int bulk_in, const uint8_t* buf, size_t length) { size_t count = 0; int ret; Loading @@ -396,20 +392,17 @@ static int bulk_write(int bulk_in, const char *buf, size_t length) static int usb_ffs_write(usb_handle* h, const void* data, int len) { int n; D("about to write (fd=%d, len=%d)\n", h->bulk_in, len); n = bulk_write(h->bulk_in, data, len); int n = bulk_write(h->bulk_in, reinterpret_cast<const uint8_t*>(data), len); if (n != len) { D("ERROR: fd = %d, n = %d, errno = %d (%s)\n", h->bulk_in, n, errno, strerror(errno)); D("ERROR: fd = %d, n = %d: %s\n", h->bulk_in, n, strerror(errno)); return -1; } D("[ done fd=%d ]\n", h->bulk_in); return 0; } static int bulk_read(int bulk_out, char *buf, size_t length) static int bulk_read(int bulk_out, uint8_t* buf, size_t length) { size_t count = 0; int ret; Loading @@ -432,13 +425,10 @@ static int bulk_read(int bulk_out, char *buf, size_t length) static int usb_ffs_read(usb_handle* h, void* data, int len) { int n; D("about to read (fd=%d, len=%d)\n", h->bulk_out, len); n = bulk_read(h->bulk_out, data, len); int n = bulk_read(h->bulk_out, reinterpret_cast<uint8_t*>(data), len); if (n != len) { D("ERROR: fd = %d, n = %d, errno = %d (%s)\n", h->bulk_out, n, errno, strerror(errno)); D("ERROR: fd = %d, n = %d: %s\n", h->bulk_out, n, strerror(errno)); return -1; } D("[ done fd=%d ]\n", h->bulk_out); Loading Loading @@ -473,17 +463,12 @@ static void usb_ffs_kick(usb_handle *h) static void usb_ffs_init() { usb_handle *h; adb_thread_t tid; D("[ usb_init - using FunctionFS ]\n"); h = calloc(1, sizeof(usb_handle)); usb_handle* h = reinterpret_cast<usb_handle*>(calloc(1, sizeof(usb_handle))); h->write = usb_ffs_write; h->read = usb_ffs_read; h->kick = usb_ffs_kick; h->control = -1; h->bulk_out = -1; h->bulk_out = -1; Loading @@ -492,6 +477,7 @@ static void usb_ffs_init() adb_mutex_init(&h->lock, 0); D("[ usb_init - starting thread ]\n"); adb_thread_t tid; if (adb_thread_create(&tid, usb_ffs_open_thread, h)){ fatal_errno("[ cannot create usb thread ]\n"); } Loading