(dir: &Path, device: &Device, firmware: &DeviceFirmware)
| 212 | } |
| 213 | |
| 214 | async fn handle_firmware(dir: &Path, device: &Device, firmware: &DeviceFirmware) -> Result<()> { |
| 215 | let codec = if let Some(codec) = &firmware.codec { |
| 216 | let codec_path = dir.join("codecs").join(codec); |
| 217 | info!(path = ?codec_path, "Reading codec file"); |
| 218 | |
| 219 | Some(fs::read_to_string(codec_path)?) |
| 220 | } else { |
| 221 | None |
| 222 | }; |
| 223 | |
| 224 | for profile in &firmware.profiles { |
| 225 | let span = span!(Level::INFO, "", profile = %profile); |
| 226 | handle_profile(dir, device, firmware, &codec, profile) |
| 227 | .instrument(span) |
| 228 | .await?; |
| 229 | } |
| 230 | |
| 231 | Ok(()) |
| 232 | } |
| 233 | |
| 234 | async fn handle_profile( |
| 235 | dir: &Path, |
no test coverage detected