Commit ef3e7a5f authored by Enjia Mai's avatar Enjia Mai Committed by Anas Nashif
Browse files

soc: xtensa: cavstool: add support for logs coming from HDA logging



1) HDA logging seems to be using some padding like '\x00'. Such
string can print well on a terminal but corrupt the string match.
And this can cause false failure if RunID matching is affected.
Remove such padding before checking RunID.

An affected RunID example:
'7aa9ba3c6db12\x00\...\x00\x00\x00\x00d0c7fcf382a4af40ec6'

Expected:
'7aa9ba3c6db12d0c7fcf382a4af40ec6'

2) Use non-displayable chars for live connection check. Otherwise
the log output will have subtle garbage like extra spaces which
locate randomly.

This solution comes from the PR #50071, the author is smrtos.

Signed-off-by: default avatarMing Shao <ming.shao@intel.com>
Signed-off-by: default avatarEnjia Mai <enjia.mai@intel.com>
parent 76743f42
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -98,9 +98,10 @@ class cavstool_client():
        log.info(f"Start to monitor log output...")
        while True:
            # Receive data from the server and print out
            receive_log = str(self.sock.recv(BUF_SIZE).strip(), "utf-8")
            receive_log = str(self.sock.recv(BUF_SIZE), "utf-8").replace('\x00','')
            if receive_log:
                print(f"{receive_log}")
                sys.stdout.write(f"{receive_log}")
                sys.stdout.flush()
                time.sleep(0.1)

    def __del__(self):
+1 −1
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ class adsp_log_handler(socketserver.BaseRequestHandler):

    def is_connection_alive(self):
        try:
            self.request.sendall(b' ')
            self.request.sendall(b'\x00')
        except (BrokenPipeError, ConnectionResetError):
            log.info("Client is disconnect.")
            return False