fix: 修复 UAC 麦克风透传在 DWC3 上的播放失败 - #291
Open
arounyf wants to merge 1 commit into
Open
Conversation
两个根本修复: 1. recreate_config_links 用 read_dir 字母序重建 ConfigFS link, 导致 uac1.usb0 排在 hid.* 之后拿到高编号端点 ep7,DWC3 无法 在该端点上做等时传输(request not queued)。改为按 functions Vec 顺序(UAC 优先)重建 link。 2. 非阻塞 ALSA 状态机在 DWC3 上无法启动等时端点 (snd_pcm_start 返回 EPIPE)。改回 aplay 子进程方案 (阻塞 ALSA,已验证成功),保留 UacPlaybackState 状态机 和前端 UI。同时复现之前提交的空闲恢复强制新 aplay、 大缓冲、5s 空闲超时等修复。
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.
问题
5963dfa0(完善 OTG UAC 音频支持)将 UAC 播放从 aplay 子进程重写为非阻塞 ALSA 状态机后,DWC3 复合设备上麦克风透传失效,UI 一直卡在「等待目标机」。两个根本原因
1. ConfigFS link 顺序被打乱 → 等时端点分配到 ep7
recreate_config_links()用std::fs::read_dir遍历functions/目录,按文件系统字母序重建 link。uac1.usb0字母序排在hid.usb0~3之后,导致 UAC 等时端点被分配到 ep7。DWC3 无法在 ep7 上做等时传输,内核报错:之前成功时 UAC 拿的是低编号端点(ep2),靠 UAC 优先 HID 创建保证。
2. 非阻塞 ALSA 无法启动等时端点
playback.rs用PCM::new(..., true)(非阻塞)+start_threshold自动启动,但snd_pcm_start返回 EPIPE:非阻塞模式在 DWC3 上无法激活等时端点。之前 aplay 子进程(阻塞 ALSA)可以。
修复
src/otg/manager.rsrecreate_config_links按functionsVec 顺序(UAC 优先)重建 linksrc/audio/uac/playback.rsUacPlaybackState状态机接口和前端 UI同时复现之前 PR #285 的修复:
--buffer-size=32768大缓冲容错