• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


Commit MetaInfo

Révision3566a33930b308bc8bc399ee4b048fad921ef4cd (tree)
l'heure2012-04-05 01:25:59
AuteurChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Message de Log

Merge commit 'android-4.0.4_r1.1' into ics-x86

Conflicts:
init/init.c

Change Summary

Modification

--- a/adb/transport_local.c
+++ b/adb/transport_local.c
@@ -185,6 +185,117 @@ static void *server_socket_thread(void * arg)
185185 return 0;
186186 }
187187
188+/* This is relevant only for ADB daemon running inside the emulator. */
189+#if !ADB_HOST
190+/*
191+ * Redefine open and write for qemu_pipe.h that contains inlined references
192+ * to those routines. We will redifine them back after qemu_pipe.h inclusion.
193+ */
194+#undef open
195+#undef write
196+#define open adb_open
197+#define write adb_write
198+#include <hardware/qemu_pipe.h>
199+#undef open
200+#undef write
201+#define open ___xxx_open
202+#define write ___xxx_write
203+
204+/* A worker thread that monitors host connections, and registers a transport for
205+ * every new host connection. This thread replaces server_socket_thread on
206+ * condition that adbd daemon runs inside the emulator, and emulator uses QEMUD
207+ * pipe to communicate with adbd daemon inside the guest. This is done in order
208+ * to provide more robust communication channel between ADB host and guest. The
209+ * main issue with server_socket_thread approach is that it runs on top of TCP,
210+ * and thus is sensitive to network disruptions. For instance, the
211+ * ConnectionManager may decide to reset all network connections, in which case
212+ * the connection between ADB host and guest will be lost. To make ADB traffic
213+ * independent from the network, we use here 'adb' QEMUD service to transfer data
214+ * between the host, and the guest. See external/qemu/android/adb-*.* that
215+ * implements the emulator's side of the protocol. Another advantage of using
216+ * QEMUD approach is that ADB will be up much sooner, since it doesn't depend
217+ * anymore on network being set up.
218+ * The guest side of the protocol contains the following phases:
219+ * - Connect with adb QEMUD service. In this phase a handle to 'adb' QEMUD service
220+ * is opened, and it becomes clear whether or not emulator supports that
221+ * protocol.
222+ * - Wait for the ADB host to create connection with the guest. This is done by
223+ * sending an 'accept' request to the adb QEMUD service, and waiting on
224+ * response.
225+ * - When new ADB host connection is accepted, the connection with adb QEMUD
226+ * service is registered as the transport, and a 'start' request is sent to the
227+ * adb QEMUD service, indicating that the guest is ready to receive messages.
228+ * Note that the guest will ignore messages sent down from the emulator before
229+ * the transport registration is completed. That's why we need to send the
230+ * 'start' request after the transport is registered.
231+ */
232+static void *qemu_socket_thread(void * arg)
233+{
234+/* 'accept' request to the adb QEMUD service. */
235+static const char _accept_req[] = "accept";
236+/* 'start' request to the adb QEMUD service. */
237+static const char _start_req[] = "start";
238+/* 'ok' reply from the adb QEMUD service. */
239+static const char _ok_resp[] = "ok";
240+
241+ const int port = (int)arg;
242+ int res, fd;
243+ char tmp[256];
244+ char con_name[32];
245+
246+ D("transport: qemu_socket_thread() starting\n");
247+
248+ /* adb QEMUD service connection request. */
249+ snprintf(con_name, sizeof(con_name), "qemud:adb:%d", port);
250+
251+ /* Connect to the adb QEMUD service. */
252+ fd = qemu_pipe_open(con_name);
253+ if (fd < 0) {
254+ /* This could be an older version of the emulator, that doesn't
255+ * implement adb QEMUD service. Fall back to the old TCP way. */
256+ adb_thread_t thr;
257+ D("adb service is not available. Falling back to TCP socket.\n");
258+ adb_thread_create(&thr, server_socket_thread, arg);
259+ return 0;
260+ }
261+
262+ for(;;) {
263+ /*
264+ * Wait till the host creates a new connection.
265+ */
266+
267+ /* Send the 'accept' request. */
268+ res = adb_write(fd, _accept_req, strlen(_accept_req));
269+ if (res == strlen(_accept_req)) {
270+ /* Wait for the response. In the response we expect 'ok' on success,
271+ * or 'ko' on failure. */
272+ res = adb_read(fd, tmp, sizeof(tmp));
273+ if (res != 2 || memcmp(tmp, _ok_resp, 2)) {
274+ D("Accepting ADB host connection has failed.\n");
275+ adb_close(fd);
276+ } else {
277+ /* Host is connected. Register the transport, and start the
278+ * exchange. */
279+ register_socket_transport(fd, "host", port, 1);
280+ adb_write(fd, _start_req, strlen(_start_req));
281+ }
282+
283+ /* Prepare for accepting of the next ADB host connection. */
284+ fd = qemu_pipe_open(con_name);
285+ if (fd < 0) {
286+ D("adb service become unavailable.\n");
287+ return 0;
288+ }
289+ } else {
290+ D("Unable to send the '%s' request to ADB service.\n", _accept_req);
291+ return 0;
292+ }
293+ }
294+ D("transport: qemu_socket_thread() exiting\n");
295+ return 0;
296+}
297+#endif // !ADB_HOST
298+
188299 void local_init(int port)
189300 {
190301 adb_thread_t thr;
@@ -193,7 +304,21 @@ void local_init(int port)
193304 if(HOST) {
194305 func = client_socket_thread;
195306 } else {
307+#if ADB_HOST
196308 func = server_socket_thread;
309+#else
310+ /* For the adbd daemon in the system image we need to distinguish
311+ * between the device, and the emulator. */
312+ char is_qemu[PROPERTY_VALUE_MAX];
313+ property_get("ro.kernel.qemu", is_qemu, "");
314+ if (!strcmp(is_qemu, "1")) {
315+ /* Running inside the emulator: use QEMUD pipe as the transport. */
316+ func = qemu_socket_thread;
317+ } else {
318+ /* Running inside the device: use TCP socket as the transport. */
319+ func = server_socket_thread;
320+ }
321+#endif !ADB_HOST
197322 }
198323
199324 D("transport: local %s init\n", HOST ? "client" : "server");
--- a/adb/usb_vendors.c
+++ b/adb/usb_vendors.c
@@ -111,7 +111,18 @@
111111 #define VENDOR_ID_ARCHOS 0x0E79
112112 // Positivo's USB Vendor ID
113113 #define VENDOR_ID_POSITIVO 0x1662
114-
114+// Fujitsu's USB Vendor ID
115+#define VENDOR_ID_FUJITSU 0x04C5
116+// Lumigon's USB Vendor ID
117+#define VENDOR_ID_LUMIGON 0x25E3
118+//Intel's USB Vendor ID
119+#define VENDOR_ID_INTEL 0x8087
120+// Quanta's USB Vendor ID
121+#define VENDOR_ID_QUANTA 0x0408
122+// INQ Mobile's USB Vendor ID
123+#define VENDOR_ID_INQ_MOBILE 0x2314
124+// Sony's USB Vendor ID
125+#define VENDOR_ID_SONY 0x054C
115126
116127 /** built-in vendor list */
117128 int builtInVendorIds[] = {
@@ -153,6 +164,12 @@ int builtInVendorIds[] = {
153164 VENDOR_ID_PEGATRON,
154165 VENDOR_ID_ARCHOS,
155166 VENDOR_ID_POSITIVO,
167+ VENDOR_ID_FUJITSU,
168+ VENDOR_ID_LUMIGON,
169+ VENDOR_ID_INTEL,
170+ VENDOR_ID_QUANTA,
171+ VENDOR_ID_INQ_MOBILE,
172+ VENDOR_ID_SONY,
156173 };
157174
158175 #define BUILT_IN_VENDOR_COUNT (sizeof(builtInVendorIds)/sizeof(builtInVendorIds[0]))
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -157,6 +157,7 @@ int match_fastboot(usb_ifc_info *info)
157157 (info->dev_vendor != 0x22b8) && // Motorola
158158 (info->dev_vendor != 0x0955) && // Nvidia
159159 (info->dev_vendor != 0x413c) && // DELL
160+ (info->dev_vendor != 0x2314) && // INQ Mobile
160161 (info->dev_vendor != 0x0bb4)) // HTC
161162 return -1;
162163 if(info->ifc_class != 0xff) return -1;
--- a/init/init.c
+++ b/init/init.c
@@ -65,6 +65,7 @@ static char baseband[32];
6565 static char carrier[32];
6666 static char bootloader[32];
6767 static char hardware[32];
68+static char modelno[32];
6869 static unsigned revision = 0;
6970 static char qemu[32];
7071
@@ -449,6 +450,8 @@ static void import_kernel_nv(char *name, int in_qemu)
449450 strlcpy(bootloader, value, sizeof(bootloader));
450451 } else if (!strcmp(name,"androidboot.hardware")) {
451452 strlcpy(hardware, value, sizeof(hardware));
453+ } else if (!strcmp(name,"androidboot.modelno")) {
454+ strlcpy(modelno, value, sizeof(modelno));
452455 }
453456 } else {
454457 /* in the emulator, export any kernel option with the
@@ -601,14 +604,16 @@ static int set_init_properties_action(int nargs, char **args)
601604 property_set("ro.carrier", carrier[0] ? carrier : "unknown");
602605 property_set("ro.bootloader", bootloader[0] ? bootloader : "unknown");
603606
604- if ((tmpdev = getenv("HWACCEL")) && tmpdev[0] == '0') {
605- property_set("debug.egl.hw", tmpdev);
606- }
607+ if (modelno[0])
608+ property_set("ro.boot.modelno", modelno);
609+
607610 property_set("ro.hardware", hardware);
608611 snprintf(tmp, PROP_VALUE_MAX, "%d", revision);
609612 property_set("ro.revision", tmp);
610613 if ((tmpdev = getenv("DEBUG")) && *tmpdev)
611614 property_set("debug.logcat", tmpdev);
615+ if ((tmpdev = getenv("HWACCEL")) && tmpdev[0] == '0')
616+ property_set("debug.egl.hw", tmpdev);
612617
613618 return 0;
614619 }
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -157,7 +157,7 @@ on post-fs-data
157157 # give system access to wpa_supplicant.conf for backup and restore
158158 mkdir /data/misc/wifi 0770 wifi wifi
159159 chmod 0660 /data/misc/wifi/wpa_supplicant.conf
160- mkdir /data/local 0771 shell shell
160+ mkdir /data/local 0751 root root
161161 mkdir /data/local/tmp 0771 shell shell
162162 mkdir /data/data 0771 system system
163163 mkdir /data/app-private 0771 system system
@@ -175,8 +175,9 @@ on post-fs-data
175175 # create the lost+found directories, so as to enforce our permissions
176176 mkdir /data/lost+found 0770 root root
177177
178- # create directory for DRM plug-ins
179- mkdir /data/drm 0774 drm drm
178+ # create directory for DRM plug-ins - give drm the read/write access to
179+ # the following directory.
180+ mkdir /data/drm 0770 drm drm
180181
181182 # If there is no fs-post-data action in the init.<device>.rc file, you
182183 # must uncomment this line, otherwise encrypted filesystems