#!/opt/lnxall_app/bin/lua local invoker = require "invoker" local hal = require "lnxhal" local module = {} local HDMI_ENABLED = "/sys/class/drm/card0-HDMI-A-1/enabled" function module.checkplat() local cpuinfo = hal.cpuinfo_get() if type(cpuinfo) ~= "table" then return false end return cpuinfo.arch == hal.ARCH_AARCH64 and cpuinfo.model ~= hal.CPU_MA35D1 end function module.category() return "显示相关" end function module.description() return "外置屏检测" end function module.detailed() return "检查外置 HDMI 是否已经连接, 并输出 xinput 设备列表用于确认外置触屏线连接状态." end function module.suggestion() return "请检查 HDMI 信号线、触屏线 以及 电源" end function module.step() local enabled = invoker.readfile(HDMI_ENABLED, invoker.TRIMEND) local connected = enabled == "enabled" local _, xinput = invoker.invoke(invoker.OUTPUT + invoker.TRIMEND, "xinput") if type(xinput) ~= "string" or #xinput == 0 then xinput = "未获取到 xinput 输出" end return { action = "check_ext_display", checks = { { name = "hdmi", success = connected, result = connected and "外置 HDMI 已连接" or "外置 HDMI 未连接", }, { name = "touchscreen", success = true, result = table.concat({ xinput, "请确认触屏线是否接好", }, "\n"), }, }, }, not connected end return module