summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2021-01-05 10:41:08 -0800
committerCommit Bot <commit-bot@chromium.org>2021-01-05 20:54:47 +0000
commit1098c60a9d349b8c1c438bd9bf82fe383c387e02 (patch)
tree822306d8327aec56dfdde4287504c796308e1754
parent8b5a703f7b605cf22af5669c6fef9eb2d3bc2f7d (diff)
downloadchrome-ec-1098c60a9d349b8c1c438bd9bf82fe383c387e02.tar.gz
gsctool: print raw timestamp with gsctool -LM
The UMA get flog script expects a raw timestamp without spaces around the colon. Output the UMA format when the machine arg is given. gsctool -aL still prints the incorrect year in the timestamp. That will get fixed in a followup CL. BUG=b:176816528 TEST=gsctool -aML outputs the old format. gsctool -aL still prints the output with timestamps. Change-Id: Ie11204260958f48485c28917c31d62d78c5b722c Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2610932 Reviewed-by: Andrey Pronin <apronin@chromium.org> Commit-Queue: Andrey Pronin <apronin@chromium.org>
-rw-r--r--extra/usb_updater/gsctool.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c
index c6c9efb136..4deb51ccf3 100644
--- a/extra/usb_updater/gsctool.c
+++ b/extra/usb_updater/gsctool.c
@@ -2545,7 +2545,8 @@ static int process_tpm_mode(struct transfer_descriptor *td,
* On error retry a few times just in case flash log is locked by a concurrent
* access.
*/
-static int process_get_flog(struct transfer_descriptor *td, uint32_t prev_stamp)
+static int process_get_flog(struct transfer_descriptor *td, uint32_t prev_stamp,
+ bool show_machine_output)
{
int rv;
const int max_retries = 3;
@@ -2580,18 +2581,24 @@ static int process_get_flog(struct transfer_descriptor *td, uint32_t prev_stamp)
return 0;
memcpy(&prev_stamp, &entry.r.timestamp, sizeof(prev_stamp));
- entry_epoch = prev_stamp;
- localtime_r(&entry_epoch, &loc_time);
+ if (show_machine_output) {
+ printf("%10u:%02x", prev_stamp, entry.r.type);
+ } else {
+ entry_epoch = prev_stamp;
+ localtime_r(&entry_epoch, &loc_time);
+
+ if (!time_zone_reported) {
+ strftime(date_str, sizeof(date_str), "%Z",
+ &loc_time);
+ printf("Log time zone is %s\n", date_str);
+ time_zone_reported = true;
+ }
- if (!time_zone_reported) {
- strftime(date_str, sizeof(date_str), "%Z", &loc_time);
- printf("Log time zone is %s\n", date_str);
- time_zone_reported = true;
+ /* Date format is MMM DD YY HH:mm:ss */
+ strftime(date_str, sizeof(date_str), "%b %d %y %T",
+ &loc_time);
+ printf("%s : %02x", date_str, entry.r.type);
}
-
- /* Date format is MMM DD YY HH:mm:ss */
- strftime(date_str, sizeof(date_str), "%b %d %y %T", &loc_time);
- printf("%s : %02x", date_str, entry.r.type);
for (i = 0; i < FLASH_LOG_PAYLOAD_SIZE(entry.r.size); i++)
printf(" %02x", entry.r.payload[i]);
printf("\n");
@@ -3147,7 +3154,7 @@ int main(int argc, char *argv[])
exit(process_get_boot_mode(&td));
if (get_flog)
- process_get_flog(&td, prev_log_entry);
+ process_get_flog(&td, prev_log_entry, show_machine_output);
if (erase_ap_ro_hash)
process_erase_ap_ro_hash(&td);