Add UTF-8 support, Password Reset Utility and Environment Diagnostics#152
Open
rapekas wants to merge 4 commits intoopenwrt-xiaomi:mainfrom
Open
Add UTF-8 support, Password Reset Utility and Environment Diagnostics#152rapekas wants to merge 4 commits intoopenwrt-xiaomi:mainfrom
rapekas wants to merge 4 commits intoopenwrt-xiaomi:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds two utilities: a root password reset script (reset_password.py) and a diagnostic test (test.py) for the XMiR Patcher environment.
Also adds UTF-8 encoding support in file read/write operations to ensure reliable handling of non-ASCII characters across different systems (fixes potential
UnicodeDecodeErroron non-English locales).Changes
1. reset_password.py — Root Password Reset
Script to reset a forgotten root password via SSH or TELNET.
Behavior:
Tries SSH first (if a password exists in memcfg)
Falls back to TELNET (default password: root) when SSH is not usable
Sets a new root password and checks SSH access with it
Optional --ip flag to target a specific device IP
Usage:
Dependencies:
Device on the same network
SSH (with known password) or TELNET (telnet_en=1)
2. test.py — Environment Diagnostics
Script to verify XMiR Patcher setup, imports, config, and device reachability.
Checks:
[1] Imports — xmir_base, gateway, xqmodel, read_info
[2] Configuration — Gateway init, IP, SSH port, memcfg password
[3] Device discovery — Detection of Xiaomi device on the network
[4] Supported models — Lists known models (R3G, R3P, RM2100, R4A, WR30, etc.)
[5] Unsupported models — Notes that BE3600, BE2600, and other Wi‑Fi 7 (BE) devices use Qualcomm IPQ (ARM) instead of MediaTek MT7621 (MIPS), so Breed bootloader and some features are not supported
Usage:
Testing
Both scripts use the existing gateway and xmir_base modules and are intended to run via ./run.sh.
Motivation
reset_password.py — Provides a simple way to recover root access when the password is lost, using SSH or TELNET.
test.py — Helps users quickly verify their environment and avoid common setup issues.