mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-09-13 02:54:26 +08:00
feat: 增加 OTG HID 远程唤醒和 OTG MSD 设备名称配置
- 在补丁内核上启用 HID 写入唤醒及 USB 远程唤醒描述符 - 支持全局配置 Flash 和 CD-ROM INQUIRY 字符串 - 兼容普通内核的通用 INQUIRY 属性 - 调整 OTG 功能布局并更新大容量 DVD 镜像提示
This commit is contained in:
@@ -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)))?;
|
||||
|
||||
Reference in New Issue
Block a user