feat: 增加 OTG HID 远程唤醒和 OTG MSD 设备名称配置

- 在补丁内核上启用 HID 写入唤醒及 USB 远程唤醒描述符
  - 支持全局配置 Flash 和 CD-ROM INQUIRY 字符串
  - 兼容普通内核的通用 INQUIRY 属性
  - 调整 OTG 功能布局并更新大容量 DVD 镜像提示
This commit is contained in:
mofeng-git
2026-07-29 13:56:52 +08:00
parent e0bddc2faa
commit 887f29096f
12 changed files with 347 additions and 67 deletions

View File

@@ -106,6 +106,16 @@ pub fn write_file(path: &Path, content: &str) -> Result<()> {
Ok(())
}
/// Write an optional configfs/sysfs attribute when the running kernel exposes it.
/// This keeps newer kernel enhancements compatible with older kernels.
pub fn write_file_if_exists(path: &Path, content: &str) -> Result<bool> {
if !path.exists() {
return Ok(false);
}
write_file(path, content)?;
Ok(true)
}
pub fn write_bytes(path: &Path, data: &[u8]) -> Result<()> {
let mut file = File::create(path)
.map_err(|e| AppError::Internal(format!("Failed to create {}: {}", path.display(), e)))?;