diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-03-30 19:59:57 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-03-30 19:59:57 -0500 |
commit | 4ee736a26459318950f8b68158011b78227a20bd (patch) | |
tree | 6a9cc562561dd606f02499395d1364afdf293888 /tdecore/tdehardwaredevices.cpp | |
parent | fc3c24634ee8e44e9c27be14d4189ff3e4256f6d (diff) | |
download | tdelibs-4ee736a26459318950f8b68158011b78227a20bd.tar.gz tdelibs-4ee736a26459318950f8b68158011b78227a20bd.zip |
Add ejectDriveMedia method to TDE hardware manager
Diffstat (limited to 'tdecore/tdehardwaredevices.cpp')
-rw-r--r-- | tdecore/tdehardwaredevices.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp index b385538fb..b8d6cf29f 100644 --- a/tdecore/tdehardwaredevices.cpp +++ b/tdecore/tdehardwaredevices.cpp @@ -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; } |