Fix: The monitor's screen size is incorrect.#623
Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom Mar 25, 2026
Merged
Fix: The monitor's screen size is incorrect.#623deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
Conversation
Reviewer's GuideAdjusts EDID parsing to handle little/big endian detailed timing bytes correctly, removes a redundant secondary size-calculation path, tightens EDID header validation messages, and makes EDID parsing failure abort parsing for that EDID entry with proper logging. Sequence diagram for EDID parsing with header validation and abort-on-failuresequenceDiagram
actor Caller
participant CommonTools
participant EDIDParser
Caller->>CommonTools: parseEDID(allEDIDS, input, isHW)
loop for each edidStr in allEDIDS
CommonTools->>EDIDParser: EDIDParser edidParser
CommonTools->>EDIDParser: setEdid(edidStr, errorMsg, ch, littleEndianMode)
alt invalid EDID header
EDIDParser-->>CommonTools: return false
CommonTools->>CommonTools: qCritical() << errorMsg
CommonTools->>CommonTools: continue to next edidStr
else valid EDID
EDIDParser-->>CommonTools: return true
CommonTools->>EDIDParser: vendor()
CommonTools->>EDIDParser: serialNumber()
CommonTools->>EDIDParser: monitorName()
CommonTools->>EDIDParser: screenSize()
CommonTools->>CommonTools: mapInfo.insert(...)
end
end
CommonTools-->>Caller: parsed EDID info map
Updated class diagram for EDIDParser and CommonTools EDID parsingclassDiagram
class EDIDParser {
- bool m_LittleEndianMode
- int m_Width
- int m_Height
- QString m_ScreenSize
+ EDIDParser()
+ bool setEdid(QString edid, QString errorMsg, QString ch, bool littleEndianMode)
+ void parseScreenSize()
+ QString vendor()
+ QString serialNumber()
+ QString monitorName()
+ QString screenSize()
}
class CommonTools {
+ static void parseEDID(QStringList allEDIDS, QString input, bool isHW)
}
CommonTools ..> EDIDParser : uses
note for EDIDParser "parseScreenSize now interprets detailed timing bytes differently for littleEndianMode and big endian mode and no longer recalculates screen size via an alternative path"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Note
详情{
"deepin-devicemanager/src/Tool/commontools.cpp": [
{
"line": " return \"https://driver.uniontech.com/api/v1/drive/search\";",
"line_number": 177,
"rule": "S35",
"reason": "Url link | 162cef9d4a"
},
{
"line": " return \"https://driver.uniontech.com/api/v1/drive/search\";",
"line_number": 182,
"rule": "S35",
"reason": "Url link | 162cef9d4a"
},
{
"line": " return \"https://drive-pre.uniontech.com/api/v1/drive/search\";",
"line_number": 185,
"rule": "S35",
"reason": "Url link | 0e010283c1"
}
]
} |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
parseScreenSize, there are still several hard-coded byte indices and magic numbers (e.g.,getBytes(4,2/3/4/5),15H/16H), which would be easier to maintain and reason about if they were wrapped in named constants or small helper functions describing the EDID field semantics. - The error messages added to
setEdidand theqCritical()log inparseEDIDare plain English literals; if these can surface to users, consider routing them through the existing translation mechanism (e.g.,QObject::tr) and/or logging category (qCWarning/qCCritical(appLog)) for consistency with the rest of the file.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `parseScreenSize`, there are still several hard-coded byte indices and magic numbers (e.g., `getBytes(4,2/3/4/5)`, `15H/16H`), which would be easier to maintain and reason about if they were wrapped in named constants or small helper functions describing the EDID field semantics.
- The error messages added to `setEdid` and the `qCritical()` log in `parseEDID` are plain English literals; if these can surface to users, consider routing them through the existing translation mechanism (e.g., `QObject::tr`) and/or logging category (`qCWarning/qCCritical(appLog)`) for consistency with the rest of the file.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
49b25d9 to
a362d30
Compare
|
Note
详情{
"deepin-devicemanager/src/Tool/commontools.cpp": [
{
"line": " return \"https://driver.uniontech.com/api/v1/drive/search\";",
"line_number": 177,
"rule": "S35",
"reason": "Url link | 162cef9d4a"
},
{
"line": " return \"https://driver.uniontech.com/api/v1/drive/search\";",
"line_number": 182,
"rule": "S35",
"reason": "Url link | 162cef9d4a"
},
{
"line": " return \"https://drive-pre.uniontech.com/api/v1/drive/search\";",
"line_number": 185,
"rule": "S35",
"reason": "Url link | 0e010283c1"
}
]
} |
a362d30 to
d601b68
Compare
|
Note
详情{
"deepin-devicemanager/src/Tool/commontools.cpp": [
{
"line": " return \"https://driver.uniontech.com/api/v1/drive/search\";",
"line_number": 177,
"rule": "S35",
"reason": "Url link | 162cef9d4a"
},
{
"line": " return \"https://driver.uniontech.com/api/v1/drive/search\";",
"line_number": 182,
"rule": "S35",
"reason": "Url link | 162cef9d4a"
},
{
"line": " return \"https://drive-pre.uniontech.com/api/v1/drive/search\";",
"line_number": 185,
"rule": "S35",
"reason": "Url link | 0e010283c1"
}
]
} |
-- For some monitors, detailed size information is not recorded in the EDID file; in such cases, obtaining the basic size information is sufficient. -- Therefore, remove the logic that retrieves the detailed size information again. Log: fix issue Bug: https://pms.uniontech.com/bug-view-354275.html
d601b68 to
35558e5
Compare
|
Note
详情{
"deepin-devicemanager/src/Tool/commontools.cpp": [
{
"line": " return \"https://driver.uniontech.com/api/v1/drive/search\";",
"line_number": 177,
"rule": "S35",
"reason": "Url link | 162cef9d4a"
},
{
"line": " return \"https://driver.uniontech.com/api/v1/drive/search\";",
"line_number": 182,
"rule": "S35",
"reason": "Url link | 162cef9d4a"
},
{
"line": " return \"https://drive-pre.uniontech.com/api/v1/drive/search\";",
"line_number": 185,
"rule": "S35",
"reason": "Url link | 0e010283c1"
}
]
} |
lzwind
approved these changes
Mar 25, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: GongHeng2017, lzwind 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 |
Contributor
Author
|
/forcemerge |
Contributor
|
This pr force merged! (status: unstable) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
-- For some monitors, detailed size information is not recorded in the EDID file;
in such cases, obtaining the basic size information is sufficient.
-- Therefore, remove the logic that retrieves the detailed size information again.
Log: fix issue
Bug: https://pms.uniontech.com/bug-view-354275.html
Summary by Sourcery
Correct EDID-based screen size parsing and improve handling of invalid EDID data.
Bug Fixes:
Enhancements: