Add ejectDriveMedia method to TDE hardware manager

pull/16/head
Timothy Pearson 12 years ago
parent fc3c24634e
commit 4ee736a264

@ -449,6 +449,21 @@ bool TDEStorageDevice::lockDriveMedia(bool lock) {
}
}
bool TDEStorageDevice::ejectDriveMedia() {
int fd = open(deviceNode().ascii(), O_RDWR | O_NONBLOCK);
if (fd < 0) {
return false;
}
if (ioctl(fd, CDROMEJECT) != 0) {
close(fd);
return false;
}
else {
close(fd);
return true;
}
}
TQString TDEStorageDevice::diskLabel() {
return m_diskName;
}

@ -661,6 +661,13 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
*/
bool lockDriveMedia(bool lock);
/**
* @return TRUE on success, FALSE on failure
*
* This method currently works on CD-ROM drives and similar devices
*/
bool ejectDriveMedia();
protected:
/**
* @param a TQString with the disk or partition label, if any

Loading…
Cancel
Save