Search
j0ke.net Open Build Service
>
Projects
>
multimedia
>
k3b
> k3b-use-kdeeject.diff
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File k3b-use-kdeeject.diff of Package k3b
--- libk3bdevice/k3bdevice.cpp 2007/06/24 03:07:13 1.1 +++ libk3bdevice/k3bdevice.cpp 2007/06/24 03:11:08 @@ -32,6 +32,7 @@ #include <qmutex.h> #include <k3bdebug.h> +#include <kprocess.h> #include <sys/types.h> #include <sys/ioctl.h> @@ -1509,17 +1510,24 @@ return success; #endif + k3bDebug() << "(K3bDevice::Device::eject) Device: " << blockDeviceName() << endl; + KProcess proc; + proc << "kdeeject"; + proc << "-q"; + proc << blockDeviceName(); + if (!proc.start(KProcess::Block) || !proc.normalExit()) { ScsiCommand cmd( this ); - cmd[0] = MMC_PREVENT_ALLOW_MEDIUM_REMOVAL; - cmd[5] = 0; // Necessary to set the proper command length - if( b ) - cmd[4] = 0x01; - int r = cmd.transport( TR_DIR_WRITE ); + cmd[0] = MMC_START_STOP_UNIT; - if( r ) - k3bDebug() << "(K3bDevice::Device) MMC ALLOW MEDIA REMOVAL failed." << endl; + // Since all other eject methods I saw also start the unit before ejecting + // we do it also although I don't know why... + cmd[4] = 0x1; // Start unit + cmd.transport(); + cmd[4] = 0x2; // LoEj = 1, Start = 0 - return ( r == 0 ); + return !cmd.transport(); + } + return true; } bool K3bDevice::Device::rewritable() const