Repository navigation
feat: support displaying LVDS monitor info without EDID - #963
Conversation
LVDS displays don't provide EDID data, causing device manager to fail to recognize them. Add getMonitorWithoutEdidFromXrandr() to parse xrandr --verbose output for connected displays without EDID, and setInfoFromLvds() to populate monitor info from xrandr data. Task: https://pms.uniontech.com/task-view-397927.html Story: https://pms.uniontech.com/story-view-42241.html
Reviewer's GuideThe PR adds xrandr-based fallback monitor discovery for connected displays without EDID, populates usable monitor metadata from parsed connector and mode information, prevents duplicates with hwinfo-discovered devices, and improves overview handling for missing screen-size data. Sequence diagram for xrandr fallback monitor discoverysequenceDiagram
participant Generator as DeviceGenerator
participant Xrandr as xrandr
participant Manager as DeviceManager
participant Monitor as DeviceMonitor
Generator->>Xrandr: start(--verbose)
Xrandr-->>Generator: output
Generator->>Generator: exitCode()
loop each connector
Generator->>Generator: parse connected connector and modes
alt connected without EDID
Generator->>Manager: convertDeviceListAddr(DT_Monitor)
alt connector not already present
Generator->>Monitor: setInfoFromXrandrWithoutEdid(connectorName, interfaceType, isPrimary, currentResolution, currentRate, supportResolutions)
Generator->>Manager: addMonitor(Monitor)
else existing displayInput
Generator->>Generator: skip duplicate monitor
end
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ❌评价: 存在逻辑缺陷 ❌ 不通过 潜在问题: 建议: ['检查 waitForFinished() 返回值,超时时 kill 进程并提前返回,参考 commontools.cpp 中的实现。', '将 v: 行匹配条件改为 line.trimmed().startsWith("v:") 以增强健壮性。'] 2. 代码质量 ❌评价: 结构需要优化 ❌ 不通过 潜在问题: 建议: ['将 getMonitorWithoutEdidFromXrandr() 拆分为更小的子函数,如解析连接器行、解析分辨率行、创建显示器等。', '使用 QRegularExpression 替换 QRegExp,使用 Qt::SkipEmptyParts 替换 QString::SkipEmptyParts。', '统一分辨率显示格式,与现有代码保持一致。'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['考虑在后台线程执行 xrandr 命令,或使用异步方式(QProcess::readyReadStandardOutput 信号)处理输出。'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 修复 waitForFinished 返回值未检查的问题 (DeviceGenerator.cpp)
QProcess process;
process.start("xrandr", QStringList() << "--verbose");
if (!process.waitForFinished(5000)) {
qCWarning(appLog) << "xrandr --verbose timed out";
process.kill();
process.waitForFinished();
return;
}
if (process.exitCode() != 0) {
qCWarning(appLog) << "xrandr --verbose failed with exit code:" << process.exitCode();
return;
}
// 修复 v: 行解析条件
// 替换: if (line.startsWith(" ") && line.contains("v:") && line.contains("clock"))
// 为: if (line.startsWith(" ") && line.trimmed().startsWith("v:") && line.contains("clock"))
// 修复已废弃 API
// 替换 QRegExp 为 QRegularExpression:
// QRegularExpression reEdid("^[\\t]{2}([0-9a-f]{32}).*");
// QRegularExpression reRes("^\\s+(\\d+x\\d+\\w*)");
// QRegularExpression reRate("clock\\s+(\\d+\\.\\d+)Hz");
// 替换 QString::SkipEmptyParts 为 Qt::SkipEmptyParts本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: GongHeng2017, max-lvs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
LVDS displays don't provide EDID data, causing device manager to fail to recognize them. Add getMonitorWithoutEdidFromXrandr() to parse xrandr --verbose output for connected displays without EDID, and setInfoFromLvds() to populate monitor info from xrandr data.
Task: https://pms.uniontech.com/task-view-397927.html
Story: https://pms.uniontech.com/story-view-42241.html
Squashed from PR #962 (3 commits) with review fixes applied:
Summary by Sourcery
Support identifying connected displays without EDID data so they are included in device manager monitor information.
New Features:
Bug Fixes:
Enhancements: