Skip to content

Conversation

@tadeubas
Copy link

@tadeubas tadeubas commented Dec 30, 2025

EDITED:

  • Docker support was removed from this PR
  • Dropped changes from README.md

Changes:

  • Adds a --log flag to the simulator to enable logging at /tmp/cc-simulators/<pid>/cc_simulator.log
  • Adds the firmware/ directory to .gitignore

Testing:

  • Tested on Linux Mint 22.2 (Zara)

Copy link
Collaborator

@scgbckbone scgbckbone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your simulator logging file part. That seem very useful to me as you cannot copy/pasta from termux itself. I would like that change to be split from other docker stuff & resolved my two review comments.

I'm not sure your dockerfile belongs to this repo - would be better if you create your own repo where other users can add other dockerfiles (for instance different os version/type, python version etc.). We can mention your repo in README.md of course.

@tadeubas tadeubas changed the title Enable building the Simulator using Docker Enable logging in the Simulator Dec 30, 2025
@tadeubas tadeubas requested a review from scgbckbone December 30, 2025 23:40
@tadeubas
Copy link
Author

Docker-related changes were removed from this PR to keep the scope focused on simulator logging. I’ll open a separate issue to discuss the best approach for Docker integration (new repo, separate branch, fork, etc.)

@scgbckbone
Copy link
Collaborator

do not create /tmp/cc-simulators directory if --segregate is not specified. In that case it is sufficient to create log file in /tmp

something like this:

Subject: [PATCH] review
---
Index: unix/simulator.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/unix/simulator.py b/unix/simulator.py
--- a/unix/simulator.py	(revision ac0453dcfdf3b3d4c9f53da4e5e206622e7defa4)
+++ b/unix/simulator.py	(date 1767189124247)
@@ -863,12 +863,15 @@
     cc_mpy = os.path.join(cwd, "coldcard-mpy")
     sim_boot = os.path.join(cwd, "sim_boot.py")
 
+    log_base_dir = "/tmp"
+
     if segregate:
         os.makedirs("/tmp/cc-simulators", exist_ok=True)
         os.chdir("/tmp/cc-simulators")
         # our new work /tmp/cc-simulators/<PID>
         os.mkdir(str(pid))
         os.chdir(str(pid))
+        log_base_dir = os.getcwd()
         os.mkdir("MicroSD")
         os.mkdir("settings")
         os.mkdir("VirtDisk")
@@ -907,11 +910,7 @@
 
     log = ("--log" in sys.argv)
     if log:
-        logfile = '/tmp/cc-simulators/%d/cc_simulator.log' % pid
-
-        # create dir for the file in /tmp
-        os.makedirs(os.path.dirname(logfile), exist_ok=True)
-
+        logfile = os.path.join(log_base_dir, 'cc_simulator.log')
         # create or truncate logfile and set correct permissions before starting xterm
         file_desc = os.open(logfile, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o644)
         os.close(file_desc)

@tadeubas
Copy link
Author

Changes made in accordance with the review

@tadeubas
Copy link
Author

I noticed this repository doesn’t have Issues enabled. Do you know where I could open an issue or start a discussion about Docker images?

@tadeubas
Copy link
Author

I found this repo: https://github.com/lattice0/coldcard-docker
Maybe we could add a short note in README about running the simulator with Docker?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants