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: Ief01b0b91358f40df279bc36391bd8a4074199c1
Reviewed-on: https://chromium-review.googlesource.com/177516
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Josafat Garcia <josafat@chromium.org>
diff --git a/overlay-daisy/chromeos-base/chromeos-bsp-daisy/chromeos-bsp-daisy-0.0.1-r48.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-r48.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 b295ec0..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,39 +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.
- # Also report a couple other situations.
+ # Report charger type.
if [[ "$power_info_pass" = "4" ]] ; then
power_info_pass=0
- retrying=false
- try_again:
- uma_event=$(ectool powerinfo | awk '\
-/AC Voltage: / { voltage = $3; } \
-/USB Device Type: / { type = $4; } \
-/USB Current Limit: / { limit = $4; } \
-END { \
-if (type == "0x20010" && limit > 2800) { \
- print "SpringPowerSupply.Original.High"; \
-} else if (type == "0x20010") { \
- print "SpringPowerSupply.Original.Low"; \
-} else if (type != "0x0" && limit > 2800) { \
- print "SpringPowerSupply.Other.High"; \
-} else if (type == "0x0" && voltage > 4500) { \
- print "SpringPowerSupply.ChargerIdle";
-}}')
- if [[ "$uma_event" = "SpringPowerSupply.ChargerIdle" ]]; then
- # There is a short interval right after insertion where this
- # reading does not actually mean a "charger idle" condition.
- if [[ $retrying = "false" ]]; then
- sleep 0.2
- retrying=true
- goto try_again
- fi
- fi
- 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))