Revert "Fix: [Audio] The audio device of usb not show."#526
Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:develop/eaglefrom Aug 28, 2025
Conversation
This reverts commit 76729e9.
deepin pr auto review这段代码是一个条件判断,用于识别和处理声音设备相关的信息。我来分析一下这段代码的改进建议:
改进建议如下: // 建议在类中定义常量
static const QString SOUND_CLASS = "sound";
static const QString USB_AUDIO_DEVICE = "USB Audio";
static const QString SND_USB_AUDIO = "snd-usb-audio";
static const QString NETWORK_CLASS = "network";
static const QString WI_FI_DEVICE = "WI-FI";
void CmdTool::getMulHwinfoInfo(const QString &info)
{
// ... 其他代码 ...
for (const QString &item : list) {
if (item.isEmpty()) {
continue;
}
QMap<QString, QString> mapInfo;
getMapInfoFromHwinfo(item, mapInfo);
// 先获取值并存储,避免重复查找
const QString hardwareClass = mapInfo.value("Hardware Class");
const QString device = mapInfo.value("Device");
const QString driver = mapInfo.value("Driver");
bool isSoundDevice = (hardwareClass == SOUND_CLASS) ||
(device.contains(USB_AUDIO_DEVICE) && device.contains(SND_USB_AUDIO)) ||
(driver.contains(SND_USB_AUDIO));
if (isSoundDevice) {
// mapInfo["Device"].contains("USB Audio") 是为了处理未识别的USB声卡 Bug-118773
addMapInfo("hwinfo_sound", mapInfo);
} else if (hardwareClass.contains(NETWORK_CLASS) || device.toUpper().contains(WI_FI_DEVICE)) {
// ... 其他代码 ...
}
}
}这样的改进可以提高代码的可读性、可维护性和性能,同时确保逻辑的完整性。特别是恢复了对驱动名称的检查,这对于正确识别USB音频设备很重要。 |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR reverts the USB audio driver-based detection fix by removing the driver check from the hardware info filtering in getMulHwinfoInfo. Class diagram for CmdTool after reverting USB audio driver detectionclassDiagram
class CmdTool {
+void getMulHwinfoInfo(const QString &info)
}
CmdTool : getMulHwinfoInfo() now only checks
CmdTool : - mapInfo["Driver"].contains("snd-usb-audio") condition removed
CmdTool : + mapInfo["Hardware Class"] == "sound" || (mapInfo["Device"].contains("USB Audio") && mapInfo["Device"].contains("snd-usb-audio"))
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
max-lvs
approved these changes
Aug 28, 2025
|
[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 |
Contributor
Author
|
/forcemerge |
Contributor
|
This pr force merged! (status: unstable) |
e883cd1
into
linuxdeepin:develop/eagle
15 of 17 checks passed
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.
Reverts #524
Summary by Sourcery
Bug Fixes: