Merge "Fix Heap Corruption from too long of a TAG"
diff --git a/adb/commandline.c b/adb/commandline.c
index 7cd77e0..8781081 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -110,7 +110,7 @@
"\n"
"device commands:\n"
" adb push <local> <remote> - copy file/dir to device\n"
- " adb pull <remote> <local> - copy file/dir from device\n"
+ " adb pull <remote> [<local>] - copy file/dir from device\n"
" adb sync [ <directory> ] - copy host->device only if changed\n"
" (see 'adb help all')\n"
" adb shell - run remote shell interactively\n"
@@ -951,10 +951,8 @@
}
if(!strcmp(argv[0], "bugreport")) {
- if (argc != 1) {
- return 1;
- }
- do_cmd(ttype, serial, "shell", "dumpstate", "-", 0);
+ if (argc != 1) return usage();
+ do_cmd(ttype, serial, "shell", "bugreport", 0);
return 0;
}
@@ -1022,8 +1020,13 @@
}
if(!strcmp(argv[0], "pull")) {
- if(argc != 3) return usage();
- return do_sync_pull(argv[1], argv[2]);
+ if (argc == 2) {
+ return do_sync_pull(argv[1], ".");
+ } else if (argc == 3) {
+ return do_sync_pull(argv[1], argv[2]);
+ } else {
+ return usage();
+ }
}
if(!strcmp(argv[0], "install")) {
diff --git a/adb/usb_linux.c b/adb/usb_linux.c
index 863af1d..66ee317 100644
--- a/adb/usb_linux.c
+++ b/adb/usb_linux.c
@@ -150,13 +150,13 @@
while((de = readdir(devdir))) {
unsigned char devdesc[256];
unsigned char* bufptr = devdesc;
+ unsigned char* bufend;
struct usb_device_descriptor* device;
struct usb_config_descriptor* config;
struct usb_interface_descriptor* interface;
struct usb_endpoint_descriptor *ep1, *ep2;
unsigned zero_mask = 0;
unsigned vid, pid;
- int i, interfaces;
size_t desclength;
if(badname(de->d_name)) continue;
@@ -173,6 +173,7 @@
}
desclength = adb_read(fd, devdesc, sizeof(devdesc));
+ bufend = bufptr + desclength;
// should have device and configuration descriptors, and atleast two endpoints
if (desclength < USB_DT_DEVICE_SIZE + USB_DT_CONFIG_SIZE) {
@@ -203,75 +204,73 @@
continue;
}
- // loop through all the interfaces and look for the ADB interface
- interfaces = config->bNumInterfaces;
- for (i = 0; i < interfaces; i++) {
- if (bufptr + USB_DT_ENDPOINT_SIZE > devdesc + desclength)
- break;
+ // loop through all the descriptors and look for the ADB interface
+ while (bufptr < bufend) {
+ unsigned char length = bufptr[0];
+ unsigned char type = bufptr[1];
- interface = (struct usb_interface_descriptor *)bufptr;
- bufptr += USB_DT_INTERFACE_SIZE;
- if (interface->bLength != USB_DT_INTERFACE_SIZE ||
- interface->bDescriptorType != USB_DT_INTERFACE) {
- D("usb_interface_descriptor not found\n");
- break;
- }
+ if (type == USB_DT_INTERFACE) {
+ interface = (struct usb_interface_descriptor *)bufptr;
+ bufptr += length;
- DBGX("bInterfaceClass: %d, bInterfaceSubClass: %d,"
- "bInterfaceProtocol: %d, bNumEndpoints: %d\n",
- interface->bInterfaceClass, interface->bInterfaceSubClass,
- interface->bInterfaceProtocol, interface->bNumEndpoints);
-
- if (interface->bNumEndpoints == 2 &&
- is_adb_interface(vid, pid, interface->bInterfaceClass,
- interface->bInterfaceSubClass, interface->bInterfaceProtocol)) {
-
- DBGX("looking for bulk endpoints\n");
- // looks like ADB...
- ep1 = (struct usb_endpoint_descriptor *)bufptr;
- bufptr += USB_DT_ENDPOINT_SIZE;
- ep2 = (struct usb_endpoint_descriptor *)bufptr;
- bufptr += USB_DT_ENDPOINT_SIZE;
-
- if (bufptr > devdesc + desclength ||
- ep1->bLength != USB_DT_ENDPOINT_SIZE ||
- ep1->bDescriptorType != USB_DT_ENDPOINT ||
- ep2->bLength != USB_DT_ENDPOINT_SIZE ||
- ep2->bDescriptorType != USB_DT_ENDPOINT) {
- D("endpoints not found\n");
+ if (length != USB_DT_INTERFACE_SIZE) {
+ D("interface descriptor has wrong size\n");
break;
}
- // both endpoints should be bulk
- if (ep1->bmAttributes != USB_ENDPOINT_XFER_BULK ||
- ep2->bmAttributes != USB_ENDPOINT_XFER_BULK) {
- D("bulk endpoints not found\n");
- continue;
+ DBGX("bInterfaceClass: %d, bInterfaceSubClass: %d,"
+ "bInterfaceProtocol: %d, bNumEndpoints: %d\n",
+ interface->bInterfaceClass, interface->bInterfaceSubClass,
+ interface->bInterfaceProtocol, interface->bNumEndpoints);
+
+ if (interface->bNumEndpoints == 2 &&
+ is_adb_interface(vid, pid, interface->bInterfaceClass,
+ interface->bInterfaceSubClass, interface->bInterfaceProtocol)) {
+
+ DBGX("looking for bulk endpoints\n");
+ // looks like ADB...
+ ep1 = (struct usb_endpoint_descriptor *)bufptr;
+ bufptr += USB_DT_ENDPOINT_SIZE;
+ ep2 = (struct usb_endpoint_descriptor *)bufptr;
+ bufptr += USB_DT_ENDPOINT_SIZE;
+
+ if (bufptr > devdesc + desclength ||
+ ep1->bLength != USB_DT_ENDPOINT_SIZE ||
+ ep1->bDescriptorType != USB_DT_ENDPOINT ||
+ ep2->bLength != USB_DT_ENDPOINT_SIZE ||
+ ep2->bDescriptorType != USB_DT_ENDPOINT) {
+ D("endpoints not found\n");
+ break;
+ }
+
+ // both endpoints should be bulk
+ if (ep1->bmAttributes != USB_ENDPOINT_XFER_BULK ||
+ ep2->bmAttributes != USB_ENDPOINT_XFER_BULK) {
+ D("bulk endpoints not found\n");
+ continue;
+ }
+ /* aproto 01 needs 0 termination */
+ if(interface->bInterfaceProtocol == 0x01) {
+ zero_mask = ep1->wMaxPacketSize - 1;
+ }
+
+ // we have a match. now we just need to figure out which is in and which is out.
+ if (ep1->bEndpointAddress & USB_ENDPOINT_DIR_MASK) {
+ local_ep_in = ep1->bEndpointAddress;
+ local_ep_out = ep2->bEndpointAddress;
+ } else {
+ local_ep_in = ep2->bEndpointAddress;
+ local_ep_out = ep1->bEndpointAddress;
+ }
+
+ register_device_callback(devname, local_ep_in, local_ep_out,
+ interface->bInterfaceNumber, device->iSerialNumber, zero_mask);
+ break;
}
-
- /* aproto 01 needs 0 termination */
- if(interface->bInterfaceProtocol == 0x01) {
- zero_mask = ep1->wMaxPacketSize - 1;
- }
-
- // we have a match. now we just need to figure out which is in and which is out.
- if (ep1->bEndpointAddress & USB_ENDPOINT_DIR_MASK) {
- local_ep_in = ep1->bEndpointAddress;
- local_ep_out = ep2->bEndpointAddress;
- } else {
- local_ep_in = ep2->bEndpointAddress;
- local_ep_out = ep1->bEndpointAddress;
- }
-
- register_device_callback(devname, local_ep_in, local_ep_out,
- interface->bInterfaceNumber, device->iSerialNumber, zero_mask);
-
- break;
} else {
- // seek next interface descriptor
- bufptr += (USB_DT_ENDPOINT_SIZE * interface->bNumEndpoints);
- }
- } // end of for
+ bufptr += length;
+ }
+ } // end of while
adb_close(fd);
} // end of devdir while
diff --git a/adb/usb_vendors.c b/adb/usb_vendors.c
index 203c006..73bf418 100644
--- a/adb/usb_vendors.c
+++ b/adb/usb_vendors.c
@@ -55,6 +55,10 @@
#define VENDOR_ID_FOXCONN 0x0489
// Dell's USB Vendor ID
#define VENDOR_ID_DELL 0x413c
+// Nvidia's USB Vendor ID
+#define VENDOR_ID_NVIDIA 0x0955
+// Garmin-Asus's USB Vendor ID
+#define VENDOR_ID_GARMIN_ASUS 0x091E
/** built-in vendor list */
@@ -69,6 +73,8 @@
VENDOR_ID_SONY_ERICSSON,
VENDOR_ID_FOXCONN,
VENDOR_ID_DELL,
+ VENDOR_ID_NVIDIA,
+ VENDOR_ID_GARMIN_ASUS,
};
#define BUILT_IN_VENDOR_COUNT (sizeof(builtInVendorIds)/sizeof(builtInVendorIds[0]))
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c
index 1a0183f..1308f26 100644
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -151,6 +151,7 @@
(info->dev_vendor != 0x0451) &&
(info->dev_vendor != 0x22b8) && // Motorola
(info->dev_vendor != 0x0502) &&
+ (info->dev_vendor != 0x413c) && // DELL
(info->dev_vendor != 0x0bb4)) // HTC
return -1;
if(info->ifc_class != 0xff) return -1;
diff --git a/init/devices.c b/init/devices.c
index 55c5ee4..1dffcd4 100644
--- a/init/devices.c
+++ b/init/devices.c
@@ -138,6 +138,7 @@
{ "/dev/msm_snd", 0660, AID_SYSTEM, AID_AUDIO, 1 },
{ "/dev/msm_mp3", 0660, AID_SYSTEM, AID_AUDIO, 1 },
{ "/dev/audience_a1026", 0660, AID_SYSTEM, AID_AUDIO, 1 },
+ { "/dev/tpa2018d1", 0660, AID_SYSTEM, AID_AUDIO, 1 },
{ "/dev/msm_audpre", 0660, AID_SYSTEM, AID_AUDIO, 0 },
{ "/dev/msm_audio_ctl", 0660, AID_SYSTEM, AID_AUDIO, 0 },
{ "/dev/htc-acoustic", 0660, AID_SYSTEM, AID_AUDIO, 0 },
diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c
index 64d9bb7..8134aa1 100644
--- a/libcutils/sched_policy.c
+++ b/libcutils/sched_policy.c
@@ -53,13 +53,22 @@
sprintf(path, "/dev/cpuctl/%s/tasks", grp_name);
if ((fd = open(path, O_WRONLY)) < 0) {
- LOGE("add_tid_to_cgroup failed to open '%s' (%s)\n", path, strerror(errno));
+ LOGE("add_tid_to_cgroup failed to open '%s' (%s)\n", path,
+ strerror(errno));
return -1;
}
sprintf(text, "%d", tid);
if (write(fd, text, strlen(text)) < 0) {
close(fd);
+ /*
+ * If the thread is in the process of exiting,
+ * don't flag an error
+ */
+ if (errno == ESRCH)
+ return 0;
+ LOGW("add_tid_to_cgroup failed to write '%s' (%s)\n", path,
+ strerror(errno));
return -1;
}
diff --git a/logcat/event-log-tags b/logcat/event-log-tags
index 2140b37..5c4c962 100644
--- a/logcat/event-log-tags
+++ b/logcat/event-log-tags
@@ -282,6 +282,8 @@
30035 am_schedule_service_restart (Component Name|3),(Time|2|3)
# A client was waiting for a content provider, but its process was lost
30036 am_provider_lost_process (Package Name|3),(UID|1|5),(Name|3)
+# The activity manager gave up on a new process taking too long to start
+30037 am_process_start_timeout (PID|1|5),(UID|1|5),(Process Name|3)
# Out of memory for surfaces.
31000 wm_no_surface_memory (Window|3),(PID|1|5),(Operation|3)
@@ -369,6 +371,9 @@
# CDMA data network drop
50111 cdma_data_drop (cid|1|5), (network_type|1|5)
+# GSM radio access technology switched
+50112 gsm_rat_switched (cid|1|5), (network_from|1|5), (network_to|1|5)
+
# Do not change these names without updating tag in:
#//device/dalvik/libcore/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.c
51000 socket_stats (send|1|2),(recv|1|2),(ip|1|5),(port|1|5),(close|1|5)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index f62d1d8..925347d 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -86,11 +86,6 @@
write /proc/apanic_console 1
- # Collect ramconsole data
- copy /proc/last_kmsg /data/dontpanic/last_kmsg
- chown root log /data/dontpanic/last_kmsg
- chmod 0640 /data/dontpanic/last_kmsg
-
# Same reason as /data above
mount yaffs2 mtd@cache /cache nosuid nodev
chown system cache /cache