fix: Improve input device Bus interface detection#523
Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom Aug 27, 2025
Merged
fix: Improve input device Bus interface detection#523deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefactor DeviceInput::available() to replace hardcoded interface checks with a static list and case-insensitive substring matching, enabling support for interface name variations and fixing availability detection for non-standard names. Class diagram for updated DeviceInput::available() methodclassDiagram
class DeviceInput {
- QString m_Interface
- bool m_Available
- bool m_forcedDisplay
+ bool available()
}
DeviceInput : available() uses static QStringList supportInterfaces
DeviceInput : available() uses case-insensitive substring matching for interface detection
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- The contains check seems inverted – you probably want to check if m_Interface.toLower() contains the known interface strings, not the other way around.
- Add a break after setting m_Available to true to avoid unnecessary iterations once a match is found.
- Use a const reference in the range-for (for example, 'const auto& iface') to avoid copying QStrings on each loop iteration.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The contains check seems inverted – you probably want to check if m_Interface.toLower() contains the known interface strings, not the other way around.
- Add a break after setting m_Available to true to avoid unnecessary iterations once a match is found.
- Use a const reference in the range-for (for example, 'const auto& iface') to avoid copying QStrings on each loop iteration.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
- Use case-insensitive contains matching instead of exact string comparison - Support interface name variations like 'ps/2', 'bluetooth low energy', etc. - Refactor hardcoded interface checks to use static list and loop - Fix device availability detection for input devices with non-standard interface names Log: Improve input device Bus interface detection Bug: https://pms.uniontech.com/bug-view-331181.html Change-Id: Ifbc7c40f44f45e146f07fe101ed3fc960e945459
deepin pr auto review我对这段代码的审查意见如下:
改进后的代码结构更清晰,性能更好,安全性更高,且更易于维护和扩展。 |
max-lvs
approved these changes
Aug 27, 2025
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, 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 |
Contributor
Author
|
/merge |
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.
Log: Improve input device Bus interface detection
Bug: https://pms.uniontech.com/bug-view-331181.html
Change-Id: Ifbc7c40f44f45e146f07fe101ed3fc960e945459
Summary by Sourcery
Improve detection of supported input device interfaces by using case-insensitive substring matching and iterating over a static list of interfaces.
Bug Fixes:
Enhancements: