0.12.0 Begin neu Architecture
This commit is contained in:
@@ -759,15 +759,17 @@ class DiskDetectionService extends EventEmitter {
|
||||
|
||||
async checkMediaPresent(devicePath) {
|
||||
let blkidType = null;
|
||||
let blkidError = null;
|
||||
try {
|
||||
const { stdout } = await execFileAsync('blkid', ['-o', 'value', '-s', 'TYPE', devicePath]);
|
||||
blkidType = String(stdout || '').trim().toLowerCase() || null;
|
||||
} catch (_error) {
|
||||
blkidError = String(_error?.message || _error || 'unknown');
|
||||
// blkid failed – could mean no disc, or an audio CD (no filesystem type)
|
||||
}
|
||||
logger.info('check-media:blkid', { devicePath, blkidType, blkidError });
|
||||
|
||||
if (blkidType) {
|
||||
logger.debug('blkid:result', { devicePath, hasMedia: true, type: blkidType });
|
||||
return { hasMedia: true, type: blkidType };
|
||||
}
|
||||
|
||||
@@ -790,10 +792,19 @@ class DiskDetectionService extends EventEmitter {
|
||||
const hasBD = Object.keys(props).some((k) => k.startsWith('ID_CDROM_MEDIA_BD') && props[k] === '1');
|
||||
const hasDVD = Object.keys(props).some((k) => k.startsWith('ID_CDROM_MEDIA_DVD') && props[k] === '1');
|
||||
const hasCD = props['ID_CDROM_MEDIA_CD'] === '1';
|
||||
logger.info('check-media:udevadm', { devicePath, hasBD, hasDVD, hasCD });
|
||||
if (hasCD && !hasDVD && !hasBD) {
|
||||
logger.debug('udevadm:audio-cd', { devicePath });
|
||||
return { hasMedia: true, type: 'audio_cd' };
|
||||
}
|
||||
if (hasBD) {
|
||||
logger.debug('udevadm:bluray', { devicePath });
|
||||
return { hasMedia: true, type: 'udf' };
|
||||
}
|
||||
if (hasDVD) {
|
||||
logger.debug('udevadm:dvd', { devicePath });
|
||||
return { hasMedia: true, type: 'udf' };
|
||||
}
|
||||
} catch (_udevError) {
|
||||
// udevadm not available or failed – ignore
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user