diff --git a/CHANGELOG.md b/CHANGELOG.md index a9d6fcdc..a8424211 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,39 @@ # 更新日志 +## 2026-10-19 · CPU 核心控制、机型适配与安装器改进 + +本次覆盖 MU300 / F50 / V50 / U30 Air 公共功能,并包含下列机型专属修正。已提供内核 **7.2.8**、**6.18.54** 两份 `mtp1` 安装包,均包含 Windows、Apple Silicon macOS 安装器、Python 入口和使用指南。 + +### CPU 设置 + +- 网页 CPU 设置新增逐核心开关,可单独启用或关闭可控制的核心,并选择是否在开机时自动应用。CPU0 保持在线,默认不会主动关闭其他核心。 +- 修复网页应用核心设置时误报「CPU 核心配置无效」的问题;保留非法参数检查。 +- 核心开关与调频操作互斥,应用失败时尝试恢复之前的核心状态。关闭整个 CPU 簇后,保留该簇已保存的频率设置,避免其他设置覆盖它。 +- 两套主线内核明确启用 CPU 热插拔,打包时检查实际能力,避免页面有开关、内核却无法控制核心。 +- 补齐匹配原厂固件的 U30 Air CPU 电压偏移支持,并修正 CPU 簇识别。调压仍需用户主动设置,不默认降压,也不把其他固件的电压编码直接套用。 + +### 蜂窝网络与指示灯 + +- 「自动模式兼容性」移至「蜂窝 → 网络锁定 → 网络模式」,只在自动网络模式下显示,原适配设置入口移除。 +- 选项改为易懂的「机型默认」「全制式自动(134,含 2G)」「自动选网(152,不含 2G)」,补齐中文、英文、土耳其语说明。MU300 系列当前机型默认均为 134,保留用户明确选择。 +- 补充双卡高延迟、网络卡顿和自动驻网偏好的用途说明;切换不等于锁频段,不保证一定优先驻留 n78。应用仍沿用原有网络模式与重连流程。 +- 按 V50 原厂固件修正网络灯对应关系:SIM1 对应 NET2,SIM2 对应 NET1。网页 LED 设置的卡槽标注同步修正,保留各物理灯已有的亮度和开关配置。 + +### Windows 安装器 + +- MU300 系列通过 Windows 有线 ADB 检查设备时,自动禁用同一台设备的 MTP 接口,并显示通知,避开原厂 MTP / ADB 冲突。兼容 `ZTE_F50` 等带厂商前缀的机型名称。 +- 按完整 USB 序列号及父子设备关系定位,只处理对应的 MTP 接口;ADB、USB 网卡、串口和其他手机保持原状。纯列表刷新、无线 ADB、macOS 和 E5 适配器不执行此处理。 +- 不增加安装器确认步骤;权限不足时由 Windows 请求管理权限。禁用失败或权限被拒绝时,只提示并继续原安装流程,不自动重新启用 MTP。 +- 新装和重新封装安装包均包含对应辅助文件,Python 命令行入口使用相同处理逻辑;使用指南补充中英文说明。 + +### 验证与发布 + +- Windows 后端回归共 208 项:195 项通过,13 项按环境跳过;11 组界面回归通过。编译后的 Windows 后端另通过模拟 MTP 匹配、幂等和失败后继续 ADB 的检查。 +- U30 Air 的核心开关、开机保存及电压偏移已做实机验证;本次 V50 灯位修正和 Windows MTP 实际禁用效果尚未实机验证。 +- `mtp1` 两份包已完成校验;相对同日上一批,boot、rootfs 和 Magisk 原始载荷逐字节一致,仅更新安装器及相关说明和校验信息。 + +实现及验证细节:[CPU 核心控制](docs/CPU-CORE-CONTROL-20261019.zh-CN.md)、[U30 Air 调压](docs/U30AIR-CPU-VOLTAGE-20261019.zh-CN.md)、[自动模式兼容性](docs/AUTO-WORK-MODE-SIM2-20261019.zh-CN.md)、[V50 网络灯](docs/V50-NET-LAMP-MAPPING-20261019.zh-CN.md)、[Windows MTP 处理](docs/INSTALLER-WINDOWS-MTP-20261019.zh-CN.md)。 + ## 2026-10-10 · 上游稳定性修复(尚未打包) - 合入 Wi-Fi 上下电并发保护,修复启动或重新打开热点时可能卡死的问题;补齐初始化失败后的资源清理。 diff --git a/desktop/installer.py b/desktop/installer.py index 09ca3cfd..047218f0 100644 --- a/desktop/installer.py +++ b/desktop/installer.py @@ -251,8 +251,8 @@ class Android: bundled=package_root()/('tools/adb.exe' if sys.platform=='win32' else 'tools/macos/adb' if sys.platform=='darwin' else 'tools/adb') self.adb=args.adb or (str(bundled) if bundled.is_file() else shutil.which('adb')) or str(bundled) - listing=self.call('devices').decode(errors='replace') - serials=[l.split()[0] for l in listing.splitlines() if len(l.split())==2 and l.split()[1]=='device'] + listing=self.call('devices','-l').decode(errors='replace') + serials=[l.split()[0] for l in listing.splitlines() if len(l.split())>=2 and l.split()[1]=='device'] if args.serial: self.serial=args.serial elif len(serials)==1: self.serial=serials[0] elif len(serials)>1 and sys.stdin.isatty() and not GUI: @@ -262,6 +262,18 @@ class Android: self.serial=serials[int(selected)-1] else: raise ValueError('Specify --serial; expected one online Android device: '+repr(serials)) if self.serial not in serials: raise ValueError('Android is not online: '+self.serial) + if sys.platform=='win32' and not GUI: + helper=package_root()/'desktop/windows_mtp.py' + if helper.is_file(): + spec=importlib.util.spec_from_file_location('_mu300_windows_mtp',helper) + module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module) + entries=[] + for line in listing.splitlines(): + values=line.split() + if len(values)>=2 and values[0]==self.serial: + entries.append({'serial':self.serial,'wireless':':' in self.serial, + 'label':next((v[6:] for v in values[2:] if v.startswith('model:')),'')}) + module.prepare_devices(entries) if self.shell('id -u',root=False).strip()=='0': self.su=False else: self.su=True diff --git a/desktop/package.py b/desktop/package.py index 4dc3b8d3..a17b5041 100644 --- a/desktop/package.py +++ b/desktop/package.py @@ -51,6 +51,7 @@ unset MU300_DEPLOY_ROOT # Desktop fixes must apply even when augmenting an older Magisk archive; # its original scripts stay byte-for-byte unchanged. shutil.copyfile(TOP/'tools/android-bootchain.sh', dest/'android-bootchain.sh') + shutil.copyfile(TOP/'installer/backend/windows_mtp.py', dest/'windows_mtp.py') shutil.copyfile(TOP/'android/magisk/mu300-linux-switch/bootchain.sh', dest/'bootchain.sh') for p in (TOP/'desktop/boot').iterdir(): if p.is_file(): shutil.copyfile(p, assets/p.name) diff --git a/docs/AUTO-WORK-MODE-SIM2-20261019.zh-CN.md b/docs/AUTO-WORK-MODE-SIM2-20261019.zh-CN.md index c9d892ac..b0d77239 100644 --- a/docs/AUTO-WORK-MODE-SIM2-20261019.zh-CN.md +++ b/docs/AUTO-WORK-MODE-SIM2-20261019.zh-CN.md @@ -2,19 +2,45 @@ ## 自动网络模式编号 -网页“蜂窝 → 适配设置”新增默认、134、152,下拉菜单显示默认数字。 +下拉选项使用“全制式自动(134,含 2G)”和“自动选网(152,不含 2G)”, +机型默认同时显示对应名称。说明明确 134 为 5G/4G/3G/2G 组合,152 为 +5G/4G/3G 组合;依据是 E5 仓库 `CELLULAR-LATENCY-20261010.zh-CN.md` +记录的原厂 RIL 映射,不承诺任何编号在所有基带上固定优先 n78。 +此次只修改选项名称与三语言说明,配置仍保存 default/134/152。 + +网页入口调整到“蜂窝 → 网络锁定 → 网络模式”下的“自动模式兼容性”, +原适配设置入口移除。只在自动模式显示,选项为默认、134、152,默认项显示数字。 MU300、F50、V50、U30 Air 当前默认均为 134。双卡时若网络延迟很高或卡顿, 用户可尝试另一编号;152 是否有改善取决于基带,未据此强制更改所有机型。 +说明同时覆盖自动选网偏好,例如联通 n78/n1 的驻留选择。这是用户反馈的 +实际体验,尚无原厂映射证据证明某编号固定优先某频段;不等同于锁频段, +不承诺切换后一定驻留 n78。此次仅补充三语言说明,没有改动 AT 或模式映射。 + `unisoc_modem.main.auto_work_mode_default` 保存平台默认(当前为 134), `auto_work_mode` 保存用户选择(default/134/152)。仅自动模式使用这个编号, 明确选择的 4G/SA/NSA 不变。手动应用、恢复自动模式、早期开机回放复用同一 编码函数,修改时保留另一槽位和主卡索引。两种编号均识别为自动模式。 -保存适配设置不发送 AT;在网络锁定重新应用自动模式后生效。 +下拉选择仅是草稿;点击“保存并应用”并确认后,仅保存该 UCI 选项,再通过 +原网络模式任务应用到当前查看的 SIM,沿用原重连。选项由两卡共用;保存失败 +不执行网络任务,保存期间切换查看卡槽后不误应用到新卡槽。保存成功后,即便 +本次基带应用失败,已保存的兼容性选择仍保留,不自动撤销用户选择。 +不执行全局 `uci.apply()`,不额外重载服务或改变 AT 初始化顺序。 已保存自动模式且开启开机回放的卡,也会在下次启动使用新编号。 不新增回放任务,不改变 AT 所有者或原有回放/拨号顺序。 +入口迁移已通过两仓库合计 24 组实际页面测试,覆盖三语言、手机/桌面、 +默认与显式选择、自动模式显隐、取消、UCI 失败、保存期间切换查看卡槽, +以及先保存后单次调用原模式任务;原网络锁定任务和状态恢复回归通过。 +2026-10-19 已将入口调整热部署到 U30 Air:仅替换 `auto-mode.js`、 +`common.js`、`locks.js`、`settings.js` 四个网页资源,逐文件 SHA-256 和 +设备 HTTP 实际返回内容均校验一致。原文件备份在 +`/root/hotfix-backups/20261019-auto-mode-placement`。 +部署前后启动 ID、网络/无线/unisoc_modem 配置校验和、WAN 状态均未改变; +没有应用网络模式、重连、重载服务或重启。交互回归为前述离线页面测试, +本次没有进行新的蜂窝网络模式实机切换验证,尚未重新打包。 + ## SIM2 默认射频关闭 MU300 仓库所有机型共用 `mu300-radio-allowed` 的持久策略: diff --git a/docs/CPU-CORE-CONTROL-20261019.zh-CN.md b/docs/CPU-CORE-CONTROL-20261019.zh-CN.md new file mode 100644 index 00000000..a5acf2da --- /dev/null +++ b/docs/CPU-CORE-CONTROL-20261019.zh-CN.md @@ -0,0 +1,89 @@ +# 网页逐核开关(2026-10-19) + +用户要求:在网页 CPU 设置控制各核心开关,并可勾选开机自动应用。 +这是用户主动选择的 CPU hotplug 功能,不是用强制关闭核心掩盖无线延迟, +也不把减少核心数量当作已测得的省电结论。 + +## 两仓库公共实现 + +- CPU 页面新增独立的“CPU 核心开关”卡片,显示每个实际 present 核心的 + 在线状态;使用内核 `cpuN/online`,不写频率、电压、温控、AT、NV 或 eMMC。 +- CPU0 保持在线。缺少 online 节点、不可写或状态无效的核心只读;不会 + 通过改权限或替换驱动强行提供内核没有的 hotplug 能力。 +- 只有点击“应用核心设置”才执行。未勾选“开机自动应用”时仅改变本次运行, + 同时移除这一项的开机配置;勾选后保存到 `/etc/unisoc-cpu-cores.json`。 + 不修改已有调频、调压、温控的保存开关。 +- “恢复核心初始状态”恢复本次运行首次设置前捕获的状态,并取消核心开关 + 的开机保存。已有自动应用配置时,基线在启动回放前捕获;不宣称是所有 + 原厂策略运行前的硬件出厂状态。 +- `unisoc-cpu-cores` 为 START=99 的一次性服务,晚于现有调频恢复。 + 没有保存配置时直接返回,不调用 ucode,不增加常驻进程、定时器或等待。 +- 新装、离线机型 staging、插件安装和更新均包含组件、RPC ACL、启动链接 + 及配置保留规则。E5/T551M/M8/T512N 共用 E5 插件路径;MU300/F50/V50/ + U30 Air 共用 MU300 插件路径,无机型名称判断。 + +## 写入与联动 + +后端先完整校验核心列表、布尔值、固定核心及重复项,再写 sysfs。先开启 +需要的核心,再关闭其他核心;每次写入后读回,失败不重试、不继续执行后续 +步骤。核心写入或保存失败时恢复已改动的核心,明确报告回滚是否完整。 +配置通过临时文件与 rename 替换;这里只保证文件替换方式,不承诺突然断电 +时配置一定落盘。开机回放错误保留原配置并在卡片显示,不自动重置整机或基带。 + +核心写入使用独立互斥锁,同时使用各仓库已有的调频写锁,避免和频率设置 +并发操作。网页保留尚未应用的选择;可见页面沿用 LuCI 两秒刷新显示实际状态, +页面隐藏或离开后不发起本组件查询。应用后重新打开 CPU 页面可完整刷新由 +hotplug 改变的调频策略列表,不擅自清空其他区域尚未提交的编辑。 + +MU300 的 policy 拓扑优先读取稳定的 `related_cpus`,而非随离线变化的 +`affected_cpus`。两仓库都把全离线 CPU 簇的频率控件设为只读,并在保存其他 +频率/温控设置时保留其已保存的频率请求。想修改离线簇的频率,需要先开启 +对应核心。下一次正常开机先恢复频率,再应用用户保存的核心开关。 + +本功能不关闭内核平台自己的 hotplug 策略。如果平台同时改变核心状态, +会显示实际回读结果或报告拒绝,不循环强写和平台争抢。 + +## 验证范围 + +实际网页提交回归补充:HTTP ubus 会在参数中加入 `ubus_rpc_session`。 +原输入校验误把它当成未知核心配置,导致命令行测试通过而网页应用报 +`cpu_cores_invalid`。两仓库现仅在请求解析入口移除这个传输字段,再交给 +原有严格配置校验;其他未知字段、CPU0 关闭及非法核心列表仍然拒绝, +会话字段不会进入保存文件。新增真实 ucode 回归覆盖带会话的临时/保存请求 +及仍需拒绝的未知字段。U30 Air 已通过实际登录网页关闭/开启 CPU7、 +勾选保存和恢复初始状态;测试配置清除,八核在线。此修复无需再次更换内核。 + +U30 Air 实机补齐时发现:已运行的 7.2.8 主线内核没有启用 `CONFIG_HOTPLUG_CPU`, +因而八个核心都没有 `online` 节点,仅部署网页会全部只读。MU300 公共主线配置 +现显式启用该项,构建产物能力校验也将其列为必需项,防止打出仅有前端的包。 +启用热插拔不会默认下线任何核心;原先用户指定的 CPU0 低延迟策略不变。 + +- 在实际 OpenWrt ucode 运行环境执行假 sysfs:发现 present 核心、CPU0 与 + 固定核心保护、非法/重复/缺失/错误类型请求、临时设置、持久化、启动 + 回放、恢复初始状态、只读文件系统注入的中途写入失败及保存失败回滚。 + 全部写入限定容器临时目录,失败注入使用只读测试文件,不写主机 sysfs。 +- E5 CPU 后端 23 项回归通过,包括离线簇配置保留。 +- MU300 原有频率与温控实际 ucode 回归通过,新增稳定拓扑与离线配置保留场景。 +- 新组件在两套 CPU 页面测试中/英/土、360/1280 宽度,验证固定核心不被 + 误启用、草稿不被刷新覆盖、保存/取消保存/恢复/错误反馈及无横向溢出。 +- 原 MU300 CPU 页面 24 组主题/语言/尺寸回归通过,频率/电压/温控 + 独立保存及其他区域草稿保持正常。相关 JS 与 shell 语法检查、diff 检查通过。 + +2026-10-19 已在 U30 Air 完成部署和实机验证: + +- 原内核 7.2.8 的 `CONFIG_HOTPLUG_CPU` 未启用,CPU0~7 均缺少 online 节点。 + 已复用现有构建卷编译公共配置的新内核及完整配套模块;没有新增内核源码副本。 +- 同步启动镜像实际加载的 26 个模块及根分区模块,启动分区写后回读一致, + misc 未改。运行内核 `/sys/kernel/btf/vmlinux` 与构建 vmlinux 的 BTF 哈希相同, + 根分区完整模块清单校验通过;未出现 BTF/符号/vermagic 加载错误。 +- 实际重启后,以八核全开的临时保存配置验证 S99 开机回放成功,日志返回 ok=1。 + 随后逐个关闭、重新开启 CPU1~CPU7,均回读成功;CPU0 关闭请求被拒绝且状态不变。 + 最终恢复八核在线,并删除测试用开机配置,不替用户选择核心或保存策略。 +- 通过真实登录页面验证八个核心控件,其中七个可操作、CPU0 固定;页面刷新后 + 没有 JavaScript 错误。网络/无线/基带配置校验和不变,WAN up=true、pending=false, + 热点恢复为 36 信道/80 MHz,CPU0 idle disable 保持 1/1/1,电压偏移仍为 0。 +- 网页组件备份:`/root/hotfix-backups/20261019-cpu-cores`;内核及旧模块备份: + `/root/hotfix-backups/20261019-cpu-hotplug`。 + +其他机型尚未实机验证,也没有重新打发布包。尚未测试关闭整个 CPU 簇、网络 +负载或续航;单核开关通过不代表所有核心组合均已验证,不承诺一定降低功耗。 diff --git a/docs/INSTALLER-WINDOWS-MTP-20261019.zh-CN.md b/docs/INSTALLER-WINDOWS-MTP-20261019.zh-CN.md new file mode 100644 index 00000000..e5beaa54 --- /dev/null +++ b/docs/INSTALLER-WINDOWS-MTP-20261019.zh-CN.md @@ -0,0 +1,14 @@ +# Windows 有线 ADB 的 MTP 冲突处理 + +MU300 系列原厂 Android gadget 的 MTP 接口可能影响 Windows 有线 ADB 稳定性。安装器在用户选定设备并检查 Android 时,自动处理该设备的 MTP 接口;纯设备列表刷新不会修改 Windows 设备状态。 + +- 仅 MU300/F50/V50/U30 Air 的 Windows 有线 ADB 流程启用;E5 适配器、macOS、无线 ADB 均跳过。 +- 根据 USB composite 父节点的完整序列号定位唯一设备,只操作该父节点下的 USB MTP/WPD 接口。不会禁用 USB composite 父节点、ADB、网卡、串口或其他手机。 +- 在具有管理权限的进程中再次检查父节点、序列号和 MTP 类型,然后按精确 InstanceId 禁用。没有权限时自动请求 Windows UAC,不增加安装器确认步骤。 +- 重新查询 Windows,确认 ProblemCode 为 22 后才显示成功 toast;已有禁用状态不重复执行。操作不自动恢复 MTP。 +- 枚举失败、操作失败、UAC 被拒绝或结果无法确认时,仅弹警告,继续 ADB 检查及原安装流程,不将辅助操作失败当成安装失败。 +- 不修改 Android 的 USB 配置、射频、启动链或安装载荷,不引入后台轮询服务。 + +共享安装器的通知事件和适配器开关保留在公共源码中,启用条件明确限定为 `adapter.kind == 'mu300'`;MU300 的 Python 命令行入口使用相同辅助实现。根目录使用指南同步说明该行为。 + +测试覆盖:精确序列号及父子匹配、多设备隔离、重复序列号拒绝、已禁用幂等、WPD GUID/兼容 ID、无线与 E5 排除、UAC 拒绝、回读失败、失败后继续 ADB、编码参数,以及中英文 toast。离线测试不能证明所有原厂固件的物理 ADB 稳定性。 diff --git a/docs/U30AIR-CPU-VOLTAGE-20261019.zh-CN.md b/docs/U30AIR-CPU-VOLTAGE-20261019.zh-CN.md new file mode 100644 index 00000000..cca40c53 --- /dev/null +++ b/docs/U30AIR-CPU-VOLTAGE-20261019.zh-CN.md @@ -0,0 +1,73 @@ +# U30 Air CPU 电压偏移适配(2026-10-19) + +## 原因与固件依据 + +现机已有 `sprd-cpufreq-v2` 调压驱动,三个 domain 和 31 个频率/电压对 +均可读取,但 `cpu-voltage-platform` 只验证过 F50/V50 的 SML,因此返回 +`firmware=false`、`supported=false`,网页没有开放偏移调整。这是缺少 U30 Air +固件验证适配,不是主频、电压表读取或网页控件本身故障。 + +本机身份:`mu300-device=u30air`,eMMC CID +`ec290041543353464230116d37222c00`,SoC compatible 为 `sprd,ums9620`。 +已归档的原厂 Android 指纹为 +`ZTE/U30Air/U30Air:13/TP1A.220624.014/20241127.203422:user/release-keys`。 +本次从实际设备只读提取 SML,A/B 两槽均为 1 MiB、完整 SHA-256 均为: + +`f27ac16f44e6cdc87a8ee00a9b53c499c8dde0c3b92c771388e256e84ef12e70` + +与已逆向并实机验证的 F50 SML +`ff4782690fd805ff54fe34853ef8ee5c7e51c3259e20077c55373b50a4b259c2` +对比,1 MiB 中仅 508 字节不同,全部位于认证区的 512 字节范围 +`[0x233e8, 0x235e8)`。此前部分以及之后所有字节一致。 +512 字节头中的载荷长度为 `0x22f50`,实际载荷 +`[0x200, 0x23150)` 逐字节一致,载荷 SHA-256 为: + +`119f874110ce04f9623cda30b85bae35b2ad7da494a1a26c1f7553f9f64bb1fd` + +因此沿用已经分析的 SMC `0x8200060b`、三 domain 的符号/mV 偏移字节编码, +以及 CPU/SRAM 成对电压表的 selector 舍入逻辑。调用入口、处理代码、供电域 +映射与表均不是仅凭 SoC 相同推测,而是本机实际载荷与已验证实现完全一致。 +原始二进制和逐段比较回执保存在忽略目录 `work/u30air-voltage-20261019/`, +不放入仓库、固件或重复复制进 WSL。 + +## 源码变更 + +- 公共 `cpu-voltage-platform` 加入这份 U30 Air SML 的完整精确哈希。 + 仍检查 SoC、两槽分区和各 1 MiB 大小;未知固件不开放非零偏移。 + 已验证的 F50/V50 路径不变,未来固件也不会仅凭 U30 Air 名称自动放行。 +- 复用原有三 domain 调压、范围、3.125 mV 步进、保存确认、正常关机与 + 异常重启恢复流程。仅在启动驱动时通过只读模块参数调用一次 DVFS_INIT, + 不提供运行时调压,也不卸载驱动重复初始化。 +- 电压 domain 的核心标签优先读稳定的 `related_cpus`,缺少该属性时才用 + `affected_cpus`,避免用户逐核离线后标签跟着改变。 +- 不改写 SML、Android、NV、DTBO、misc、内核或调频模块,不调整用户的 + 频率、温控、射频和无线配置。不涉及 E5 仓库。 + +## 验证与热部署 + +Python 电压回归通过;其中需要 ucode 的运行项在实际 OpenWrt 容器中单独 +执行并通过。补入 U30 Air 精确哈希验证,并继续验证未知哈希及错误分区 +大小拒绝;BusyBox standalone ash 的测试显式调用夹具哈希 stub,避免其 +内置 sha256sum 绕过 PATH 导致假失败,生产代码没有哈希绕过。 + +连接的 U30 Air 运行内核 `7.2.8`,已有驱动提供所需 ABI,无需编译新内核。 +部署了平台适配器及电压状态后端,文件 SHA-256 回读一致,备份位于 +`/root/hotfix-backups/20261019-u30air-voltage`。 + +正常重启的单档正偏移验证:三个 domain 均临时设为 `+3125 µV`,重启后模块 +参数为 `3125,3125,3125`,三个 domain 的全部 **31 个电压表项目逐项增加 +恰好 3125 µV**,频率列表不变、无待生效差异。不是仅凭网页的保存成功消息 +认定调压已生效。 + +随后保存零偏移并再次正常重启,31 个电压表项目与部署前逐字节一致,模块 +参数恢复 `0,0,0`;原来没有保存电压配置,已移除本次测试创建的配置文件, +armed 标记已由正常关机流程清除。调压支持保留,用户刷新 CPU 页面后可自行 +设置下次启动的偏移。两次启动后 network/wireless 配置哈希与测试前一致。 +恢复后的正常启动健康检查:网页实际使用的 `mu300dash.cpu_voltage_get` +返回 `supported=true`、三个 domain、零偏移且 `pending=false`;WAN up=true、 +pending=false,热点 5180 MHz/80 MHz,根分区 ext4 保持读写,没有新的 +Oops/panic/DVFS 初始化失败。此前按用户要求设置的 CPU0 三个 idle +disable 仍为 1,没有因本次调压适配被修改。 + +这验证了该实际固件的偏移编码、驱动初始化、表回读和恢复流程,不代表 +极限降压或所有电压档位的稳定性/续航认证。未编译打包,源码尚未提交。 diff --git a/docs/V50-MU3351-20261014.zh-CN.md b/docs/V50-MU3351-20261014.zh-CN.md index bc530531..24a49b86 100644 --- a/docs/V50-MU3351-20261014.zh-CN.md +++ b/docs/V50-MU3351-20261014.zh-CN.md @@ -56,8 +56,12 @@ P0_0–7 对应 `0x24–0x2b`;P1_0–3 对应 `0x20–0x23`;P1_4–7 对应 LuCI 三组独立开关和亮度,包含中/英/土语言。亮度按白光 80、蓝/红 120 限幅。 旧兼容接口在 V50 上不争用 AW,也不误驱动 PMIC。 -OpenWrt 把 NET1/NET2 适配为 SIM1/SIM2 注册状态,LTE 蓝、NR 白、无卡熄灭、 -离线红;这与原厂按运营商/内置或外置卡定义 NET 灯的策略不同。 +OpenWrt 两组灯分别显示逻辑卡槽注册状态,LTE 蓝、NR 白、无卡熄灭、离线红。 +2026-10-19 根据实际 B15 `NotificationManagerService.setNetLight()` 修正灯位: +NET1 对应 SIM2(内置卡 2/3),NET2 对应 SIM1(内置卡 1/外置卡);此前固定 +按 SIM1→NET1、SIM2→NET2 分配是错误的。物理引脚和各灯亮度配置保持不变。 +这里只对齐原厂物理卡到 NET 灯的对应,仍保留 OpenWrt 双卡各自显示注册状态, +不宣称复刻原厂选中卡与 `sim_network_rules` 的全部颜色策略。 Wi-Fi 5 GHz 白、2.4 GHz 蓝。注册变化从现有持久 AT URC 读者传递, Wi-Fi 使用 ubus 事件,闪烁使用内核 LED timer,不增加常驻 AT 轮询或用户态闪烁线程。 diff --git a/docs/V50-NET-LAMP-MAPPING-20261019.zh-CN.md b/docs/V50-NET-LAMP-MAPPING-20261019.zh-CN.md new file mode 100644 index 00000000..8b7fbb09 --- /dev/null +++ b/docs/V50-NET-LAMP-MAPPING-20261019.zh-CN.md @@ -0,0 +1,52 @@ +# V50 NET1/NET2 对应修正(2026-10-19) + +用户观察:同一张卡在 Android 亮 NET2,而在 OpenWrt 亮 NET1。 + +## 已确认原因 + +现有物理 LED 引脚组经过此前点灯确认,不需要交换驱动中的 NET1/NET2 名称。 +问题在 `v50-led-status.network()`:之前把逻辑卡槽 0/1 直接用于 +`net$((slot+1))`,错误地假定 SIM1 对应 NET1、SIM2 对应 NET2。 + +核对已有本机原厂 V50 B15 固件: + +- 版本 `V50_V1.0.0B15`,Android 指纹 + `ZTE/MU3351/MU3351:13/TP1A.220624.014/20250527.235207:user/release-keys`。 +- `system/framework/services.jar` SHA-256: + `b305826bb767f3753e9a8a4d7d98ab8c0944da8ae37b9e3de8e750fd91fd44d9`。 +- 直接分析 `classes2.dex` 中 + `NotificationManagerService.setNetLight()` 及其构造函数,不依据相似机型推测。 + +构造函数的 NET1 颜色编码前缀为 `0x01000000`,NET2 为 `0x02000000`。 +`setNetLight()` 读取物理选择 `zte_webserver_sim_slot_id`,分支对应为: + +| 原厂物理卡 ID | 卡 | 逻辑槽位 | 原厂目标灯 | +| --- | --- | --- | --- | +| 0 | 内置卡 1 | SIM1 / SPACTCARD=0 | NET2 | +| 1 | 内置卡 2 | SIM2 / SPACTCARD=1 | NET1 | +| 2 | 内置卡 3 | SIM2 / SPACTCARD=1 | NET1 | +| 3 | 外置卡 | SIM1 / SPACTCARD=0 | NET2 | + +Dalvik 方法内关键位置:物理卡 0 的 `0x0288` 起设置 NET2 并清除 NET1; +物理卡 2 的 `0x02e6` 起设置 NET1 并清除 NET2;物理卡 1 的 +`0x033c` 起设置 NET1 并清除 NET2;外置卡分支 `0x0358` 起 +清除 NET1 并设置 NET2。颜色条件另由原厂 `sim_network_rules` 决定,本次 +不把这一条件混作物理灯位,也不根据运营商猜测用户改装卡槽的接线。 + +原始分析及反汇编位于忽略目录 `work/v50-card-topology/stock-led-policy.asm`; +没有展开新的完整系统镜像或建立额外的 WSL 构建副本。 + +## 修正范围 + +- V50 用户态灯控改为 SIM1→NET2、SIM2→NET1;所有注册事件、缺卡、数据 + 状态、启动、设置刷新与温度告警仍通过同一个 `network()` 入口执行。 +- `signal`/`signal_brightness` 继续控制物理 NET1,`signal2` 对应物理 NET2。 + 不交换用户已保存的亮度和开关;网页的中/英/土 SIM 标注同步纠正。 +- 状态缓存继续按逻辑卡槽保存,不交换卡槽、上网接口、物理选卡 GPIO 或 AT + 指令,不增加 AT 查询、轮询或服务。Wi-Fi 灯与其他型号没有修改。 +- 保留此前双卡分别显示注册状态和 LTE 蓝/NR 白的行为;这里只纠正灯位, + 不宣称完整重现原厂选中卡的所有颜色/熄灭策略。 + +V50 假 sysfs 回归已按原厂对应更新,验证两卡独立、亮度、关闭灯、Wi-Fi +独立、缺卡、短注册事件和温度告警。尚未对本次改动做 V50 实机点灯验证, +未热部署、未编译打包、未提交。 diff --git a/docs/cpu-voltage.zh-CN.md b/docs/cpu-voltage.zh-CN.md index 3e2ffea6..c6e66fd9 100644 --- a/docs/cpu-voltage.zh-CN.md +++ b/docs/cpu-voltage.zh-CN.md @@ -1,4 +1,4 @@ -# F50 CPU 电压偏移 +# UMS9620 CPU 电压偏移(F50/V50/U30 Air) CPU 页面按固件的三个 domain 显示对应 CPU 核心、当前偏移、下次启动偏移和频率/电压表。 频率设置即时生效;电压设置独立持久化,仅在重启初始化调频驱动时应用。 @@ -15,6 +15,8 @@ CPU 页面按固件的三个 domain 显示对应 CPU 核心、当前偏移、下 插件只通过只读 cpufreq 属性发现 domain,不把 policy 编号或 E5 的电源轨映射照搬给 F50。 平台适配器 `/opt/mu300/bin/cpu-voltage-platform` 验证 SoC 以及两个 SML 分区; 没有匹配驱动或未知固件时禁用非零调压,仍可恢复默认。 +U30 Air 的固件比对、精确哈希与 31 个电压表项目的启动验证见 +[U30 Air 调压适配记录](U30AIR-CPU-VOLTAGE-20261019.zh-CN.md)。 插件不依赖 AT、基带、网络或其他看板进程,没有后台轮询调压任务。 现有内核内置驱动不能热替换;需要配套的新 Image 和模块。6.18/7.2 使用同一份驱动。 diff --git a/installer/GUIDE.md b/installer/GUIDE.md index cd2bd8f0..867d192a 100644 --- a/installer/GUIDE.md +++ b/installer/GUIDE.md @@ -6,6 +6,8 @@ 安装前备份重要文件,确认安装包适用于你的机型,并保持设备稳定供电。在 Android 中开启 USB 调试,允许这台电脑调试,并准备好 Magisk/root。 +MU300 系列在 Windows 通过有线 ADB 检查设备时,安装器会自动禁用该设备的 MTP 文件传输接口并显示通知,以避开原厂 USB 冲突。ADB、USB 网卡和串口保持启用,MTP 不会自动恢复。禁用失败只提示,不中断安装。无额外安装器确认步骤;Windows 可能请求管理权限。无线 ADB、macOS 和 E5 系列跳过处理。 + 只有无线 ADB 时,先将电脑连接到设备所在网络,展开设备选择区的“无线 ADB 连接”,填写 `192.168.0.1` 并点击“连接”。地址或端口不同请填写实际值,例如 `192.168.0.1:5555`。设备需已开启无线 ADB;Android 要求配对时,先按设备提示完成配对。 也可手动运行 `adb connect 192.168.0.1`。Windows 可在安装包目录打开 PowerShell,运行 `.\tools\adb.exe connect 192.168.0.1`。 @@ -136,6 +138,8 @@ Extract the complete package and run **OpenWrt-Installer.exe** at its root. Keep Back up important files, check that the package matches your model and keep the device powered. Enable USB debugging in Android, authorize this computer and have Magisk/root ready. +For MU300-series devices checked over wired ADB on Windows, the installer automatically disables only that device's MTP interface and displays a notification, avoiding the stock USB conflict. ADB, USB networking and serial interfaces stay enabled; MTP is not re-enabled. Failure only shows a warning and does not interrupt installation. There is no extra installer confirmation; Windows may request administrator permission. Wireless ADB, macOS and the E5 adapter skip this workaround. + For wireless ADB only, connect the computer to the device’s network, expand Wireless ADB connection, enter `192.168.0.1` and select Connect. Use the actual address and port if different, for example `192.168.0.1:5555`. Wireless ADB must already be enabled. If Android requires pairing, complete it on the device first. Alternatively, manually run `adb connect 192.168.0.1`. On Windows, open PowerShell in the package folder and run `.\tools\adb.exe connect 192.168.0.1`. diff --git a/installer/PROTOCOL.md b/installer/PROTOCOL.md index 4c64a206..2e4192e6 100644 --- a/installer/PROTOCOL.md +++ b/installer/PROTOCOL.md @@ -62,3 +62,5 @@ Unconfirmed schema 1 removal plans must be regenerated. Already armed schema 1 t Schema 3 extends schema 2 with `installation_evidence`: hashes of the installed boot header, ramdisk, ext4 superblock and exact fixed marker files. Evidence is rechecked before preparing device writes. The reset-choice fingerprint also includes it. E5 requires its internal-root boot route, `etc/e5/part-root` naming this disk and OpenWrt distribution identity. MU300 requires the native `part`/completed `install-part` ramdisk route, container boot selector, `openwrt/etc/mu300/desktop-mode=part` and OpenWrt identity. Prepared roots, unknown boot routes, symlinks, unclean/unsupported ext4 and mounted/mapped roots are rejected. The host reader supports bounded regular files/directories with direct blocks or initialized extents and checks partition/filesystem bounds; it never evaluates their content as code. On import/restart, before/after snapshots are recomputed from the saved **current** layout using the adjacent-root rule. Hash changes cannot authorize a wider target or alter unrelated entries. Once armed, resume uses the new uninstall record, not any original installation record or deleted root markers. Recovery from an interrupted inactive-boot write still requires exact saved GPT/misc/Android checks; when boot staging alone must be retried, the original Linux boot proof comes from its checksummed **new uninstall backup** while root evidence is checked live. Completed GPT work and formatting are never replayed. If this new record is lost while `openwrt.uninstall=1` is staged, the existing pending-operation guard still stops new plans; absence of an old installation record is not permission to guess an interrupted removal. + +`notice` events carry a fixed localized `code` (`mtp_disabled` or `mtp_disable_failed`) and optional device `label`. Only the MU300 adapter enables the Windows wired-ADB MTP workaround for a selected device; enumeration alone, wireless ADB, macOS and the E5 adapter are unchanged. Windows problem code 22 confirms successful disable. A failure only emits a warning and does not stop the original workflow. MTP is never automatically re-enabled. diff --git a/installer/SHARED-SOURCE.json b/installer/SHARED-SOURCE.json index beb73a6d..ed418392 100644 --- a/installer/SHARED-SOURCE.json +++ b/installer/SHARED-SOURCE.json @@ -5,23 +5,23 @@ ".gitignore": "a5773f83330fc9adddfd159fe0391bccffbf7663dccb2b873f6b2d1b2d2eca11", "backend_entry.py": "238a3534a790ce46ae396040623117299f78b9fc9fc89fe152bfdd5788f7b664", "build.py": "f84fd40d9db9b39a0f8a35cee32dafc08f7dc774e17d76b060f49df73b5c8a10", - "GUIDE.md": "5bc67ffa85be488f487b44ca2ba6bdb4c191a223254a49eed6298743dd6b6cd9", + "GUIDE.md": "4c2eff2ac412d3205d86f9a605f77aed348d3e4213644b6897c1692ab851a17d", "package_gui.py": "bcc61763c43b02c45cae27a7452516dd0d76c871a11ded98a04c4711becd1b62", "platform-tools.json": "d8fcf938e150bc314b5e6b2660c540976bb12ea6108fa75a8fb183115ebbd01e", - "PROTOCOL.md": "d4e5ba7b946023649769ea5de514df548c871ca082b54d9b2040ceecdad8ac4e", + "PROTOCOL.md": "59a1aa39860f52c2f712224d6d3856373e23e25cdc3984d6dea11a577ca14483", "README.md": "fb8ed271afbc38d7a569fb5b701e48c2659eb5a42be7808950ca725f65f2a5db", - "release.py": "852e75824bd64178943d9725790a2ad8739826bf8b5c1bba3413012ffeb44123", + "release.py": "f85a99a67802d4dee2b1cc782c9bdecb8e28240921d5c51f5230824179c35e10", "requirements-build.txt": "762ee573a22c790eb3c5ccba4616632373d947dc88eb91fc85f3c678ac7b2259", "sync.py": "978d022cc59ec653b64f58d1feec59b8a07dd37aa354324d99e78b5e6fe3522c", "VERIFICATION.md": "3764dac5f830b67ed3b6e480fd89296b0f07f42b19c073076cd959d59aa16761", - "backend/adapter.py": "a67470ebf8eee8c2b028c8c690ae032ae03a89a985f668d4613de5604e9fbaae", + "backend/adapter.py": "7483d83118b7c95035f11e69dc073132ed856aa3fb2ef6b90d460c5ee5dbe35e", "backend/diagnostics.py": "529a7e2ac8d173c51a27ed825586263e9c0808f003c7ab1b36ca27e647e663df", "backend/gpt.py": "4eca5ccf458ef86b9dfcea6388da61defe61af6389565cadf2fda6616e28b791", "backend/helpers.py": "ac5422e60bcdd0273baa5d5796d64aa5b1e0687a709afc5bdf9c8501a7154d36", "backend/package.py": "5c55e91f2c348ac957d7803810e6396edf3aae573da401ecf46e773ac75e70ee", - "backend/service.py": "318fd389eb11766e414d743bf66d607b0b1fcc1a3ed225375353479a62d01877", + "backend/service.py": "47b708150228f8463be3dfb318d6c60f68dc39b69894fc7407807dfb951b7a87", "backend/state.py": "bc17eac46b099524b2f2ad687d9fd6fcd3d867929487ef4a80d528992d6b3d48", - "backend/transport.py": "27b57661820ba74ef86336a93d08ab43c1ea49eafae1edafb12a324e30bb0d3c", + "backend/transport.py": "d438422b855a38d785b953c7d15e2814da3fbb6ea41e3983480089a07dff0d27", "backend/__init__.py": "4227d63763e764fd2de7fc2bc13e474ae5de33176fb57aa0fd51cbb4ad80b88c", "screenshots/author-sidebar-zh.png": "c1e4aefe0c6676e5c34228ed3633d375cc940ff6489eb414f1b5c0e41192c11f", "screenshots/automatic-restart-log-en.png": "e4642fe70b43556fae378e7b11f38b6ec4ebc97d36ce92692c3ef4f4aaf74716", @@ -62,7 +62,7 @@ "tests/ordering_smoke.py": "b96022ebdd80fe1d9f2e8b3e1c543aeb96534c0323bc4e36f619d80fc7e3b3f5", "tests/package_smoke.py": "f9ea830ae0e1801f52c8669b0b06033c6ee8c9a16745acc56c4b70b5f575ed26", "tests/refresh_smoke.py": "695014a20cc92705833d4459e5609c4ef121d05c12a6bb443361723b36e1d604", - "tests/run_ui.py": "ed66915523c22107da9d9790189c015d0ee8c4b679eed97681fd534a76f2e8ae", + "tests/run_ui.py": "92ea437c8342c3c4dfc5241e946889c3baa94625689b70ca1f5a4c07656ab992", "tests/support_smoke.py": "c0626f8a2490ffeeefe838cb852eb144742c935a68a3a4d000158220bba4190a", "tests/test_backup.py": "8b37a970334658b390e116549b913e22656be534675ea0ded38fd7395b85daa6", "tests/test_diagnostics.py": "7abc3c103cba42a0eb10b62f12edcca3f40efc3a959efb5dbc7cd5fe5f24e581", @@ -159,8 +159,8 @@ "verification/windows-packages.json": "2527a520a27d9eb0f9243aa9e2ed05b0e4b90caefc8257ea3afe76acdb75a19d", "ui/src/help-data.ts": "19fa8dd35fcef0ebc2726c16c641e5c357dfefe1342f9460c8da848339fb146b", "ui/src/help-i18n.ts": "041a7fa8ac2c3f0adfc3d2f25331801e907915ad58d08eaa464d4165f0a6e5f1", - "ui/src/i18n.ts": "61901828bde3ac669161049dd3aa3b85eb9e5d3a986f5b58489cee40f59cc515", - "ui/src/main.tsx": "7c8072749473464cdbf36b429e82fba1b810b56533d4e5cab5b3d06d64923192", + "ui/src/i18n.ts": "c4fb9704d766ed172729561d8e8aa2c9b8fabba9598e9a1faf47f045feb0619f", + "ui/src/main.tsx": "c9d670a83be5ea1277da61fae8417f0b2d54c2a513c732d48388cf1b79fe9257", "ui/src/protocol.ts": "de30687657a75e06498fdcfd03727c8a1c6b09eadbb5e189ad62d7db8865ef17", "ui/src/style.css": "9cc7a11d7d484842d6e2ec48b0ff24d16949305217585ff11620edcd5e6c0921", "ui/src/utils.ts": "dd51582c0905c3507bd5dc3d32215a43fc156f6432042a7deb393fe4258b05ba", @@ -257,7 +257,7 @@ "archive_tools.py": "b08836a0e94abc2b54a12c3d2e5bec0d42773a2d7edbba987670885cfd33466c", "tests/macos_frozen_smoke.py": "b3ebc5fb686ddf0fb133fbe77cbc52d4c6ae940488378daa6c92115dba2ed300", "tests/test_macos_integration.py": "9b42dd66e6a8ede7e1d404ea61ca17a959e6767749ce63c63596f8b982f78cc8", - "tests/test_release_archive.py": "bcf31454768873206e27a52221749dc58b5265c37857dae23c7625157faf4288", + "tests/test_release_archive.py": "fde4753d608f8162f75cd9acf3ad5061431f2ed6bf40a459fb5456aec2c78cfd", "tests/test_capacity_recovery.py": "ba5412707ba6727f485f02de2ed34d9cbc92a2841f45ea9ab2281b4587017450", "backend/uninstall.py": "4fde2d394bd1b9f1bf4c067546339c786493e6283c7f8220da4a231de3c83496", "backend/uninstall_boot.py": "0ceae95463f845856edcfffacb12b8845a9f3c848e0bd42b2af45a930ac2ee74", @@ -275,7 +275,10 @@ "backend/install_evidence.py": "27931749624bf6bcdc376e04b4bfbdadee73fc7c8e9013e1665ce16d30d56cd3", "tests/test_uninstall_evidence.py": "2727c5816b0e3e39cf3a85e4b276510735933fbfb97f0f0716c3606fa46189f8", "screenshots/uninstall-plan-device-zh.png": "1a34bd76f4b554ff7496d0745f3ee6ffa3785ce59769662254d046b5501c9807", - "screenshots/uninstall-plan-device-gap-en.png": "005eb55faacdaa4f4fcdc3d50de25f4358d482ea8efcd704cb08ef90915e92d9" + "screenshots/uninstall-plan-device-gap-en.png": "005eb55faacdaa4f4fcdc3d50de25f4358d482ea8efcd704cb08ef90915e92d9", + "backend/windows_mtp.py": "81cb440841774681b82c569a3dd64e69c98dfb36be6c73d47194e210b79fc964", + "tests/test_windows_mtp.py": "ec1d1eddf48a7a274beec6815eca666c31ca85a846a3d76c6c77cdf8c4d37776", + "tests/mtp_smoke.py": "fce3ededebe84a34a42a0ef6671b7f6502e2a5a4597243f191760e38e5c20e60" }, "compatibility_files": { "desktop/binary_io.py": "25e30cf4f3b23e960b05ae512f06d617dd958835125678ea4c07a2fbc4d3420f", diff --git a/installer/backend/adapter.py b/installer/backend/adapter.py index 0aa3c023..38309f24 100644 --- a/installer/backend/adapter.py +++ b/installer/backend/adapter.py @@ -220,6 +220,8 @@ class Adapter: def bind(self, serial): self.adb = Adb(self.root, serial) self.adb.context = self.ctx + self.adb.notice = getattr(self, 'notice', None) + self.adb.mtp_workaround = self.kind == 'mu300' if self.kind == 'e5': self.legacy.ADB = self.adb.exe self.legacy.SERIAL = serial diff --git a/installer/backend/service.py b/installer/backend/service.py index 5b057a47..ca848cdc 100644 --- a/installer/backend/service.py +++ b/installer/backend/service.py @@ -111,7 +111,14 @@ class Service: self.output.flush() def adapter(self, package=None, context=None): - return self.adapters(package or self.package, context) + adapter = self.adapters(package or self.package, context) + adapter.notice = lambda data:self.emit('notice', data) + return adapter + + def adb(self): + adb = Adb(self.package_root) + adb.notice = lambda data:self.emit('notice', data) + return adb def public(self, record): return Context(self.store, record, lambda *_: None).snapshot() @@ -178,7 +185,7 @@ class Service: record.get('stage') not in ('uninstall_offline','android_boot','android_setup','usb_debugging', 'debug_authorization','magisk','root_permission')): raise ValueError('Pause before changing ADB connections / 请先暂停任务,再更改 ADB 连接') - return Adb(self.package_root).connect(p.get('address')) + return self.adb().connect(p.get('address')) if command == 'adb_disconnect': if self.worker and self.worker.is_alive(): raise ValueError('Pause before disconnecting a device / 请先暂停任务,再断开设备') @@ -190,7 +197,7 @@ class Service: locks.enter_context(DeviceLock(self.store.base, serial)) except (OSError, RuntimeError): raise ValueError('Another installer is using this device; pause it first / 另一个安装器正在操作此设备,请先暂停其任务') from None - return Adb(self.package_root).disconnect(serial) + return self.adb().disconnect(serial) if self.worker and self.worker.is_alive() and command not in ('export',): raise ValueError('An operation is active / 任务正在执行') if command == 'package': @@ -198,7 +205,7 @@ class Service: self.package_root = self.package['path'] return self.package if command == 'devices': - return Adb(self.package_root).devices() + return self.adb().devices() if command == 'probe': if not self.package: raise ValueError('Verify a package first / 请先校验安装包') diff --git a/installer/backend/transport.py b/installer/backend/transport.py index ce16dae0..dffdba08 100644 --- a/installer/backend/transport.py +++ b/installer/backend/transport.py @@ -13,6 +13,7 @@ import time from .state import sha from .diagnostics import traced from .binary_io import pull_binary +from .windows_mtp import prepare_devices def hidden_process(): @@ -96,6 +97,9 @@ class Adb: result.append({'serial': values[0], 'state': values[1], 'wireless': wireless_serial(values[0]), 'label': next((v[6:] for v in values[2:] if v.startswith('model:')), values[0][-4:])}) + # Listing and wireless connection management stay read-only. + if getattr(self, 'mtp_workaround', False): + prepare_devices([d for d in result if d['serial'] == self.serial], getattr(self, 'notice', None)) return result def connect(self, address): diff --git a/installer/backend/windows_mtp.py b/installer/backend/windows_mtp.py new file mode 100644 index 00000000..8545850a --- /dev/null +++ b/installer/backend/windows_mtp.py @@ -0,0 +1,140 @@ +"""Windows-only workaround for the MU300 Android MTP/ADB gadget conflict. + +Only a present MTP interface below the selected USB serial is disabled. The +composite parent, ADB, network and serial interfaces are never disable targets. +No Android USB configuration is changed, and disabled MTP is not re-enabled. +""" +import base64 +import json +import os +import re +import subprocess +import sys +import threading +import time + +WPD = '{EEC5AD98-8080-425F-922A-DABF3DE3F69A}' +_lock = threading.Lock() +_inventory = (0, []) +_announced = set() +_failed = set() + +# Avoid localized friendly names and global VID/PID disable operations. +INVENTORY = r""" +$ErrorActionPreference='Stop' +[Console]::OutputEncoding=[Text.UTF8Encoding]::new($false) +$rows=@(Get-PnpDevice -PresentOnly | Where-Object {$_.InstanceId -like 'USB\VID_*'} | ForEach-Object { + $p=@{} + Get-PnpDeviceProperty -InstanceId $_.InstanceId -KeyName 'DEVPKEY_Device_Parent','DEVPKEY_Device_ClassGuid','DEVPKEY_Device_CompatibleIds','DEVPKEY_Device_ProblemCode' -ErrorAction SilentlyContinue | ForEach-Object {$p[$_.KeyName]=$_.Data} + @{id=$_.InstanceId;parent=$p['DEVPKEY_Device_Parent'];class_guid=[string]$p['DEVPKEY_Device_ClassGuid'];compatible=@($p['DEVPKEY_Device_CompatibleIds']);problem=$p['DEVPKEY_Device_ProblemCode']} +}) +ConvertTo-Json -InputObject $rows -Depth 4 -Compress +""" + + +def powershell(script, timeout=45): + executable = os.path.join(os.environ.get('SystemRoot', r'C:\Windows'), + 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe') + encoded = base64.b64encode(script.encode('utf-16le')).decode('ascii') + result = subprocess.run([executable, '-NoProfile', '-NonInteractive', '-EncodedCommand', encoded], + capture_output=True, timeout=timeout, + creationflags=getattr(subprocess, 'CREATE_NO_WINDOW', 0)) + if result.returncode: + raise RuntimeError('Windows MTP device operation failed') + return result.stdout.decode('utf-8-sig', 'replace').strip() + + +def matching_mtp(rows, serial): + """Select only WPD/MTP USB interfaces of one unambiguous composite parent.""" + roots = [r['id'] for r in rows if isinstance(r.get('id'), str) and + re.fullmatch(r'USB\\VID_[0-9A-F]{4}&PID_[0-9A-F]{4}\\[^\\]+', r['id'], re.I) and + r['id'].rsplit('\\', 1)[-1].casefold() == serial.casefold()] + if len(roots) != 1: + return [] + root = roots[0].casefold() + return [r for r in rows if isinstance(r.get('id'), str) and + re.fullmatch(r'USB\\VID_[0-9A-F]{4}&PID_[0-9A-F]{4}&MI_[0-9A-F]{2}\\[^\\]+', r['id'], re.I) and + str(r.get('parent', '')).casefold() == root and + (str(r.get('class_guid', '')).strip('{}').upper() == WPD.strip('{}') or + any('MS_COMP_MTP' in str(v).upper() for v in r.get('compatible', [])))] + + +def disable_script(serial, instance): + """Revalidate ancestry and class inside the elevated process, before writing.""" + values = base64.b64encode(json.dumps([serial, instance]).encode('utf-8')).decode('ascii') + # Both values are data in a base64 JSON literal, never PowerShell syntax. + child = r""" +$ErrorActionPreference='Stop' +try { + $v=ConvertFrom-Json ([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('__VALUES__'))) + $id=[string]$v[1]; $serial=[string]$v[0] + if ($id -notmatch '^USB\\VID_[0-9A-F]{4}&PID_[0-9A-F]{4}&MI_[0-9A-F]{2}\\[^\\]+$') {exit 10} + $node=Get-PnpDevice -PresentOnly -InstanceId $id -ErrorAction Stop + $p=@{}; Get-PnpDeviceProperty -InstanceId $id -KeyName 'DEVPKEY_Device_Parent','DEVPKEY_Device_ClassGuid','DEVPKEY_Device_CompatibleIds' | ForEach-Object {$p[$_.KeyName]=$_.Data} + $parent=[string]$p['DEVPKEY_Device_Parent'] + if ($parent -notmatch '^USB\\VID_[0-9A-F]{4}&PID_[0-9A-F]{4}\\[^\\]+$' -or ($parent -split '\\')[-1] -ine $serial) {exit 11} + if (([string]$p['DEVPKEY_Device_ClassGuid']).Trim('{}') -ine 'EEC5AD98-8080-425F-922A-DABF3DE3F69A' -and -not (@($p['DEVPKEY_Device_CompatibleIds']) -match 'MS_COMP_MTP')) {exit 12} + Disable-PnpDevice -InstanceId $node.InstanceId -Confirm:$false -ErrorAction Stop + exit 0 +} catch {exit 13} +""".replace('__VALUES__', values) + encoded = base64.b64encode(child.encode('utf-16le')).decode('ascii') + return r""" +$ErrorActionPreference='Stop' +$admin=([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) +if ($admin) { & "$PSHOME\powershell.exe" -NoProfile -NonInteractive -EncodedCommand '__CHILD__'; exit $LASTEXITCODE } +try { + $p=Start-Process -FilePath "$PSHOME\powershell.exe" -ArgumentList @('-NoProfile','-NonInteractive','-EncodedCommand','__CHILD__') -Verb RunAs -WindowStyle Hidden -Wait -PassThru + exit $p.ExitCode +} catch {exit 14} +""".replace('__CHILD__', encoded) + + +def prepare_devices(devices, notify=None): + """Called after adb devices -l, before the first Android shell/transfer. + + Network serials (including mDNS) and non-MU300 models are excluded. Failures + are surfaced as warnings, without claiming MTP was disabled or changing ADB. + """ + global _inventory + if sys.platform != 'win32': + return + targets = [d for d in devices if not d.get('wireless') and ':' not in d['serial'] and + not d['serial'].startswith('adb-') and + re.search(r'\b(?:MU300|F50|V50|MU3351|U30.?AIR)(?:$|[_ -])', d.get('label', '').replace('_', ' '), re.I)] + if not targets: + return + def announce(code, device): + if notify: + notify({'code': code, 'label': device.get('label', 'MU300')}) + else: + print(('MTP disabled for stable USB ADB / 已禁用 MTP 以稳定有线 ADB' if code == 'mtp_disabled' else + 'Could not disable MTP; run the installer as administrator / 未能禁用 MTP,请以管理员身份运行安装器'), flush=True) + with _lock: + try: + if time.monotonic() - _inventory[0] > 5: + _inventory = (time.monotonic(), json.loads(powershell(INVENTORY))) + for device in targets: + for node in matching_mtp(_inventory[1], device['serial']): + key = node['id'].casefold() + if node.get('problem') != 22: + if key in _failed: + continue + try: + powershell(disable_script(device['serial'], node['id']), timeout=120) + fresh = json.loads(powershell(INVENTORY)) + verified = next((r for r in matching_mtp(fresh, device['serial']) if r['id'].casefold() == key), None) + if not verified or verified.get('problem') != 22: + raise RuntimeError('MTP disable was not confirmed') + _inventory = (time.monotonic(), fresh) + except (OSError, ValueError, RuntimeError, subprocess.SubprocessError): + _failed.add(key) + announce('mtp_disable_failed', device) + continue + if key not in _announced: + _announced.add(key) + announce('mtp_disabled', device) + except (OSError, ValueError, RuntimeError, subprocess.SubprocessError): + if 'inventory' not in _failed: + _failed.add('inventory') + announce('mtp_disable_failed', targets[0]) diff --git a/installer/release.py b/installer/release.py index 89897f36..0364aa5f 100644 --- a/installer/release.py +++ b/installer/release.py @@ -25,6 +25,7 @@ def refresh(package): shutil.copy2(TOP/'installer/backend/binary_io.py',package/'desktop/binary_io.py') shutil.copy2(TOP/'installer/backend/boot_image.py',package/'desktop/boot_control.py') shutil.copy2(TOP/'installer/backend/mu300_update.py',package/'desktop/update_control.py') + shutil.copy2(TOP/'installer/backend/windows_mtp.py',package/'desktop/windows_mtp.py') attach(package) manifest_path=package/'desktop/manifest.json' manifest=json.loads(manifest_path.read_text()) diff --git a/installer/tests/mtp_smoke.py b/installer/tests/mtp_smoke.py new file mode 100644 index 00000000..84e91114 --- /dev/null +++ b/installer/tests/mtp_smoke.py @@ -0,0 +1,32 @@ +"""Localized informational/warning toasts; simulated events only.""" +from playwright.sync_api import sync_playwright +from ui_smoke import BRIDGE, fixture_context, settle + + +def main(): + bridge = BRIDGE.replace('window.__emitFixture=(change)=>{', ''' +window.__noticeFixture=(code)=>callbacks.get(window.__fixture.event)?.({event:'backend',id:1,payload:{type:'notice',data:{code,label:'V50'}}}); +window.__emitFixture=(change)=>{''') + with sync_playwright() as p: + browser = p.chromium.launch() + for lang, success, failure in [('zh','已禁用设备的 MTP 接口','未能禁用设备的 MTP 接口'), + ('en','Device MTP interface disabled','Could not disable the device MTP interface')]: + context = fixture_context(browser, viewport={'width':800,'height':650}) + context.add_init_script(bridge + "localStorage.setItem('language','"+lang+"');localStorage.setItem('onboarding-v1','seen');") + page = context.new_page() + page.goto('http://127.0.0.1:1420') + settle(page) + page.evaluate("window.__noticeFixture('mtp_disabled')") + page.get_by_text(success, exact=True).wait_for() + assert page.locator('[data-sonner-toast][data-type=info]').count() == 1 + page.evaluate("window.__noticeFixture('mtp_disable_failed')") + page.get_by_text(failure, exact=True).wait_for() + assert page.locator('[data-sonner-toast]').count() == 1 + assert page.locator('[data-sonner-toast][data-type=warning]').count() == 1 + context.close() + browser.close() + print('MTP toast: Chinese/English success/warning, one notification, no confirmation dialog') + + +if __name__ == '__main__': + main() diff --git a/installer/tests/run_ui.py b/installer/tests/run_ui.py index 5487c06e..b94cbd76 100644 --- a/installer/tests/run_ui.py +++ b/installer/tests/run_ui.py @@ -9,7 +9,7 @@ import time from urllib.request import urlopen ROOT=Path(__file__).resolve().parents[1] -CHECKS=('ui_smoke','help_smoke','refresh_smoke','method_smoke','ordering_smoke','diagnostics_smoke','update_smoke','support_smoke','wireless_smoke','uninstall_smoke') +CHECKS=('ui_smoke','help_smoke','refresh_smoke','method_smoke','ordering_smoke','diagnostics_smoke','update_smoke','support_smoke','wireless_smoke','uninstall_smoke','mtp_smoke') def main(): diff --git a/installer/tests/test_release_archive.py b/installer/tests/test_release_archive.py index 11e32106..3355bf29 100644 --- a/installer/tests/test_release_archive.py +++ b/installer/tests/test_release_archive.py @@ -35,7 +35,7 @@ class ReleaseArchiveTest(unittest.TestCase): for name in ('desktop/installer.py', 'desktop/boot_image.py', 'desktop/android-write-part.sh', 'desktop/android-write-free.sh', 'installer/backend/binary_io.py', 'installer/backend/boot_image.py', - 'installer/backend/mu300_update.py'): + 'installer/backend/mu300_update.py', 'installer/backend/windows_mtp.py'): path = top/name path.parent.mkdir(parents=True, exist_ok=True) path.write_text('source fixture') @@ -49,6 +49,7 @@ class ReleaseArchiveTest(unittest.TestCase): self.assertIn('openwrt-backend --cli --package-root "$PWD" --resume "$@"', launcher.read_text()) manifest = json.loads((package/'desktop/manifest.json').read_text()) self.assertEqual(manifest['desktop']['launchers/start-installer.sh'], release.digest(launcher)) + self.assertEqual(manifest['desktop']['desktop/windows_mtp.py'], release.digest(package/'desktop/windows_mtp.py')) def test_mac_executables_survive_windows_modes_and_share_one_payload(self): with tempfile.TemporaryDirectory() as folder: diff --git a/installer/tests/test_windows_mtp.py b/installer/tests/test_windows_mtp.py new file mode 100644 index 00000000..a04bde05 --- /dev/null +++ b/installer/tests/test_windows_mtp.py @@ -0,0 +1,153 @@ +"""Device-tree matching and privilege failures; never disable real hardware.""" +import base64 +import copy +import json +from pathlib import Path +import re +import subprocess +import sys +import unittest +from unittest.mock import Mock, patch + +sys.path.insert(0, str(Path(__file__).resolve().parents[1])) +from backend import windows_mtp as mtp +from backend.transport import Adb + +ROOT = r'USB\VID_19D2&PID_1405\MU123' +MTP = r'USB\VID_19D2&PID_1405&MI_00\7&123&0&0000' +ADB = r'USB\VID_19D2&PID_1405&MI_01\7&123&0&0001' + + +def tree(problem=0): + return [dict(id=ROOT, parent='USBROOT', class_guid='USB'), + dict(id=MTP, parent=ROOT, class_guid=mtp.WPD, problem=problem), + dict(id=ADB, parent=ROOT, class_guid='Android', problem=0), + dict(id=r'USB\VID_19D2&PID_1405&MI_02\7&123&0&0002', parent=ROOT, class_guid='Net'), + dict(id=r'USB\VID_19D2&PID_1405&MI_03\7&123&0&0003', parent=ROOT, class_guid='Ports'), + dict(id=r'USB\VID_1234&PID_1234\PHONE', parent='USBROOT'), + dict(id=r'USB\VID_1234&PID_1234&MI_00\OTHER', parent=r'USB\VID_1234&PID_1234\PHONE', class_guid=mtp.WPD)] + + +class WindowsMtpTest(unittest.TestCase): + def setUp(self): + mtp._inventory = (0, []) + mtp._announced.clear() + mtp._failed.clear() + self.device = dict(serial='MU123', label='V50', wireless=False) + + def test_only_mtp_sibling_of_exact_serial_is_selected(self): + self.assertEqual([n['id'] for n in mtp.matching_mtp(tree(), 'mu123')], [MTP]) + self.assertEqual(mtp.matching_mtp(tree(), 'MU'), []) + self.assertEqual(mtp.matching_mtp(tree(), 'OTHER'), []) + duplicate = tree() + [dict(id=r'USB\VID_1782&PID_1234\MU123')] + self.assertEqual(mtp.matching_mtp(duplicate, 'MU123'), []) + + def test_guid_braces_and_mtp_compatible_id_are_supported(self): + rows = tree() + rows[1]['class_guid'] = mtp.WPD.strip('{}').lower() + self.assertEqual(len(mtp.matching_mtp(rows, 'MU123')), 1) + rows[1].update(class_guid='Unknown', compatible=['USB\\MS_COMP_MTP']) + self.assertEqual(len(mtp.matching_mtp(rows, 'MU123')), 1) + rows[1]['compatible'] = ['USB\\Class_FF&SubClass_42&Prot_01'] + self.assertEqual(mtp.matching_mtp(rows, 'MU123'), []) + + def test_non_windows_wireless_and_other_models_never_touch_pnp(self): + for platform, device in [('darwin', self.device), ('linux', self.device), + ('win32', dict(self.device, wireless=True)), + ('win32', dict(self.device, serial='192.0.2.1:5555')), + ('win32', dict(self.device, serial='adb-MU123._adb-tls-connect._tcp')), + ('win32', dict(self.device, label='E5')), + ('win32', dict(self.device, label='Pixel_9'))]: + with self.subTest(platform=platform, device=device), patch.object(mtp.sys, 'platform', platform), patch.object(mtp, 'powershell') as run: + mtp.prepare_devices([device]) + run.assert_not_called() + + def test_disable_is_verified_and_toast_emitted_once(self): + notice = Mock() + with patch.object(mtp.sys, 'platform', 'win32'), patch.object(mtp, 'powershell', side_effect=[json.dumps(tree()), '', json.dumps(tree(22))]) as run: + mtp.prepare_devices([self.device], notice) + mtp.prepare_devices([self.device], notice) + self.assertEqual(run.call_count, 3) + notice.assert_called_once_with(dict(code='mtp_disabled', label='V50')) + self.assertNotIn('Enable-PnpDevice', run.call_args_list[1].args[0]) + + def test_already_disabled_does_not_request_privileges_or_enable(self): + with patch.object(mtp.sys, 'platform', 'win32'), patch.object(mtp, 'powershell', return_value=json.dumps(tree(22))) as run: + notice = Mock() + mtp.prepare_devices([self.device], notice) + self.assertEqual(run.call_count, 1) + notice.assert_called_once_with(dict(code='mtp_disabled', label='V50')) + + def test_adb_model_names_with_vendor_and_escaped_spaces(self): + for label in ('ZTE_F50', 'ZTE_MU300', 'ZTE_V50', 'ZTE_U30_Air', 'F50_SP', 'U30Air_HT'): + mtp._inventory=(0, []) + mtp._announced.clear() + with self.subTest(label=label), patch.object(mtp.sys, 'platform', 'win32'), patch.object(mtp, 'powershell', return_value=json.dumps(tree(22))) as run: + notice=Mock() + mtp.prepare_devices([dict(self.device, label=label)], notice) + self.assertEqual(run.call_count, 1) + notice.assert_called_once_with(dict(code='mtp_disabled', label=label)) + + def test_access_denied_reports_warning_and_does_not_retry_uac(self): + notice = Mock() + with patch.object(mtp.sys, 'platform', 'win32'), patch.object(mtp, 'powershell', side_effect=[json.dumps(tree()), RuntimeError('denied')]) as run: + mtp.prepare_devices([self.device], notice) + mtp.prepare_devices([self.device], notice) + self.assertEqual(run.call_count, 2) + notice.assert_called_once_with(dict(code='mtp_disable_failed', label='V50')) + + def test_unconfirmed_disable_cannot_be_reported_as_success(self): + notice = Mock() + with patch.object(mtp.sys, 'platform', 'win32'), patch.object(mtp, 'powershell', side_effect=[json.dumps(tree()), '', json.dumps(tree())]): + mtp.prepare_devices([self.device], notice) + self.assertEqual(notice.call_args.args[0]['code'], 'mtp_disable_failed') + + def test_privileged_script_contains_only_encoded_data_and_rechecks_target(self): + value = "MU123'; Stop-Computer; #" + script = mtp.disable_script(value, MTP) + self.assertNotIn(value, script) + encoded = re.search(r"-EncodedCommand '([A-Za-z0-9+/=]+)'", script)[1] + child = base64.b64decode(encoded).decode('utf-16le') + self.assertIn('DEVPKEY_Device_Parent', child) + self.assertIn('DEVPKEY_Device_ClassGuid', child) + self.assertIn('Disable-PnpDevice -InstanceId $node.InstanceId -Confirm:$false', child) + self.assertNotIn('Enable-PnpDevice', child) + data = re.search(r"FromBase64String\('([A-Za-z0-9+/=]+)'\)", child)[1] + self.assertEqual(json.loads(base64.b64decode(data)), [value, MTP]) + + def test_unbound_listing_and_selected_wireless_cannot_disable_another_usb_device(self): + adb = Adb.__new__(Adb) + adb.exe, adb.serial, adb.context = 'adb', None, None + adb.mtp_workaround = True + result = 'List of devices attached\nMU123 device model:V50\n192.0.2.1:5555 device model:V50\n' + with patch.object(adb, 'call', return_value=result), patch('backend.transport.prepare_devices') as prepare: + adb.devices() + self.assertEqual(prepare.call_args.args[0], []) + adb.serial = '192.0.2.1:5555' + adb.devices() + self.assertEqual([d['serial'] for d in prepare.call_args.args[0]], ['192.0.2.1:5555']) + self.assertTrue(prepare.call_args.args[0][0]['wireless']) + adb.serial = 'MU123' + adb.devices() + self.assertEqual([d['serial'] for d in prepare.call_args.args[0]], ['MU123']) + + def test_e5_transport_is_unchanged_even_with_a_mu300_serial(self): + adb = Adb.__new__(Adb) + adb.exe, adb.serial, adb.context = 'adb', 'MU123', None + with patch.object(adb, 'call', return_value='List of devices attached\nMU123 device model:V50\n'), patch('backend.transport.prepare_devices') as prepare: + adb.devices() + prepare.assert_not_called() + + def test_pnp_failure_preserves_adb_enumeration_and_further_commands(self): + adb = Adb.__new__(Adb) + adb.exe, adb.serial, adb.context = 'adb', 'MU123', None + adb.mtp_workaround, adb.notice = True, Mock() + listing = 'List of devices attached\nMU123 device model:V50\n' + with patch.object(adb, 'call', side_effect=[listing, '1']), patch.object(mtp.sys, 'platform', 'win32'), patch.object(mtp, 'powershell', side_effect=RuntimeError('denied')): + self.assertEqual(adb.devices()[0]['state'], 'device') + self.assertEqual(adb.shell('getprop sys.boot_completed'), '1') + adb.notice.assert_called_once_with(dict(code='mtp_disable_failed', label='V50')) + + +if __name__ == '__main__': + unittest.main() diff --git a/installer/ui/src/i18n.ts b/installer/ui/src/i18n.ts index 4ae4eb2d..ec997986 100644 --- a/installer/ui/src/i18n.ts +++ b/installer/ui/src/i18n.ts @@ -1,5 +1,7 @@ export const strings = { zh: { + mtpDisabled:'已禁用设备的 MTP 接口', mtpDisabledDesc:'已自动处理 MU300 原厂 USB 冲突,以稳定有线 ADB。ADB、USB 网卡和串口不受影响;不会自动重新启用 MTP。', + mtpDisableFailed:'未能禁用设备的 MTP 接口', mtpDisableFailedDesc:'Windows 未完成操作。有线 ADB 可能仍不稳定;安装流程将继续。', uninstallCancel:'取消卸载', uninstallResetQuestion:'无法保留 Android 数据卸载,是否格式化?', uninstallResetExplanation:'格式化会清空 Android 应用、账号、照片和内部存储。取消不会写入设备;选择格式化后会先展示新的卸载计划,不会立即执行。', uninstallChooseReset:'选择格式化并查看计划', uninstallPreserve:'删除内置 OpenWrt 及其设置,在离线环境检查并扩容未加密 userdata,保留 Android 数据。请仍备份重要文件;检查失败会停止,不会自动格式化。', @@ -65,6 +67,8 @@ export const strings = { noBackend:'安装器启动失败。请完整解压安装包,再运行 OpenWrt-Installer.exe。', error:'操作未完成', elapsed:'阶段用时', bytes:'已传输', speed:'速度', packageHint:'请完整解压安装包;载荷校验通过后才能操作设备。', }, en: { + mtpDisabled:'Device MTP interface disabled', mtpDisabledDesc:'Applied the MU300 USB workaround for stable wired ADB. ADB, USB networking and serial interfaces are unaffected. MTP will not be re-enabled automatically.', + mtpDisableFailed:'Could not disable the device MTP interface', mtpDisableFailedDesc:'Windows did not complete the operation. Wired ADB may still be unstable; installation will continue.', uninstallCancel:'Cancel removal', uninstallResetQuestion:'Cannot preserve Android data. Format instead?', uninstallResetExplanation:'Formatting erases Android apps, accounts, photos and internal storage. Cancel writes nothing to the device. Choosing format first opens a new removal plan; it does not execute it.', uninstallChooseReset:'Choose format and review plan', uninstallPreserve:'Remove internal OpenWrt and its settings, then check and grow unencrypted userdata offline while preserving Android data. Back up important files. Failed checks stop the operation; they never trigger automatic formatting.', diff --git a/installer/ui/src/main.tsx b/installer/ui/src/main.tsx index 01b1d2ea..3a842347 100644 --- a/installer/ui/src/main.tsx +++ b/installer/ui/src/main.tsx @@ -139,6 +139,16 @@ function App() { acceptTransaction(next); } else if (event.type === 'transfer') setTransfer(event.data as Transfer); else if (event.type === 'activity') setTransfer(undefined); + else if (event.type === 'notice') { + const notice = event.data as {code:string; label?:string}; + if (notice.code === 'mtp_disabled') { + toast.info(t.mtpDisabled, {id:'usb-mtp', description:t.mtpDisabledDesc, duration:10000}); + append(t.mtpDisabled); + } else if (notice.code === 'mtp_disable_failed') { + toast.warning(t.mtpDisableFailed, {id:'usb-mtp', description:t.mtpDisableFailedDesc, duration:12000}); + append(t.mtpDisableFailed); + } + } else if (event.type === 'log') { const entry = event.data as {message:string; level?:string; scope?:string}; append(`[${(entry.level || 'debug').toUpperCase()}]${entry.scope ? ' ['+entry.scope+']' : ''} ${entry.message}`); diff --git a/openwrt/build-rootfs.sh b/openwrt/build-rootfs.sh index c7bd2d2d..17d00348 100755 --- a/openwrt/build-rootfs.sh +++ b/openwrt/build-rootfs.sh @@ -234,7 +234,7 @@ if [ -d /in/luci-plugin ]; then chmod 0755 $R/etc/init.d/mu300-charge $R/etc/hotplug.d/power_supply/75-mu300-charge $R/usr/libexec/rpcd/mu300-charge ucode $R/usr/libexec/unisoc-modem/disable-channel-analysis $R ucode $R/usr/libexec/unisoc-modem/filter-wifi-ciphers $R - chmod 0755 $R/etc/init.d/unisoc-cpu + chmod 0755 $R/etc/init.d/unisoc-cpu $R/etc/init.d/unisoc-cpu-cores $R/usr/libexec/rpcd/unisoc-cpu-cores chmod 0600 $R/etc/config/unisoc_apn chmod 0755 $R/etc/init.d/unisoc-modem-ui $R/etc/init.d/unisoc-sms-forward $R/etc/init.d/unisoc-traffic $R/etc/hotplug.d/net/90-unisoc-usb-host $R/etc/hotplug.d/iface/90-unisoc-usb-host $R/usr/libexec/rpcd/mu300dash $R/usr/libexec/unisoc-modem/* mkdir -p $R/usr/lib/lua/luci/i18n @@ -304,6 +304,7 @@ if [ -d /in/luci-plugin ]; then ln -sf ../init.d/unisoc-traffic $R/etc/rc.d/S$n"unisoc-traffic" ln -sf ../init.d/unisoc-traffic $R/etc/rc.d/K01unisoc-traffic ln -sf ../init.d/unisoc-cpu $R/etc/rc.d/S99unisoc-cpu + ln -sf ../init.d/unisoc-cpu-cores $R/etc/rc.d/S99unisoc-cpu-cores ln -sf ../init.d/unisoc-cpu $R/etc/rc.d/K89unisoc-cpu ln -sf ../init.d/mu300-charge $R/etc/rc.d/S97mu300-charge ln -sf ../init.d/mu300-charge $R/etc/rc.d/K20mu300-charge diff --git a/openwrt/luci-app-mu300/Makefile b/openwrt/luci-app-mu300/Makefile index 3d462457..f1f1404a 100644 --- a/openwrt/luci-app-mu300/Makefile +++ b/openwrt/luci-app-mu300/Makefile @@ -29,6 +29,7 @@ define Package/luci-app-mu300/conffiles /etc/config/unisoc_apn /etc/config/mu300-charge /etc/unisoc-modem/cpu.json +/etc/unisoc-cpu-cores.json /etc/unisoc-modem/cpu-voltage.json endef @@ -39,6 +40,7 @@ define Package/luci-app-mu300/install $(INSTALL_DIR) $(1)/www $(CP) ./htdocs/. $(1)/www/ $(CP) ./root/. $(1)/ + chmod 0755 $(1)/etc/init.d/unisoc-cpu-cores $(1)/usr/libexec/rpcd/unisoc-cpu-cores $(1)/usr/libexec/unisoc-modem/cpu-cores chmod 0600 $(1)/etc/config/unisoc_apn chmod 0600 $(1)/etc/config/mu300-charge chmod 0755 $(1)/etc/init.d/mu300-charge $(1)/etc/hotplug.d/power_supply/75-mu300-charge $(1)/usr/libexec/rpcd/mu300-charge @@ -75,6 +77,7 @@ define Package/luci-app-mu300/postinst /etc/init.d/unisoc-traffic enable 2>/dev/null || true /etc/init.d/unisoc-traffic start 2>/dev/null || true /etc/init.d/unisoc-cpu enable 2>/dev/null || true + /etc/init.d/unisoc-cpu-cores enable 2>/dev/null || true } exit 0 endef @@ -90,6 +93,7 @@ define Package/luci-app-mu300/postrm /etc/init.d/unisoc-traffic stop 2>/dev/null || true /etc/init.d/unisoc-traffic disable 2>/dev/null || true /etc/init.d/unisoc-cpu disable 2>/dev/null || true + /etc/init.d/unisoc-cpu-cores disable 2>/dev/null || true rm -f /etc/unisoc-modem/usb-boot.conf fi rm -f /tmp/luci-indexcache /tmp/luci-modulecache/* 2>/dev/null diff --git a/openwrt/luci-app-mu300/htdocs/luci-static/resources/mu300/auto-mode.js b/openwrt/luci-app-mu300/htdocs/luci-static/resources/mu300/auto-mode.js new file mode 100644 index 00000000..35228814 --- /dev/null +++ b/openwrt/luci-app-mu300/htdocs/luci-static/resources/mu300/auto-mode.js @@ -0,0 +1,82 @@ +'use strict'; +'require baseclass'; +'require rpc'; +'require mu300.common as M'; + +// Change only this UCI option. Never run uci.apply() or restart services here; +// the lock page owns confirmation, selected-SIM checks and the existing job. +const get = rpc.declare({object:'uci',method:'get',params:['config','section'],expect:{values:{}},reject:true}); +const set = rpc.declare({object:'uci',method:'set',params:['config','section','values'],reject:true}); +const commit = rpc.declare({object:'uci',method:'commit',params:['config'],reject:true}); + +function node(tag,cls,text) { + const el=document.createElement(tag); + if(cls) el.className=cls; + if(text!=null) el.textContent=M.translate(text); + return el; +} +return baseclass.extend({ + attach: function(root,request) { + root.hidden=true; + root.className='mud-auto-mode'; + const style=node('style',null,` +.mud-auto-mode{margin-top:14px;max-width:520px;min-width:0} +.mud-auto-mode[hidden]{display:none!important} +.mud-auto-mode label{display:flex;flex-direction:column;gap:7px;margin:0;min-width:0;color:var(--text,#222);font-size:.82rem} +.mud-auto-mode .mud-auto-mode-row{display:flex;flex-wrap:wrap;align-items:end;gap:10px;margin:10px 0 7px} +.mud-auto-mode .mud-auto-mode-row label{flex:1;min-width:min(100%,210px)} +.mud-auto-mode select{box-sizing:border-box;width:100%;max-width:100%;min-height:38px;margin:0;padding:8px 10px;border:1px solid var(--hairline,#ddd);border-radius:8px;background:var(--surface,#fff);color:var(--text,#222)} +.mud-auto-mode .mud-auto-mode-row button{min-height:38px;margin:0;white-space:normal} +.mud-auto-mode .mud-auto-mode-error{color:var(--danger,#df596a);overflow-wrap:anywhere} +`); + const row=node('div','mud-auto-mode-row'), label=node('label'); + const title=node('span',null,'自动模式兼容性'), input=node('select'); + input.id='mud-auto-mode-select';input.disabled=true; + label.htmlFor=input.id;label.append(title,input); + const button=node('button','mud-btn','保存并应用');button.type='button';button.disabled=true; + row.append(label,button); + const note=node('div','mud-note','此项可能影响双卡延迟和自动选网偏好,例如联通 n78/n1 的驻留选择;实际效果取决于基带和网络,不保证驻留指定频段。延迟高、网络卡顿或驻留不理想时可尝试调整,应用后会重新连接网络。'); + const scope=node('div','mud-note','兼容性选项由两张 SIM 共用,本次应用到当前查看的 SIM;显式 4G/SA/NSA 模式不受影响。'); + const modes=node('div','mud-note','134:5G/4G/3G/2G 自动,可回落 2G;152:5G/4G/3G 自动,不使用 2G。编号表示制式组合,不代表固定的频段优先级。'); + const status=node('div','mud-note');status.setAttribute('role','status'); + root.append(style,row,modes,note,scope,status); + let loaded=false, busy=false, mode=null; + function update(current,applying) { + mode=current;busy=!!applying; + root.hidden=!current || (current.label!=='auto' && current.label!=='auto-nsa'); + input.disabled=button.disabled=!loaded || busy; + } + function reload() { + if(loaded) return Promise.resolve(); + status.textContent=M.translate('正在读取兼容性设置…'); + return get('unisoc_modem','main').then(values=>{ + const fallback=values.auto_work_mode_default==='152'?'152':'134'; + const labels={ + '134':M.translate('全制式自动(134,含 2G)'), + '152':M.translate('自动选网(152,不含 2G)') + }; + input.replaceChildren(); + [['default',M.translate('机型默认')+' · '+labels[fallback]],['134',labels['134']],['152',labels['152']]].forEach(([value,text])=>{ + const option=node('option',null,text);option.value=value;input.append(option); + }); + input.value=['134','152'].includes(values.auto_work_mode)?values.auto_work_mode:'default'; + loaded=true;status.textContent='';status.classList.remove('mud-auto-mode-error'); + update(mode,busy); + }).catch(()=>{ + status.textContent=M.translate('无法读取兼容性设置,请刷新页面后重试'); + status.classList.add('mud-auto-mode-error'); + }); + } + button.onclick=()=>{ + if(!loaded || busy) return; + const value=input.value; + if(!['default','134','152'].includes(value)) return; + // The selection is a draft until the lock page confirms the job. + request(button,()=>set('unisoc_modem','main',{auto_work_mode:value}) + .then(()=>commit('unisoc_modem')) + .catch(()=>{throw new Error(M.translate('保存兼容性设置失败,未执行网络模式应用'));})); + }; + reload(); + return {update,reload}; + } +}); diff --git a/openwrt/luci-app-mu300/htdocs/luci-static/resources/mu300/common.js b/openwrt/luci-app-mu300/htdocs/luci-static/resources/mu300/common.js index f84766ef..dfcb0ca3 100644 --- a/openwrt/luci-app-mu300/htdocs/luci-static/resources/mu300/common.js +++ b/openwrt/luci-app-mu300/htdocs/luci-static/resources/mu300/common.js @@ -113,6 +113,34 @@ var callUsbNetAdd = rpc.declare({ object: 'mu300dash', method: 'usb_net_add', pa * standalone package works in any OpenWrt buildroot without po2lmo or extra * language packages. Chinese remains the source/fallback language. */ var DASH_I18N = { + "自动模式兼容性": ["Automatic mode compatibility", "Otomatik mod uyumluluğu"], + "机型默认": ["Model default", "Model varsayılanı"], + "全制式自动(134,含 2G)": ["All-RAT auto (134, includes 2G)", "Tüm teknolojiler otomatik (134, 2G dahil)"], + "自动选网(152,不含 2G)": ["Auto selection (152, excludes 2G)", "Otomatik seçim (152, 2G hariç)"], + "134:5G/4G/3G/2G 自动,可回落 2G;152:5G/4G/3G 自动,不使用 2G。编号表示制式组合,不代表固定的频段优先级。": ["134: automatic 5G/4G/3G/2G, with 2G fallback. 152: automatic 5G/4G/3G, without 2G. The numbers identify radio technology combinations, not fixed frequency-band priorities.", "134: 2G'ye geri dönüş dahil otomatik 5G/4G/3G/2G. 152: 2G olmadan otomatik 5G/4G/3G. Numaralar sabit frekans bandı önceliklerini değil, radyo teknolojisi birleşimlerini belirtir."], + "保存并应用": ["Save and apply", "Kaydet ve uygula"], + "此项可能影响双卡延迟和自动选网偏好,例如联通 n78/n1 的驻留选择;实际效果取决于基带和网络,不保证驻留指定频段。延迟高、网络卡顿或驻留不理想时可尝试调整,应用后会重新连接网络。": ["This option may affect dual-SIM latency and automatic network selection preferences, such as camping on China Unicom n78 or n1. Results depend on modem firmware and the network; a specific band is not guaranteed. Try adjusting it for high latency, stalls or an undesired serving band. Applying it reconnects the cellular network.", "Bu seçenek çift SIM gecikmesini ve otomatik şebeke seçimi tercihlerini, örneğin China Unicom n78 veya n1 bandına bağlanmayı etkileyebilir. Sonuç modem yazılımına ve şebekeye bağlıdır; belirli bir bant garanti edilmez. Yüksek gecikme, takılma veya istenmeyen bant seçimi durumunda değiştirmeyi deneyin. Uygulama hücresel ağı yeniden bağlar."], + "兼容性选项由两张 SIM 共用,本次应用到当前查看的 SIM;显式 4G/SA/NSA 模式不受影响。": ["Both SIMs share this compatibility option; this operation applies to the SIM being viewed. Explicit 4G/SA/NSA modes are unaffected.", "Bu uyumluluk seçeneği iki SIM için ortaktır; işlem görüntülenen SIM için uygulanır. Açıkça seçilen 4G/SA/NSA modları etkilenmez."], + "正在读取兼容性设置…": ["Reading compatibility settings…", "Uyumluluk ayarları okunuyor…"], + "无法读取兼容性设置,请刷新页面后重试": ["Unable to read compatibility settings; reload the page and try again", "Uyumluluk ayarları okunamadı; sayfayı yenileyip tekrar deneyin"], + "保存兼容性设置失败,未执行网络模式应用": ["Could not save compatibility settings; the network mode was not applied", "Uyumluluk ayarları kaydedilemedi; şebeke modu uygulanmadı"], + '恢复核心初始状态': ['Restore initial core states', 'İlk çekirdek durumlarını geri yükle'], + 'CPU0 保持在线': ['CPU0 stays online', 'CPU0 açık kalır'], + "CPU 核心开关": ["CPU core controls", "CPU çekirdek denetimleri"], + "按内核能力逐核开启或关闭。CPU0 保持在线;关闭核心会降低并行处理能力,是否省电取决于实际负载。": ["Enable or disable individual cores supported by the kernel. CPU0 stays online. Disabling cores reduces parallel capacity; power savings depend on the workload.", "Çekirdek desteğine göre CPU çekirdeklerini açın veya kapatın. CPU0 açık kalır. Çekirdek kapatmak paralel kapasiteyi azaltır; enerji tasarrufu yüke bağlıdır."], + "仅保存核心开关;不改变调频、调压和温控配置。": ["Save core states only; frequency, voltage and thermal settings are unchanged.", "Yalnızca çekirdek durumlarını kaydeder; frekans, voltaj ve sıcaklık ayarları değişmez."], + "应用核心设置": ["Apply core settings", "Çekirdek ayarlarını uygula"], + "正在读取核心状态…": ["Reading core states…", "Çekirdek durumları okunuyor…"], + "核心设置已应用;调频与温控页面将在下次打开时刷新。": ["Core settings applied. Reopen CPU settings to refresh frequency and thermal controls.", "Çekirdek ayarları uygulandı. Frekans ve sıcaklık kontrollerini yenilemek için CPU ayarlarını yeniden açın."], + "此核心由内核管理,不能关闭": ["This core is managed by the kernel and cannot be disabled", "Bu çekirdek sistem tarafından yönetiliyor ve kapatılamaz"], + "CPU 核心配置无效": ["Invalid CPU core settings", "Geçersiz CPU çekirdek ayarları"], + "CPU 核心列表已变化,请重新载入": ["The CPU core list changed; reload the page", "CPU çekirdek listesi değişti; sayfayı yenileyin"], + "无法保存核心设置": ["Unable to save core settings", "Çekirdek ayarları kaydedilemedi"], + "内核未接受核心开关设置": ["The kernel rejected the core state change", "Sistem çekirdek durumu değişikliğini reddetti"], + "核心设置正忙,请稍后重试": ["Core settings are busy; try again shortly", "Çekirdek ayarları meşgul; biraz sonra yeniden deneyin"], + "无法读取 CPU 核心状态": ["Unable to read CPU core states", "CPU çekirdek durumları okunamadı"], + "回滚未完成,请检查实际核心状态": ["Rollback was incomplete; check the actual core states", "Geri alma tamamlanamadı; gerçek çekirdek durumlarını kontrol edin"], + "离线": ["Offline", "Çevrimdışı"], 'V50 物理卡选择': ['V50 physical SIM selection', 'V50 fiziksel SIM seçimi'], '2内置卡': ['2 built-in SIMs', '2 dahili SIM'], '2内置卡 + 1插拔卡': ['2 built-in SIMs + 1 removable SIM', '2 dahili SIM + 1 çıkarılabilir SIM'], diff --git a/openwrt/luci-app-mu300/htdocs/luci-static/resources/mu300/cpu-cores.js b/openwrt/luci-app-mu300/htdocs/luci-static/resources/mu300/cpu-cores.js new file mode 100644 index 00000000..cef377de --- /dev/null +++ b/openwrt/luci-app-mu300/htdocs/luci-static/resources/mu300/cpu-cores.js @@ -0,0 +1,108 @@ +'use strict'; +'require baseclass'; +'require rpc'; +'require poll'; +'require mu300.common as M'; + +const get = rpc.declare({object:'unisoc-cpu-cores', method:'get', expect:{}}); +const apply = rpc.declare({object:'unisoc-cpu-cores', method:'apply', params:['cores','persist','reset'], expect:{}}); +const errors = { + cpu_cores_invalid:'CPU 核心配置无效', cpu_cores_topology:'CPU 核心列表已变化,请重新载入', + cpu_cores_fixed:'此核心由内核管理,不能关闭', cpu_cores_save:'无法保存核心设置', + cpu_cores_write:'内核未接受核心开关设置', cpu_cores_busy:'核心设置正忙,请稍后重试' +}; +function node(tag, cls, text) { + const el=document.createElement(tag); + if (cls) el.className=cls; + if (text != null) el.textContent=M.translate(text); + return el; +} +function message(error) { return M.translate(errors[error] || '无法读取 CPU 核心状态'); } + +return baseclass.extend({ + render: function() { + const card=node('section','mud-card mud-cpu-section mud-cpu-cores'); + card.dataset.scope='cores'; + card.append(node('style',null,` +.mud-cpu-cores .mud-core-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:12px} +.mud-cpu-cores .mud-core{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px;border:1px solid var(--hairline,#ddd);border-radius:10px;background:var(--surface-sunken,var(--surface,#fff));color:var(--text,#222);cursor:pointer;margin:0} +.mud-cpu-cores .mud-core-copy{display:flex;flex-direction:column;gap:5px;font-size:.85rem} +.mud-cpu-cores .mud-core-copy small{font-size:.7rem;color:var(--text-muted,#777)} +.mud-cpu-cores input[type=checkbox]{width:17px;height:17px;min-height:0;flex-shrink:0;margin:0;accent-color:var(--brand,#2f7bf6)} +.mud-cpu-cores .mud-core:has(input:disabled){cursor:default} +.mud-cpu-cores .mud-core-error{color:var(--danger,#df596a)} +.mud-cpu-cores .mud-core-status{margin-top:14px;font-size:.75rem;line-height:1.65;overflow-wrap:anywhere} +`)); + const heading=node('div','mud-cpu-heading'); + heading.append(node('h3',null,'CPU 核心开关'),node('span','mud-cpu-badge','即时生效')); + const note=node('p','cpu-note','按内核能力逐核开启或关闭。CPU0 保持在线;关闭核心会降低并行处理能力,是否省电取决于实际负载。'); + const grid=node('div','mud-core-grid'), footer=node('div','mud-cpu-actions'); + const persist=node('input');persist.type='checkbox';persist.dataset.corePersist=''; + const label=node('label','mud-cpu-persist'); + const copy=node('span');copy.append(node('span',null,'开机自动应用'),node('small','mud-note','仅保存核心开关;不改变调频、调压和温控配置。')); + label.append(persist,copy); + const save=node('button','mud-btn on','应用核心设置'), reset=node('button','mud-btn','恢复核心初始状态'); + save.type=reset.type='button';save.disabled=reset.disabled=true; + footer.append(label,save,reset); + const status=node('div','mud-core-status','正在读取核心状态…');status.setAttribute('role','status'); + card.append(heading,note,grid,footer,status); + let current=null, inputs=[], busy=false, dirty=false, attached=false; + function report(text,error) {status.textContent=text;status.classList.toggle('mud-core-error',!!error);} + function paint(state) { + current=state;grid.replaceChildren();inputs=[]; + for(const c of state.cores || []) { + const row=node('label','mud-core'), text=node('span','mud-core-copy'); + const title=node('strong',null,'CPU '+c.id), live=node('small',null,c.online?'在线':'离线');live.dataset.coreLive=String(c.id); + text.append(title,live); + const input=node('input');input.type='checkbox';input.checked=c.online;input.disabled=!c.writable;input.dataset.core=String(c.id); + input.setAttribute('aria-label','CPU '+c.id);input.title=c.writable?'':M.translate(c.id===0?'CPU0 保持在线':'此核心由内核管理,不能关闭'); + input.onchange=()=>{dirty=true;}; + row.append(text,input);grid.append(row);inputs.push({c,input}); + } + persist.checked=!!state.persistent;dirty=false; + save.disabled=reset.disabled=!(state.cores || []).some(c=>c.writable); + report(state.boot_error?message(state.boot_error):'',!!state.boot_error); + } + persist.onchange=()=>{dirty=true;}; + async function submit(isReset) { + if(busy || !current) return; + busy=true;card.querySelectorAll('button,input').forEach(e=>e.disabled=true); + try { + const result=await apply(inputs.map(({c,input})=>({id:c.id,online:input.checked})),isReset?false:persist.checked,isReset); + if(!result.ok) { + let text=message(result.error); + if(result.rollback===false) text+=' · '+M.translate('回滚未完成,请检查实际核心状态'); + throw new Error(text); + } + paint(result); + report(M.translate('核心设置已应用;调频与温控页面将在下次打开时刷新。')); + } catch(e) { report(e.message,true); } + finally { + busy=false;persist.disabled=false; + inputs.forEach(({c,input})=>input.disabled=!c.writable); + save.disabled=reset.disabled=!inputs.some(({c})=>c.writable); + } + } + save.onclick=()=>submit(false);reset.onclick=()=>submit(true); + get().then(s=>{if(!s.ok) throw new Error(message(s.error));paint(s);}).catch(e=>report(e.message,true)); + // Reuse LuCI polling only while this page is visible; never overwrite edits. + function refresh() { + if(!card.isConnected) { + if(attached && poll.remove) poll.remove(refresh); + return Promise.resolve(); + } + attached=true; + if(document.hidden || busy) return Promise.resolve(); + return get().then(s=>{ + if(!s.ok) throw new Error(message(s.error)); + if(!dirty) paint(s); + else (s.cores || []).forEach(c=>{ + const el=grid.querySelector('[data-core-live="'+c.id+'"]'); + if(el) el.textContent=M.translate(c.online?'在线':'离线'); + }); + }).catch(e=>report(e.message,true)); + } + poll.add(refresh,2); + return card; + } +}); diff --git a/openwrt/luci-app-mu300/htdocs/luci-static/resources/view/mu300/cpu.js b/openwrt/luci-app-mu300/htdocs/luci-static/resources/view/mu300/cpu.js index 844cb6e7..5d000f13 100644 --- a/openwrt/luci-app-mu300/htdocs/luci-static/resources/view/mu300/cpu.js +++ b/openwrt/luci-app-mu300/htdocs/luci-static/resources/view/mu300/cpu.js @@ -3,6 +3,7 @@ 'require rpc'; 'require poll'; 'require mu300.common as M'; +'require mu300.cpu-cores as Cores'; var get = rpc.declare({ object: 'mu300dash', method: 'cpu_get', expect: { '': {} } }); var apply = rpc.declare({ object: 'mu300dash', method: 'cpu_apply', params: ['payload'], expect: { '': {} } }); @@ -103,7 +104,7 @@ return view.extend({ root.appendChild(node('style', CSS)); var title = node('div', null, 'mud-cpu-title'); title.append(node('h2', M.translate('CPU 设置')), node('p', M.translate('频率、电压、温控分别保存。频率和温控即时生效,电压重启后生效。'), 'mud-note')); - root.append(title); + root.append(title,Cores.render()); var frequency = node('section', null, 'mud-card mud-cpu-section'); frequency.append(heading('频率与调速策略', '即时生效')); var grid = node('div', null, 'mud-cpu-grid'); frequency.append(grid); root.append(frequency); diff --git a/openwrt/luci-app-mu300/htdocs/luci-static/resources/view/mu300/locks.js b/openwrt/luci-app-mu300/htdocs/luci-static/resources/view/mu300/locks.js index 2db2a7c3..3fcce9c5 100644 --- a/openwrt/luci-app-mu300/htdocs/luci-static/resources/view/mu300/locks.js +++ b/openwrt/luci-app-mu300/htdocs/luci-static/resources/view/mu300/locks.js @@ -2,6 +2,7 @@ 'require view'; 'require mu300.refresh as R'; 'require mu300.common as M'; +'require mu300.auto-mode as AutoMode'; /* 网络锁定 -- 模式 / 频段 / 小区 / EN-DC,全部经 ubus mu300dash lock_set -> 后端 * mu300-dash-lock(编码按 ufi_tools 权威实现),应用后 SFUN 重启协议栈并落盘, @@ -45,6 +46,7 @@ return view.extend({