From 2933bbce563da1489fb3a826c8378c67f88f0be2 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 29 Nov 2023 20:14:46 +0100 Subject: [PATCH 1/3] makefiles/tools/serial.inc.mk: make use of pyterm session names --- makefiles/tools/serial.inc.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/makefiles/tools/serial.inc.mk b/makefiles/tools/serial.inc.mk index 8389e421679e..8ccdcfe92658 100644 --- a/makefiles/tools/serial.inc.mk +++ b/makefiles/tools/serial.inc.mk @@ -43,8 +43,9 @@ endif RIOT_TERMINAL ?= pyterm ifeq ($(RIOT_TERMINAL),pyterm) + PYTERMSESSION ?= $(shell date +%Y-%m-%d_%H.%M.%S)-$(APPLICATION)-$(BOARD) TERMPROG ?= $(RIOTTOOLS)/pyterm/pyterm - TERMFLAGS ?= -p "$(PORT)" -b "$(BAUD)" $(PYTERMFLAGS) + TERMFLAGS ?= -p "$(PORT)" -b "$(BAUD)" -rn "$(PYTERMSESSION)" $(PYTERMFLAGS) else ifeq ($(RIOT_TERMINAL),socat) SOCAT_OUTPUT ?= - TERMPROG ?= $(RIOT_TERMINAL) From 61546d55e0d01ba2c60477ceb00598bf5264d546 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 29 Jan 2024 11:08:54 +0100 Subject: [PATCH 2/3] dist/tools/pyterm: accept absolute log dir name --- dist/tools/pyterm/pyterm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/tools/pyterm/pyterm b/dist/tools/pyterm/pyterm index 79f0d835005f..17fca31ffa63 100755 --- a/dist/tools/pyterm/pyterm +++ b/dist/tools/pyterm/pyterm @@ -153,7 +153,7 @@ class SerCmd(cmd.Cmd): self.run_name = defaultrunname if not self.log_dir_name: - self.log_dir_name = self.host + self.log_dir_name = self.configdir + os.path.sep + self.host if not os.path.exists(self.configdir): os.makedirs(self.configdir) @@ -183,7 +183,7 @@ class SerCmd(cmd.Cmd): # create formatter formatter = logging.Formatter(self.fmt_str) - directory = self.configdir + os.path.sep + self.log_dir_name + directory = self.log_dir_name if not os.path.exists(directory): os.makedirs(directory) logging.basicConfig(filename=directory + os.path.sep + self.run_name + From 59bb957c840c68a9896bf7b5ea9e0373fcf15945 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Mon, 29 Jan 2024 11:09:26 +0100 Subject: [PATCH 3/3] makefiles/tools/serial.inc.mk: pyterm: log to /tmp by default --- makefiles/tools/serial.inc.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/makefiles/tools/serial.inc.mk b/makefiles/tools/serial.inc.mk index 8ccdcfe92658..f0aecacaa201 100644 --- a/makefiles/tools/serial.inc.mk +++ b/makefiles/tools/serial.inc.mk @@ -44,8 +44,9 @@ endif RIOT_TERMINAL ?= pyterm ifeq ($(RIOT_TERMINAL),pyterm) PYTERMSESSION ?= $(shell date +%Y-%m-%d_%H.%M.%S)-$(APPLICATION)-$(BOARD) + PYTERMLOGDIR ?= "/tmp/pyterm-$(USER)" TERMPROG ?= $(RIOTTOOLS)/pyterm/pyterm - TERMFLAGS ?= -p "$(PORT)" -b "$(BAUD)" -rn "$(PYTERMSESSION)" $(PYTERMFLAGS) + TERMFLAGS ?= -p "$(PORT)" -b "$(BAUD)" -ln $(PYTERMLOGDIR) -rn "$(PYTERMSESSION)" $(PYTERMFLAGS) else ifeq ($(RIOT_TERMINAL),socat) SOCAT_OUTPUT ?= - TERMPROG ?= $(RIOT_TERMINAL)