Loading adb/Android.mk +4 −0 Original line number Original line Diff line number Diff line Loading @@ -53,10 +53,13 @@ LOCAL_SRC_FILES := \ $(USB_SRCS) \ $(USB_SRCS) \ shlist.c \ shlist.c \ utils.c \ utils.c \ usb_vendors.c \ ifneq ($(USE_SYSDEPS_WIN32),) ifneq ($(USE_SYSDEPS_WIN32),) LOCAL_SRC_FILES += sysdeps_win32.c LOCAL_SRC_FILES += sysdeps_win32.c else LOCAL_SRC_FILES += fdevent.c endif endif LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter Loading Loading @@ -98,6 +101,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \ adb.c \ adb.c \ fdevent.c \ transport.c \ transport.c \ transport_local.c \ transport_local.c \ transport_usb.c \ transport_usb.c \ Loading adb/adb.c +6 −13 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,8 @@ #if !ADB_HOST #if !ADB_HOST #include <private/android_filesystem_config.h> #include <private/android_filesystem_config.h> #else #include "usb_vendors.h" #endif #endif Loading Loading @@ -818,19 +820,6 @@ int adb_main(int is_daemon) #if !ADB_HOST #if !ADB_HOST int secure = 0; int secure = 0; char value[PROPERTY_VALUE_MAX]; char value[PROPERTY_VALUE_MAX]; // prevent the OOM killer from killing us char text[64]; snprintf(text, sizeof text, "/proc/%d/oom_adj", (int)getpid()); int fd = adb_open(text, O_WRONLY); if (fd >= 0) { // -17 should make us immune to OOM snprintf(text, sizeof text, "%d", -17); adb_write(fd, text, strlen(text)); adb_close(fd); } else { D("adb: unable to open %s\n", text); } #endif #endif atexit(adb_cleanup); atexit(adb_cleanup); Loading @@ -846,6 +835,7 @@ int adb_main(int is_daemon) #if ADB_HOST #if ADB_HOST HOST = 1; HOST = 1; usb_vendors_init(); usb_init(); usb_init(); local_init(); local_init(); Loading Loading @@ -929,6 +919,9 @@ int adb_main(int is_daemon) fdevent_loop(); fdevent_loop(); usb_cleanup(); usb_cleanup(); #if ADB_HOST usb_vendors_cleanup(); #endif return 0; return 0; } } Loading adb/adb.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -375,7 +375,9 @@ int usb_close(usb_handle *h); void usb_kick(usb_handle *h); void usb_kick(usb_handle *h); /* used for USB device detection */ /* used for USB device detection */ #if ADB_HOST int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol); int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol); #endif unsigned host_to_le32(unsigned n); unsigned host_to_le32(unsigned n); int adb_commandline(int argc, char **argv); int adb_commandline(int argc, char **argv); Loading libcutils/fdevent.c→adb/fdevent.c +18 −18 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,7 @@ #include <stdarg.h> #include <stdarg.h> #include <stddef.h> #include <stddef.h> #include <cutils/fdevent.h> #include "fdevent.h" #define TRACE(x...) fprintf(stderr,x) #define TRACE(x...) fprintf(stderr,x) Loading include/cutils/fdevent.h→adb/fdevent.h +8 −1 Original line number Original line Diff line number Diff line Loading @@ -17,10 +17,13 @@ #ifndef __FDEVENT_H #ifndef __FDEVENT_H #define __FDEVENT_H #define __FDEVENT_H #include <stdint.h> /* for int64_t */ /* events that may be observed */ /* events that may be observed */ #define FDE_READ 0x0001 #define FDE_READ 0x0001 #define FDE_WRITE 0x0002 #define FDE_WRITE 0x0002 #define FDE_ERROR 0x0004 #define FDE_ERROR 0x0004 #define FDE_TIMEOUT 0x0008 /* features that may be set (via the events set/add/del interface) */ /* features that may be set (via the events set/add/del interface) */ #define FDE_DONT_CLOSE 0x0080 #define FDE_DONT_CLOSE 0x0080 Loading @@ -30,6 +33,8 @@ typedef struct fdevent fdevent; typedef void (*fd_func)(int fd, unsigned events, void *userdata); typedef void (*fd_func)(int fd, unsigned events, void *userdata); /* Allocate and initialize a new fdevent object /* Allocate and initialize a new fdevent object * Note: use FD_TIMER as 'fd' to create a fd-less object * (used to implement timers). */ */ fdevent *fdevent_create(int fd, fd_func func, void *arg); fdevent *fdevent_create(int fd, fd_func func, void *arg); Loading @@ -53,6 +58,8 @@ void fdevent_set(fdevent *fde, unsigned events); void fdevent_add(fdevent *fde, unsigned events); void fdevent_add(fdevent *fde, unsigned events); void fdevent_del(fdevent *fde, unsigned events); void fdevent_del(fdevent *fde, unsigned events); void fdevent_set_timeout(fdevent *fde, int64_t timeout_ms); /* loop forever, handling events. /* loop forever, handling events. */ */ void fdevent_loop(); void fdevent_loop(); Loading Loading
adb/Android.mk +4 −0 Original line number Original line Diff line number Diff line Loading @@ -53,10 +53,13 @@ LOCAL_SRC_FILES := \ $(USB_SRCS) \ $(USB_SRCS) \ shlist.c \ shlist.c \ utils.c \ utils.c \ usb_vendors.c \ ifneq ($(USE_SYSDEPS_WIN32),) ifneq ($(USE_SYSDEPS_WIN32),) LOCAL_SRC_FILES += sysdeps_win32.c LOCAL_SRC_FILES += sysdeps_win32.c else LOCAL_SRC_FILES += fdevent.c endif endif LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter LOCAL_CFLAGS += -O2 -g -DADB_HOST=1 -Wall -Wno-unused-parameter Loading Loading @@ -98,6 +101,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \ adb.c \ adb.c \ fdevent.c \ transport.c \ transport.c \ transport_local.c \ transport_local.c \ transport_usb.c \ transport_usb.c \ Loading
adb/adb.c +6 −13 Original line number Original line Diff line number Diff line Loading @@ -29,6 +29,8 @@ #if !ADB_HOST #if !ADB_HOST #include <private/android_filesystem_config.h> #include <private/android_filesystem_config.h> #else #include "usb_vendors.h" #endif #endif Loading Loading @@ -818,19 +820,6 @@ int adb_main(int is_daemon) #if !ADB_HOST #if !ADB_HOST int secure = 0; int secure = 0; char value[PROPERTY_VALUE_MAX]; char value[PROPERTY_VALUE_MAX]; // prevent the OOM killer from killing us char text[64]; snprintf(text, sizeof text, "/proc/%d/oom_adj", (int)getpid()); int fd = adb_open(text, O_WRONLY); if (fd >= 0) { // -17 should make us immune to OOM snprintf(text, sizeof text, "%d", -17); adb_write(fd, text, strlen(text)); adb_close(fd); } else { D("adb: unable to open %s\n", text); } #endif #endif atexit(adb_cleanup); atexit(adb_cleanup); Loading @@ -846,6 +835,7 @@ int adb_main(int is_daemon) #if ADB_HOST #if ADB_HOST HOST = 1; HOST = 1; usb_vendors_init(); usb_init(); usb_init(); local_init(); local_init(); Loading Loading @@ -929,6 +919,9 @@ int adb_main(int is_daemon) fdevent_loop(); fdevent_loop(); usb_cleanup(); usb_cleanup(); #if ADB_HOST usb_vendors_cleanup(); #endif return 0; return 0; } } Loading
adb/adb.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -375,7 +375,9 @@ int usb_close(usb_handle *h); void usb_kick(usb_handle *h); void usb_kick(usb_handle *h); /* used for USB device detection */ /* used for USB device detection */ #if ADB_HOST int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol); int is_adb_interface(int vid, int pid, int usb_class, int usb_subclass, int usb_protocol); #endif unsigned host_to_le32(unsigned n); unsigned host_to_le32(unsigned n); int adb_commandline(int argc, char **argv); int adb_commandline(int argc, char **argv); Loading
libcutils/fdevent.c→adb/fdevent.c +18 −18 Original line number Original line Diff line number Diff line Loading @@ -26,7 +26,7 @@ #include <stdarg.h> #include <stdarg.h> #include <stddef.h> #include <stddef.h> #include <cutils/fdevent.h> #include "fdevent.h" #define TRACE(x...) fprintf(stderr,x) #define TRACE(x...) fprintf(stderr,x) Loading
include/cutils/fdevent.h→adb/fdevent.h +8 −1 Original line number Original line Diff line number Diff line Loading @@ -17,10 +17,13 @@ #ifndef __FDEVENT_H #ifndef __FDEVENT_H #define __FDEVENT_H #define __FDEVENT_H #include <stdint.h> /* for int64_t */ /* events that may be observed */ /* events that may be observed */ #define FDE_READ 0x0001 #define FDE_READ 0x0001 #define FDE_WRITE 0x0002 #define FDE_WRITE 0x0002 #define FDE_ERROR 0x0004 #define FDE_ERROR 0x0004 #define FDE_TIMEOUT 0x0008 /* features that may be set (via the events set/add/del interface) */ /* features that may be set (via the events set/add/del interface) */ #define FDE_DONT_CLOSE 0x0080 #define FDE_DONT_CLOSE 0x0080 Loading @@ -30,6 +33,8 @@ typedef struct fdevent fdevent; typedef void (*fd_func)(int fd, unsigned events, void *userdata); typedef void (*fd_func)(int fd, unsigned events, void *userdata); /* Allocate and initialize a new fdevent object /* Allocate and initialize a new fdevent object * Note: use FD_TIMER as 'fd' to create a fd-less object * (used to implement timers). */ */ fdevent *fdevent_create(int fd, fd_func func, void *arg); fdevent *fdevent_create(int fd, fd_func func, void *arg); Loading @@ -53,6 +58,8 @@ void fdevent_set(fdevent *fde, unsigned events); void fdevent_add(fdevent *fde, unsigned events); void fdevent_add(fdevent *fde, unsigned events); void fdevent_del(fdevent *fde, unsigned events); void fdevent_del(fdevent *fde, unsigned events); void fdevent_set_timeout(fdevent *fde, int64_t timeout_ms); /* loop forever, handling events. /* loop forever, handling events. */ */ void fdevent_loop(); void fdevent_loop(); Loading