Replace UMA current reporting with simpler charger type stat.

We no longer need the current/voltage stats.  Instead we're interested
in seeing what chargers are actually used.

BUG=chrome-os-partner:23973
TEST=manual

Original-Change-Id: I3a2cd1175cdbf135e6073ca46cbf5dd89a3d798e
Reviewed-on: https://chromium-review.googlesource.com/177294
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit e13d4d0834cc3b5bc804fe2797fa39a59c616452)

Change-Id: Ie72f1d66765daa6df3096ba97c7c4b4dd9ec714c
Reviewed-on: https://chromium-review.googlesource.com/177602
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
diff --git a/overlay-daisy/chromeos-base/chromeos-bsp-daisy/chromeos-bsp-daisy-0.0.1-r47.ebuild b/overlay-daisy/chromeos-base/chromeos-bsp-daisy/chromeos-bsp-daisy-0.0.1-r49.ebuild
similarity index 100%
rename from overlay-daisy/chromeos-base/chromeos-bsp-daisy/chromeos-bsp-daisy-0.0.1-r47.ebuild
rename to overlay-daisy/chromeos-base/chromeos-bsp-daisy/chromeos-bsp-daisy-0.0.1-r49.ebuild
diff --git a/overlay-daisy/chromeos-base/chromeos-bsp-daisy/files/thermal.sh b/overlay-daisy/chromeos-base/chromeos-bsp-daisy/files/thermal.sh
index fdb23f3..91862e8 100644
--- a/overlay-daisy/chromeos-base/chromeos-bsp-daisy/files/thermal.sh
+++ b/overlay-daisy/chromeos-base/chromeos-bsp-daisy/files/thermal.sh
@@ -228,22 +228,16 @@
     fi
 
     if [[ "${PLATFORM}" = "Spring" ]] ; then
-        # Send UMA sample when a charger is plugged in
-        # and the current limit is greater than 2.8 A.
-        # Distinguish between original charger and others.
+        # Report charger type.
         if [[ "$power_info_pass" = "4" ]] ; then
             power_info_pass=0
-            uma_event=$(ectool powerinfo | awk '\
-/USB Device Type: /   { type = $4; } \
-/USB Current Limit: / { limit = $4; } \
-END  { \
-if (type == "0x20010" && limit > 2800) { \
-   print "SpringPowerSupply.Original.High"; \
-} else if (type != "0x0" && limit > 2800) { \
-   print "SpringPowerSupply.Other.High"; \
-}}')
-            if [[ -n "$uma_event" ]]; then
-                metrics_client -v "$uma_event"
+            # Charger type is 4-byte hex, but metric_client accepts only
+            # decimal.  Sparse histograms use 32-bit bucket indices, but
+            # the 64-bit values produced by awk are truncated correctly.
+            charger_type=$(($(ectool powerinfo | awk \
+              '/USB Device Type:/ { print $4; }')))
+            if [[ -n "$charger_type" ]]; then
+                metrics_client -s Platform.SpringChargerType $charger_type
             fi
         fi
         power_info_pass=$((power_info_pass + 1))