Add M format files and explore script

1) Add a set of format files for hammerhead, MRA59G, 3.4.0
2) Fix the pull_ftrace_format_files.py to handle \r in adb output
3) Add the ftrace explorer script: ./libftrace/test/explorer.html 

Change-Id: I330d2c3f1d95d321abacb2c08856fd17ac3edbcb
diff --git a/tools/pull_ftrace_format_files.py b/tools/pull_ftrace_format_files.py
index 8cd27f6..81ff13e 100755
--- a/tools/pull_ftrace_format_files.py
+++ b/tools/pull_ftrace_format_files.py
@@ -34,7 +34,7 @@
   if serial:
     prefix += ['-s', serial]
   cmd = prefix + list(cmd)
-  output = subprocess.check_output(cmd)
+  output = subprocess.check_output(cmd).replace('\r', '')
   return output
 
 
@@ -107,10 +107,10 @@
 
 
 # Produces output of the form: prefix_android_seed_N2F62_3.10.49
-def get_output_directory(prefix=None):
-  build_id = adb('shell', 'getprop', 'ro.build.id').replace('\n', '')
-  product = adb('shell', 'getprop', 'ro.build.product').replace('\n', '')
-  kernel = adb('shell', 'uname', '-r').split('-')[0]
+def get_output_directory(prefix=None, serial=None):
+  build_id = adb('shell', 'getprop', 'ro.build.id', serial=serial).strip()
+  product = adb('shell', 'getprop', 'ro.build.product', serial=serial).strip()
+  kernel = adb('shell', 'uname', '-r', serial=serial).split('-')[0].strip()
   parts = ['android', product, build_id, kernel]
   if prefix:
     parts = [prefix] + parts
@@ -129,7 +129,7 @@
   serial = args.serial
 
   serial = ensure_single_device(serial)
-  output_directory = get_output_directory(prefix)
+  output_directory = get_output_directory(prefix, serial)
 
   ensure_output_directory_empty(output_directory)
   pull_format_files(serial, output_directory)