logger: add error message when reading sof/etrace instead of sof/trace

Failing silently is not nice. Now prints instead:

  TIMESTAMP   DELTA C# COMPONENT   LOCATION   CONTENT
  error: in logger_read(), fread(..., /sys/kernel/debug/sof/etrace) \
    failed: Invalid argument(22)

Also make logger_read() and the process return [-]errno which can have
different values and some information instead of -ferror() which has
only one value (non-zero in theory, 1 in practice) hence no information.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
Marc Herbert 2020-09-11 03:27:25 +00:00 committed by Liam Girdwood
parent 742cbb8af6
commit 337afc4f38
1 changed files with 4 additions and 2 deletions

View File

@ -630,8 +630,10 @@ static int logger_read(void)
freopen(NULL, "r", global_config->in_fd);
continue;
}
return -ferror(global_config->in_fd);
log_err("in %s(), fread(..., %s) failed: %s(%d)\n",
__func__, global_config->in_file,
strerror(errno), errno);
return -errno;
}
/* checking if received trace address is located in