# serial_cmd **Repository Path**: alex_2473_1/serial_cmd ## Basic Information - **Project Name**: serial_cmd - **Description**: 基于Rust的AT串口调试工具 - **Primary Language**: Rust - **License**: Not specified - **Default Branch**: dev - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2024-04-10 - **Last Updated**: 2025-02-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # serial_cmd V2版本见:[链接](https://gitee.com/alex_2473_1/serial_cmd/tree/v2-dev/) ## 关于openwrt ### 构建 > 环境: > 系统版本 ubuntu22.04 Server > 在openwrt获取并添加交叉编译工具至环境变量 配置tool_chain ``` shell export OPENWRT_TOOL_CHAIN_PATH=/path/to/openwrt_toolchain_dist export PATH=$PATH:$OPENWRT_TOOL_CHAIN_PATH/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OPENWRT_TOOL_CHAIN_PATH/lib # 无相关目录报warn export STAGING_DIR=$HOME/openwrt/staging_dir ``` 使用rust 1.74构建(target mipsel-unknown-linux-musl) ``` shell rustup default 1.74 rustup target add mipsel-unknown-linux-musl cargo build --release --target mipsel-unknown-linux-musl ``` ## 关于龙芯 由于 `serialport` 存在 `nix` 依赖不支持loongarch64 详见:`https://crates.io/crates/nix` 故无法进行维护 ## 使用案例 ``` shell root@OpenWrt:~# serial_cmd -D /dev/ttyUSB2 -B 115200 # 具体见 --help AT+CPIN=? # <-输入 [2024-04-13 11:02:00.564468415 UTC] Received: AT+CPIN=? # <-输出 [2024-04-13 11:02:00.566600029 UTC] Received: OK # <-输出 ``` ``` powershell (base) PS E:\software\tools\serial_cmd> serial_cmd.exe -D COM4 -B 115200 AT+CPIN? [2024-09-07 02:31:03.575795300 UTC] Received: AT+CPIN? [2024-09-07 02:31:03.575937 UTC] Received: +CPIN: READY [2024-09-07 02:31:03.576122800 UTC] Received [2024-09-07 02:31:03.576221500 UTC] Received: OK ``` 通过文件读取 `-f / --file` ``` powershell (base) PS E:\software\tools\serial_cmd> cargo run --release -- --file .\.tools\serial_cmd warning: `G:\rs_env\.cargo\config` is deprecated in favor of `config.toml` note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml` Finished `release` profile [optimized] target(s) in 0.12s Running `target\release\serial_cmd.exe --file .\.tools\serial_cmd` AT+CPIN? [2024-09-07 10:20:49.198264200 UTC] Received: AT+CPIN? [2024-09-07 10:20:49.198326200 UTC] Received: +CPIN: READY [2024-09-07 10:20:49.198358900 UTC] Received [2024-09-07 10:20:49.198389900 UTC] Received: OK ``` ## 经测试设备 ``` toml [devices.Quectel] RM500U EC200A ``` ## TodoList - 命令行单次输入输出 ## Failed - support for loongarch64 ## LICENSE [MPL](LICENSE)