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

Commit 96d58f4f authored by Jean-Baptiste Queru's avatar Jean-Baptiste Queru
Browse files

Merge korg/donut into korg/master

parents dc9d52f3 3d9b265b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ else
  include $(addprefix $(LOCAL_PATH)/,$(addsuffix /Android.mk, \
	      adb \
	      libcutils \
	      libsysutils \
	      liblog \
	      libnetutils \
	      libpixelflinger \
+4 −2
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@ LOCAL_PATH:= $(call my-dir)

# adb host tool
# =========================================================
ifneq ($(TARGET_SIMULATOR),true) # not 64 bit clean (also unused with the sim)
include $(CLEAR_VARS)

# Default to a virtual (sockets) usb interface
@@ -54,10 +53,13 @@ LOCAL_SRC_FILES := \
	$(USB_SRCS) \
	shlist.c \
	utils.c \
	usb_vendors.c \


ifneq ($(USE_SYSDEPS_WIN32),)
  LOCAL_SRC_FILES += sysdeps_win32.c
else
  LOCAL_SRC_FILES += fdevent.c
endif

LOCAL_CFLAGS += -O2 -g -DADB_HOST=1  -Wall -Wno-unused-parameter
@@ -77,7 +79,6 @@ ifeq ($(HOST_OS),windows)
$(LOCAL_INSTALLED_MODULE): $(HOST_OUT_EXECUTABLES)/AdbWinApi.dll
endif

endif

# adbd device daemon
# =========================================================
@@ -100,6 +101,7 @@ include $(CLEAR_VARS)

LOCAL_SRC_FILES := \
	adb.c \
	fdevent.c \
	transport.c \
	transport_local.c \
	transport_usb.c \
+25 −24
Original line number Diff line number Diff line
@@ -23,12 +23,15 @@
#include <errno.h>
#include <string.h>
#include <time.h>
#include <sys/time.h>

#include "sysdeps.h"
#include "adb.h"

#if !ADB_HOST
#include <private/android_filesystem_config.h>
#else
#include "usb_vendors.h"
#endif


@@ -655,10 +658,25 @@ void start_logging(void)
void start_device_log(void)
{
    int fd;
    char    path[100];
    char    path[PATH_MAX];
    struct tm now;
    time_t t;
    char value[PROPERTY_VALUE_MAX];

    snprintf(path, sizeof path, "/data/adb_%ld.txt", (long)time(NULL));
    fd = unix_open(path, O_WRONLY | O_CREAT | O_APPEND, 0640);
    // read the trace mask from persistent property persist.adb.trace_mask
    // give up if the property is not set or cannot be parsed
    property_get("persist.adb.trace_mask", value, "");
    if (sscanf(value, "%x", &adb_trace_mask) != 1)
        return;

    adb_mkdir("/data/adb", 0775);
    tzset();
    time(&t);
    localtime_r(&t, &now);
    strftime(path, sizeof(path),
                "/data/adb/adb-%Y-%m-%d-%H-%M-%S.txt",
                &now);
    fd = unix_open(path, O_WRONLY | O_CREAT | O_TRUNC, 0640);
    if (fd < 0)
        return;

@@ -669,11 +687,6 @@ void start_device_log(void)

    fd = unix_open("/dev/null", O_RDONLY);
    dup2(fd, 0);

    // log everything
    adb_trace_mask = ~0;
    // except TRACE_RWX is a bit too verbose
    adb_trace_mask &= ~TRACE_RWX;
}
#endif

@@ -818,19 +831,6 @@ int adb_main(int is_daemon)
#if !ADB_HOST
    int secure = 0;
    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

    atexit(adb_cleanup);
@@ -846,6 +846,7 @@ int adb_main(int is_daemon)

#if ADB_HOST
    HOST = 1;
    usb_vendors_init();
    usb_init();
    local_init();

@@ -885,9 +886,10 @@ int adb_main(int is_daemon)
        ** AID_INET to diagnose network issues (netcfg, ping)
        ** AID_GRAPHICS to access the frame buffer
        ** AID_NET_BT and AID_NET_BT_ADMIN to diagnose bluetooth (hcidump)
        ** AID_SDCARD_RW to allow writing to the SD card
        */
        gid_t groups[] = { AID_ADB, AID_LOG, AID_INPUT, AID_INET, AID_GRAPHICS,
                           AID_NET_BT, AID_NET_BT_ADMIN };
                           AID_NET_BT, AID_NET_BT_ADMIN, AID_SDCARD_RW };
        setgroups(sizeof(groups)/sizeof(groups[0]), groups);

        /* then switch user and group to "shell" */
@@ -1088,9 +1090,8 @@ int main(int argc, char **argv)
        adb_device_banner = "recovery";
        recovery_mode = 1;
    }
#if ADB_DEVICE_LOG

    start_device_log();
#endif
    return adb_main(0);
#endif
}
+5 −16
Original line number Diff line number Diff line
@@ -345,11 +345,6 @@ typedef enum {
#endif


/* set this to log to /data/adb/adb_<time>.txt on the device.
 * has no effect if the /data/adb/ directory does not exist.
 */
#define ADB_DEVICE_LOG 0

#if !TRACE_PACKETS
#define print_packet(tag,p) do {} while (0)
#endif
@@ -357,18 +352,10 @@ typedef enum {
#define ADB_PORT 5037
#define ADB_LOCAL_TRANSPORT_PORT 5555

// Google's USB Vendor ID
#define VENDOR_ID_GOOGLE        0x18d1
// HTC's USB Vendor ID
#define VENDOR_ID_HTC           0x0bb4

// products for VENDOR_ID_GOOGLE
#define PRODUCT_ID_SOONER       0xd00d  // Sooner bootloader
#define PRODUCT_ID_SOONER_COMP  0xdeed  // Sooner composite device
#define ADB_CLASS              0xff
#define ADB_SUBCLASS           0x42
#define ADB_PROTOCOL           0x1

// products for VENDOR_ID_HTC
#define PRODUCT_ID_DREAM        0x0c01  // Dream bootloader
#define PRODUCT_ID_DREAM_COMP   0x0c02  // Dream composite device

void local_init();
int  local_connect(int  port);
@@ -382,7 +369,9 @@ int usb_close(usb_handle *h);
void usb_kick(usb_handle *h);

/* 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);
#endif

unsigned host_to_le32(unsigned n);
int adb_commandline(int argc, char **argv);
+1 −1
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ int adb_connect(const char *service)
            fprintf(stdout,"* daemon started successfully *\n");
        }
        /* give the server some time to start properly and detect devices */
        adb_sleep_ms(2000);
        adb_sleep_ms(3000);
        // fall through to _adb_connect
    } else {
        // if server was running, check its version to make sure it is not out of date
Loading