Add SDL2-based native Tools Menu app and documentation - #2
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6c154468a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else if (idx == ACTION_SET_TXPOWER) { | ||
| snprintf(shell_cmd, sizeof(shell_cmd), "sh -c 'echo Requested txpower: %d mBm; ip link set wlan0 down 2>/dev/null; iw dev wlan0 set txpower fixed %dmBm 2>/dev/null; ip link set wlan0 up 2>/dev/null; iwlist wlan0 txpower 2>/dev/null'", txpower_value, txpower_value); | ||
| } else { | ||
| snprintf(shell_cmd, sizeof(shell_cmd), "sh -c '%s'", actions[idx].command); |
There was a problem hiding this comment.
Stop re-quoting action commands with single quotes
Building shell_cmd as sh -c '%s' breaks any action command that already contains single quotes (for example the awk script in WiFi Scan and the quoted regex/echo strings in later actions), so selecting those menu items produces a shell parse error instead of running the tool action. This is a functional regression for multiple built-in commands and should be fixed by avoiding this quoting pattern or properly escaping embedded quotes.
Useful? React with 👍 / 👎.
| if (copy) { | ||
| char *line = strtok(copy, "\n"); | ||
| while (line && oy < 420) { | ||
| line[56] = '\0'; |
There was a problem hiding this comment.
Prevent out-of-bounds write when truncating output lines
The renderer unconditionally writes line[56] = '\0' for each tokenized output line, but when a line (or the remaining buffer tail) is shorter than 57 bytes this writes past the allocated strdup buffer, causing undefined behavior and potential crashes; a short output such as the "No command entered." path is enough to trigger this condition. Truncation should only happen when the line length is at least 56.
Useful? React with 👍 / 👎.
Motivation
Tools Menu.shshell script to run on the R36S display.MDK4 status + versionandMDK4 help (safe read-only)not present in the original script.Description
cprog/tools-menu-sdl2with sourcetools-menu-sdl2.cimplementing the menu, terminal pane, editable channel/txpower entries, and keyboard/joystick controls.CMakeLists.txtatcprog/tools-menu-sdl2/CMakeLists.txtto discover SDL2 and SDL2_ttf viapkg-configand build thetools-menu-sdl2executable.README.mdwith a new "SDL2 Tools Menu" section that documents the source location, build instructions usingcmake/ninja, and control mappings for the app.popen()and displays output plus exit codes, supports toggling a terminal input mode, and includes special handling forACTION_SET_CHANNELandACTION_SET_TXPOWERcommands.Testing
Codex Task