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 <noreply@anthropic.com>
This commit is contained in:
@@ -539,6 +539,19 @@ class DiskDetectionService extends EventEmitter {
|
|||||||
// udevadm not available or failed – ignore
|
// 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 });
|
logger.debug('blkid:no-media-or-fail', { devicePath });
|
||||||
return { hasMedia: false, type: null };
|
return { hasMedia: false, type: null };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user