From 15f1a493786f96a32a3a7a4e9019f785c2c1b093 Mon Sep 17 00:00:00 2001 From: mboehmlaender Date: Thu, 12 Mar 2026 08:18:55 +0000 Subject: [PATCH] fix: add cdparanoia fallback for audio CD detection in VMs udevadm media flags are not propagated in VM/passthrough scenarios. When blkid and udevadm both return nothing, try cdparanoia -Q to detect audio CDs directly via TOC read. Co-Authored-By: Claude Sonnet 4.6 --- backend/src/services/diskDetectionService.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/src/services/diskDetectionService.js b/backend/src/services/diskDetectionService.js index b4a142d..6e3b8fb 100644 --- a/backend/src/services/diskDetectionService.js +++ b/backend/src/services/diskDetectionService.js @@ -539,6 +539,19 @@ class DiskDetectionService extends EventEmitter { // udevadm not available or failed – ignore } + // Last resort: cdparanoia can read the TOC of audio CDs directly. + // Useful when udev media flags are not propagated (e.g. VM passthrough). + // blkid already returned nothing above, so a successful cdparanoia -Q + // means an audio CD is present (data discs have no filesystem but blkid + // would still have caught them via sector probing). + try { + await execFileAsync('cdparanoia', ['-Q', '-d', devicePath], { timeout: 10000 }); + logger.debug('cdparanoia:audio-cd', { devicePath }); + return { hasMedia: true, type: 'audio_cd' }; + } catch (_cdError) { + // cdparanoia failed – no audio CD present (or cdparanoia not installed) + } + logger.debug('blkid:no-media-or-fail', { devicePath }); return { hasMedia: false, type: null }; }