diff --git a/README.md b/README.md index 237edc5..54e8186 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Pigway Pi Control v3.6.0 +# PIGWay Pi Control v3.6.0 Raspberry Pi 4B + 配套 128×32 OLED / 风扇 / RGB 散热扩展板的本机硬件监控 Agent。 @@ -208,6 +208,7 @@ sudo ./install.sh - 安装必要依赖 - 检查 I²C,并在安装前检测 `/dev/i2c-1` 是否被其他 OLED/LED 控制进程占用 - 发现冲突时列出进程并退出,由用户决定如何处理;安装器不会停止、禁用或杀死其他服务 +- 确认需要多个进程共用 I²C 时,可用 `sudo ./install.sh --force-i2c-conflict` 强制继续;冲突进程仍由用户自行管理 - 安装字体、程序、配置和 systemd unit - 完整保留用户现有配置(包括所有 section、用户值和注释),仅补入缺失的 `[led]` 和 `[api]` 选项,已有用户值优先 - 生成只读 root token,安装 API/Web 文件 diff --git a/SHA256SUMS b/SHA256SUMS index 02f69a6..8142fb5 100644 --- a/SHA256SUMS +++ b/SHA256SUMS @@ -1,10 +1,10 @@ -0960943a15ae23cd067f1169df6640723500107e8c41af070b0c9b889f29914e README.md +1d30072ac84d648985cbead711b7cfa55254bc38ce1d48ac71b976333e83126d README.md 72c46162c33f9587c6ccb01ad53fbaaf4ecec8cd21014b909e87e8707e253e36 app/oled_font_5x7.bin 29f59e41052e1e251bf2f38274cdd321fc195602220b61ac8890202128d7c50a app/pigway_pi_control.py -f32be5b63fe2be51e39c106c232ae3cc14dab7c0c3719e2609b9e93a7802b6c3 app/pigway_pi_control_api.py -9f3b2be557b3cd93c309f8a1cadce7d34b23ca06c1ff69231d934e8180fefb48 config/pigway-pi-control.conf -15b431e62b00886b6561597db059f01f116b5173bdae7a5817f617f7bc73a3ec install.sh -81aea0a89b298b2512fcb9bf6418618ba7a66474d425390cf95a0128c4093474 systemd/pigway-pi-control.service -5d7562c496de597f61b62af48f8f6350ad270e1ebf725426d9f1e5b5d698055e systemd/pigway-pi-control-api.service +6bde03a945b8a8a93694ad4c453a6dcefed1135278ef2cc097029a54046093c1 app/pigway_pi_control_api.py +075cc50f9bb46389323c46fc6625fbd59925a2d9755fb1d5a714ea5a94e00908 config/pigway-pi-control.conf +0c1a68c6ba447f1c17bd5f7fb66b29a54588084023340ac0b7d959717952bcad install.sh +4f6e8db3698a62f57823d3298a0e6814593de6fa3d31e4751b7ea4a76e553e35 systemd/pigway-pi-control.service +aa21cef9a06593371ccff005335b6c0c826fbf4b5c48e4255b5f4b75ce6e9217 systemd/pigway-pi-control-api.service 9f59e7313ee58e687ae6dd29d175c67082674254ac5c5f54168b2735b64c20a4 uninstall.sh -4b4066d104202f664f5df07c97d4e256dde32b5f4426e6a955a3ecef5e08df60 web/index.html +f47627ac7007e54258e3e642358d6829991cbe5469e439fda530d6c9118bea4e web/index.html diff --git a/app/pigway_pi_control_api.py b/app/pigway_pi_control_api.py index 290c150..9e0b907 100644 --- a/app/pigway_pi_control_api.py +++ b/app/pigway_pi_control_api.py @@ -95,7 +95,7 @@ def journal(limit): return rows class Handler(BaseHTTPRequestHandler): - server_version="PigwayAPI/3.6" + server_version="PIGWayAPI/3.6" def log_message(self,fmt,*args): return diff --git a/config/pigway-pi-control.conf b/config/pigway-pi-control.conf index af7298a..5d2e606 100644 --- a/config/pigway-pi-control.conf +++ b/config/pigway-pi-control.conf @@ -1,5 +1,5 @@ # ============================================================================= -# Pigway Pi Control v3.6.0 - 用户配置文件 +# PIGWay Pi Control v3.6.0 - 用户配置文件 # ============================================================================= # # 正式安装后的配置路径: @@ -199,7 +199,7 @@ write_delay_ms = 10 # Raspberry Pi 4 板载 PWR / ACT LED。 # 本机硬件只支持开/关,不支持真正的 PWM 调暗。 # -# off = Pigway Pi Control 启动时关闭该灯。 +# off = PIGWay Pi Control 启动时关闭该灯。 # 若不希望程序干预,可改为 on。 # # 注意: diff --git a/install.sh b/install.sh index 91f38ad..2106123 100755 --- a/install.sh +++ b/install.sh @@ -2,6 +2,19 @@ set -euo pipefail cd "$(dirname "$0")" +FORCE_I2C_CONFLICT=0 +for arg in "$@"; do + case "$arg" in + --force-i2c-conflict) FORCE_I2C_CONFLICT=1 ;; + -h|--help) + echo "Usage: sudo ./install.sh [--force-i2c-conflict]" + echo " --force-i2c-conflict Continue even when another process owns /dev/i2c-1." + exit 0 + ;; + *) echo "ERROR: unknown option: $arg" >&2; exit 2 ;; + esac +done + for required in app/pigway_pi_control.py app/pigway_pi_control_api.py app/oled_font_5x7.bin web/index.html config/pigway-pi-control.conf systemd/pigway-pi-control.service systemd/pigway-pi-control-api.service; do if [ ! -f "$required" ]; then echo "ERROR: required file missing: $required" >&2 @@ -30,12 +43,21 @@ i2c_conflict_pids() { I2C_CONFLICTS="$(i2c_conflict_pids)" if [ -n "$I2C_CONFLICTS" ]; then - echo "ERROR: /dev/i2c-1 is already in use by another process:" >&2 + if [ "$FORCE_I2C_CONFLICT" -eq 1 ]; then + echo "WARNING: /dev/i2c-1 is already in use by another process:" >&2 + else + echo "ERROR: /dev/i2c-1 is already in use by another process:" >&2 + fi while read -r pid; do ps -p "$pid" -o pid=,user=,comm=,args= >&2 || true done <<< "$I2C_CONFLICTS" - echo "Stop or reconfigure the conflicting OLED/LED controller, then run the installer again." >&2 - exit 1 + if [ "$FORCE_I2C_CONFLICT" -eq 1 ]; then + echo "WARNING: continuing because --force-i2c-conflict was specified; no conflicting process will be stopped." >&2 + else + echo "Stop or reconfigure the conflicting OLED/LED controller, then run the installer again." >&2 + echo "If concurrent control is intentional, rerun with --force-i2c-conflict." >&2 + exit 1 + fi fi echo "[2/8] 等待 APT/DPKG..." @@ -139,8 +161,12 @@ check "OLED pages 0..3" grep -Fq 'cmd(0x22);cmd(0);cmd(3)' "$APP" check "UI CPU/TMP/DSK" grep -Fq 'f"TMP {temp:.1f}C"' "$APP" check "UI IP4/IP6" grep -Fq 'ip_label' "$APP" check "UI right column x=72" grep -Fq 'draw_text_5x7(pix,72,y,right[row])' "$APP" -no_other_i2c_owner() { [ -z "$(i2c_conflict_pids)" ]; } -check "No other I2C owner" no_other_i2c_owner +if [ "$FORCE_I2C_CONFLICT" -eq 1 ]; then + printf " %-30s WARN (forced)\n" "I2C owner conflict" +else + no_other_i2c_owner() { [ -z "$(i2c_conflict_pids)" ]; } + check "No other I2C owner" no_other_i2c_owner +fi check "Service running" systemctl is-active --quiet pigway-pi-control.service check "API/Web service running" systemctl is-active --quiet pigway-pi-control-api.service check "API/Web version 3.6.0" grep -Fq 'APP_VERSION="3.6.0"' /usr/local/sbin/pigway-pi-control-api diff --git a/systemd/pigway-pi-control-api.service b/systemd/pigway-pi-control-api.service index c326c7a..4370f6e 100644 --- a/systemd/pigway-pi-control-api.service +++ b/systemd/pigway-pi-control-api.service @@ -1,5 +1,5 @@ [Unit] -Description=Pigway Pi Control API and Web +Description=PIGWay Pi Control API and Web After=network.target pigway-pi-control.service Wants=network.target pigway-pi-control.service diff --git a/systemd/pigway-pi-control.service b/systemd/pigway-pi-control.service index 12a4db8..217edb9 100644 --- a/systemd/pigway-pi-control.service +++ b/systemd/pigway-pi-control.service @@ -1,5 +1,5 @@ [Unit] -Description=Pigway Raspberry Pi OLED/Fan/RGB Monitor +Description=PIGWay Raspberry Pi OLED/Fan/RGB Monitor After=multi-user.target network.target Wants=network.target diff --git a/web/index.html b/web/index.html index 68e8daa..c124c88 100644 --- a/web/index.html +++ b/web/index.html @@ -2,13 +2,13 @@ -Pigway Pi Control +PIGWay Pi Control
-

Pigway Pi Control

正在连接 Raspberry Pi…
离线
+

PIGWay Pi Control

正在连接 Raspberry Pi…
离线