mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
solid: theoretical optical drive eject implementation
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
ab75e64aa3
commit
a3e3555391
2 changed files with 22 additions and 15 deletions
|
@ -163,6 +163,8 @@ if(UDEV_FOUND AND CMAKE_SYSTEM_NAME MATCHES Linux)
|
|||
backends/udev/udevopticaldrive.cpp
|
||||
)
|
||||
add_definitions(-DUDEV_CDIO)
|
||||
include_directories(${LIBCDIO_INCLUDES})
|
||||
set(solid_OPTIONAL_LIBS ${solid_OPTIONAL_LIBS} ${LIBCDIO_LIBRARIES})
|
||||
endif()
|
||||
|
||||
set(UDEV_DETAILED_OUTPUT OFF CACHE BOOL "provide extended output regarding udev events")
|
||||
|
|
|
@ -20,8 +20,12 @@
|
|||
|
||||
#include "udevopticaldrive.h"
|
||||
|
||||
#include <cdio/cdio.h>
|
||||
|
||||
using namespace Solid::Backends::UDev;
|
||||
|
||||
// TODO: Q_CONSTRUCTOR_FUNCTION() for cdio_init()? cdio_open() is supposed to call it
|
||||
|
||||
OpticalDrive::OpticalDrive(UDevDevice *device)
|
||||
: StorageDrive(device)
|
||||
{
|
||||
|
@ -38,25 +42,26 @@ bool OpticalDrive::eject()
|
|||
{
|
||||
m_device->broadcastActionRequested("eject");
|
||||
|
||||
#if 0
|
||||
Solid::DeviceBusy
|
||||
Solid::OperationFailed
|
||||
Solid::UserCanceled
|
||||
Solid::InvalidOption
|
||||
Solid::MissingDriver
|
||||
Solid::UnauthorizedOperation
|
||||
|
||||
if (true) {
|
||||
const QByteArray devicename = m_device->deviceName().toLocal8Bit();
|
||||
const driver_return_code_t result = cdio_eject_media_drive(devicename.constData());
|
||||
if (result == DRIVER_OP_SUCCESS) {
|
||||
m_device->broadcastActionDone("setup", Solid::NoError, QString());
|
||||
} else {
|
||||
const QString ejecterror;
|
||||
m_device->broadcastActionDone("eject", Solid::UnauthorizedOperation, ejecterror);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
const QString ejecterror;
|
||||
/*
|
||||
TODO: check result and emit broadcastActionDone with one of:
|
||||
UnauthorizedOperation
|
||||
DeviceBusy
|
||||
OperationFailed
|
||||
UserCanceled
|
||||
InvalidOption
|
||||
MissingDriver
|
||||
*/
|
||||
const QString ejecterror = QString::fromLatin1(cdio_driver_errmsg(result));;
|
||||
m_device->broadcastActionDone("eject", Solid::UnauthorizedOperation, ejecterror);
|
||||
return false; // TODO:
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<int> OpticalDrive::writeSpeeds() const
|
||||
|
|
Loading…
Add table
Reference in a new issue