summaryrefslogtreecommitdiffstats
path: root/recipes/adbd/files/adbd.patch
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@digia.com>2013-06-20 15:36:33 +0300
committerSamuli Piippo <samuli.piippo@digia.com>2013-06-24 08:39:36 +0300
commit29f971bec6ad8bbbf3f6bbcf1ab67f1f4e0b59ff (patch)
treefa3d68640bc264e52a8c5265bc730a2d37d68866 /recipes/adbd/files/adbd.patch
parentfdb102b8b6bf1e0f2807502eaa83cb7818009b6e (diff)
downloadmeta-boot2qt-29f971bec6ad8bbbf3f6bbcf1ab67f1f4e0b59ff.tar.gz
Include Android Debug Bridge Daemon (adbd) to images
Change-Id: I00108d36be95e42b8aa9674d1a86ea7e3a5bcf55 Reviewed-by: Rainer Keller <rainer.keller@digia.com>
Diffstat (limited to 'recipes/adbd/files/adbd.patch')
-rw-r--r--recipes/adbd/files/adbd.patch177
1 files changed, 177 insertions, 0 deletions
diff --git a/recipes/adbd/files/adbd.patch b/recipes/adbd/files/adbd.patch
new file mode 100644
index 0000000..110b021
--- /dev/null
+++ b/recipes/adbd/files/adbd.patch
@@ -0,0 +1,177 @@
1diff --git a/adb/adb.c b/adb/adb.c
2index 07bfbe5..c8f37ff 100644
3--- a/adb/adb.c
4+++ b/adb/adb.c
5@@ -141,7 +141,7 @@ void adb_trace_init(void)
6 }
7 }
8
9-#if !ADB_HOST
10+#if !ADB_HOST && ADB_QEMU
11 /*
12 * Implements ADB tracing inside the emulator.
13 */
14@@ -282,6 +282,22 @@ static void send_close(unsigned local, unsigned remote, atransport *t)
15 send_packet(p, t);
16 }
17
18+int property_set(const char *key, const char *value)
19+{
20+ return 0;
21+}
22+
23+int property_get(const char *key, char *value, const char *fallback)
24+{
25+ if (fallback) {
26+ strncpy(value, fallback, PROPERTY_VALUE_MAX-1);
27+ return strlen(fallback);
28+ } else {
29+ value[0] = 0;
30+ return 0;
31+ }
32+}
33+
34 static size_t fill_connect_data(char *buf, size_t bufsize)
35 {
36 #if ADB_HOST
37@@ -1056,31 +1072,7 @@ static int should_drop_privileges() {
38 #ifndef ALLOW_ADBD_ROOT
39 return 1;
40 #else /* ALLOW_ADBD_ROOT */
41- int secure = 0;
42- char value[PROPERTY_VALUE_MAX];
43-
44- /* run adbd in secure mode if ro.secure is set and
45- ** we are not in the emulator
46- */
47- property_get("ro.kernel.qemu", value, "");
48- if (strcmp(value, "1") != 0) {
49- property_get("ro.secure", value, "1");
50- if (strcmp(value, "1") == 0) {
51- // don't run as root if ro.secure is set...
52- secure = 1;
53-
54- // ... except we allow running as root in userdebug builds if the
55- // service.adb.root property has been set by the "adb root" command
56- property_get("ro.debuggable", value, "");
57- if (strcmp(value, "1") == 0) {
58- property_get("service.adb.root", value, "");
59- if (strcmp(value, "1") == 0) {
60- secure = 0;
61- }
62- }
63- }
64- }
65- return secure;
66+ return 0;
67 #endif /* ALLOW_ADBD_ROOT */
68 }
69 #endif /* !ADB_HOST */
70@@ -1543,7 +1535,9 @@ int main(int argc, char **argv)
71 #else
72 /* If adbd runs inside the emulator this will enable adb tracing via
73 * adb-debug qemud service in the emulator. */
74+#if ADB_QEMU
75 adb_qemu_trace_init();
76+#endif
77 if((argc > 1) && (!strcmp(argv[1],"recovery"))) {
78 adb_device_banner = "recovery";
79 recovery_mode = 1;
80diff --git a/adb/adb.h b/adb/adb.h
81index 9da8af8..ae3dd31 100644
82--- a/adb/adb.h
83+++ b/adb/adb.h
84@@ -363,7 +363,7 @@ typedef enum {
85
86 #if ADB_TRACE
87
88-#if !ADB_HOST
89+#if !ADB_HOST && ADB_QEMU
90 /*
91 * When running inside the emulator, guest's adbd can connect to 'adb-debug'
92 * qemud service that can display adb trace messages (on condition that emulator
93diff --git a/adb/remount_service.c b/adb/remount_service.c
94index 4cb41e7..6cfc2c6 100644
95--- a/adb/remount_service.c
96+++ b/adb/remount_service.c
97@@ -77,12 +77,12 @@ static int remount_system()
98 return 0;
99 }
100
101- dev = find_mount("/system");
102+ dev = find_mount("/");
103
104 if (!dev)
105 return -1;
106
107- system_ro = mount(dev, "/system", "none", MS_REMOUNT, NULL);
108+ system_ro = mount(dev, "/", "none", MS_REMOUNT, NULL);
109
110 free(dev);
111
112diff --git a/adb/services.c b/adb/services.c
113index 495a083..eb895ae 100644
114--- a/adb/services.c
115+++ b/adb/services.c
116@@ -33,7 +33,7 @@
117 # include <sys/ioctl.h>
118 # endif
119 #else
120-# include <cutils/android_reboot.h>
121+# include <linux/reboot.h>
122 #endif
123
124 typedef struct stinfo stinfo;
125@@ -182,7 +182,7 @@ void reboot_service(int fd, void *arg)
126 waitpid(pid, &ret, 0);
127 }
128
129- ret = android_reboot(ANDROID_RB_RESTART2, 0, (char *) arg);
130+ ret = reboot(LINUX_REBOOT_CMD_RESTART2, 0, (char *) arg);
131 if (ret < 0) {
132 snprintf(buf, sizeof(buf), "reboot failed: %s\n", strerror(errno));
133 writex(fd, buf, strlen(buf));
134@@ -334,7 +334,7 @@ static int create_subprocess(const char *cmd, const char *arg0, const char *arg1
135 #if ADB_HOST
136 #define SHELL_COMMAND "/bin/sh"
137 #else
138-#define SHELL_COMMAND "/system/bin/sh"
139+#define SHELL_COMMAND "/bin/sh"
140 #endif
141
142 #if !ADB_HOST
143diff --git a/adb/transport_local.c b/adb/transport_local.c
144index 96a24ba..51c85fc 100644
145--- a/adb/transport_local.c
146+++ b/adb/transport_local.c
147@@ -186,7 +186,7 @@ static void *server_socket_thread(void * arg)
148 }
149
150 /* This is relevant only for ADB daemon running inside the emulator. */
151-#if !ADB_HOST
152+#if !ADB_HOST && ADB_QEMU
153 /*
154 * Redefine open and write for qemu_pipe.h that contains inlined references
155 * to those routines. We will redifine them back after qemu_pipe.h inclusion.
156@@ -304,7 +304,7 @@ void local_init(int port)
157 if(HOST) {
158 func = client_socket_thread;
159 } else {
160-#if ADB_HOST
161+#if ADB_HOST || !ADB_QEMU
162 func = server_socket_thread;
163 #else
164 /* For the adbd daemon in the system image we need to distinguish
165diff --git a/adb/transport_usb.c b/adb/transport_usb.c
166index ee6b637..c5e1408 100644
167--- a/adb/transport_usb.c
168+++ b/adb/transport_usb.c
169@@ -18,7 +18,7 @@
170 #include <stdlib.h>
171 #include <string.h>
172
173-#include <sysdeps.h>
174+#include "sysdeps.h"
175
176 #define TRACE_TAG TRACE_TRANSPORT
177 #include "adb.h"