Re: K3b 1.0.1 eject problem
[email protected] Fri, 3 Aug 2007 23:10:39 +0200
| Newsgroups | gmane.comp.kde.k3b |
|---|---|
| Message-ID | <[email protected]> |
I tested k3b-1.0.3 and DVD+R VIDEO.
The difference between those two k3b outputs are the lines with the numbers
(1) and (2).
(1) ejects, (2) doesn't eject.
At (1) usageLock()
from bool K3bDevice::Device::eject() const
is executed.
At (2) m_device->usageUnlock()
from int K3bDevice::ScsiCommand::transport( TransportDirection dir,
is executed.
That means the source of error lies at:
if ( m_device ) {
m_device->usageUnlock();
}
in int K3bDevice::ScsiCommand::transport( TransportDirection dir,
See the line "(K3bDevice::ScsiCommand) ***ooo_x14h_1" above (1) and (2) in the
k3b outputs.
The *.diff files for k3bdevice.cpp and k3bscsicommand_linux.cpp I attach
below.
This is the output from k3b which succeeds:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
k3b: (K3bDevice::DeviceHandler) ***ooo_x4_in DeviceHandlerThread: run() dev
= 0x834c430
k3b: (K3bDevice::DeviceHandler) ***ooo_x4_in DeviceHandlerThread: if( dev )
(K3bDevice::Device) ***ooo_x5_in ::open( bool write ) const ---> write = 0
d->openedReadWrite = 0
(K3bDevice::Device) ***ooo_x5a
(K3bDevice::Device) ***ooo_x5b
(K3bDevice::Device) ***ooo_x5c
(K3bDevice::Device) ***ooo_x5d d->deviceFd = 15 if == -1 then openDevice(
QFile::encodeName(devicename()), write )
(K3bDevice::Device) ***ooo_x5e d->deviceFd = 15
(K3bDevice::Device) ***ooo_x5_out ::open( bool write ) const <--- END if
d->deviceFd != -1 then TRUE
k3b: (K3bDevice::DeviceHandler) ***ooo_x4a success (dev->open()) = true
k3b: (K3bDevice::DeviceHandler) ***ooo_x4b
k3b: (K3bDevice::DeviceHandler) ***ooo_x4c
k3b: (K3bDevice::DeviceHandler) ***ooo_x4d
k3b: (K3bDevice::DeviceHandler) ***ooo_x4e
k3b: (K3bDevice::DeviceHandler) ***ooo_x4f
k3b: (K3bDevice::DeviceHandler) ***ooo_x4g
k3b: (K3bDevice::DeviceHandler) ***ooo_x4h
k3b: (K3bDevice::DeviceHandler) ***ooo_x4h_1 if( !m_bCanceled && command &
EJECT )
................................
(K3bDevice::Device) ***ooo_x12_in ::eject() const
(K3bDevice::Device) ***ooo_x12a Q_OS_LINUX
(K3bDevice::Device) ***ooo_x9_in ::isOpen() const
(K3bDevice::Device) ***ooo_x9a d->deviceFd = 15 if != -1 then TRUE
(K3bDevice::Device) ***ooo_x9_out ::isOpen() const <--- END
(K3bDevice::Device) ***ooo_x12c needToClose = 0
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_2 i = 0
(K3bDevice::ScsiCommand) ***ooo_x14d_4 i = 0
(K3bDevice::ScsiCommand) ***ooo_x14d_5 i = 0
(K3bDevice::ScsiCommand) ***ooo_x14f
(K3bDevice::ScsiCommand) ***ooo_x14g
(K3bDevice::ScsiCommand) ***ooo_x14h_1
>>(K3bDevice::Device) ***ooo_x27_out ::usageLock() const <--- END (1)
(K3bDevice::Device) ***ooo_x12d
(K3bDevice::Device) ***ooo_x5_in ::open( bool write ) const ---> write = 0
d->openedReadWrite = 0
(K3bDevice::Device) ***ooo_x5a
(K3bDevice::Device) ***ooo_x5b
(K3bDevice::Device) ***ooo_x5c
(K3bDevice::Device) ***ooo_x5d d->deviceFd = 15 if == -1 then openDevice(
QFile::encodeName(devicename()), write )
(K3bDevice::Device) ***ooo_x5e d->deviceFd = 15
(K3bDevice::Device) ***ooo_x5_out ::open( bool write ) const <--- END if
d->deviceFd != -1 then TRUE
(K3bDevice::Device) ***ooo_x12d_1 if( open() ) {
(K3bDevice::Device) ***ooo_x28_out ::usageUnlock() const <--- END
(K3bDevice::ScsiCommand) ***ooo_x14h_2
(K3bDevice::Device) ***ooo_x15_in ::currentProfile() const
(K3bDevice::ScsiCommand) ***ooo_x14_in ::transport( TransportDirection dir,
(K3bDevice::ScsiCommand) ***ooo_x14a_1
(K3bDevice::Device) ***ooo_x12d_2 success ( if( open() ) { ) = 1
(K3bDevice::Device) ***ooo_x12e success = 1
(K3bDevice::Device) ***ooo_x12_out ::eject() const <--- END
................................
(K3bDevice::Device) ***ooo_x27_out ::usageLock() const <--- END
(K3bDevice::ScsiCommand) ***ooo_x14a_2
(K3bDevice::Device) ***ooo_x9_in ::isOpen() const
(K3bDevice::Device) ***ooo_x9a d->deviceFd = 15 if != -1 then TRUE
(K3bDevice::Device) ***ooo_x9_out ::isOpen() const <--- END
(K3bDevice::Device) ***ooo_x5_in ::open( bool write ) const ---> write = 0
d->openedReadWrite = 0
(K3bDevice::Device) ***ooo_x5a
(K3bDevice::Device) ***ooo_x5b
(K3bDevice::Device) ***ooo_x5c
(K3bDevice::Device) ***ooo_x5d d->deviceFd = 15 if == -1 then openDevice(
QFile::encodeName(devicename()), write )
(K3bDevice::Device) ***ooo_x5e d->deviceFd = 15
(K3bDevice::Device) ***ooo_x5_out ::open( bool write ) const <--- END if
d->deviceFd != -1 then TRUE
(K3bDevice::ScsiCommand) ***ooo_x14a_3
(K3bDevice::ScsiCommand) ***ooo_x14a_4
(K3bDevice::ScsiCommand) ***ooo_x14c m_deviceHandle = 15
(K3bDevice::ScsiCommand) ***ooo_x14d
(K3bDevice::ScsiCommand) ***ooo_x14d_1
(K3bDevice::ScsiCommand) ***ooo_x14d_2
(K3bDevice::ScsiCommand) ***ooo_x14d_2a
(K3bDevice::ScsiCommand) ***ooo_x14d_3
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1 m_deviceHandle = 15 SG_IO = 8837
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1a d->useSgIo = 1
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1b &d->sgIo = 0x856cf10
(K3bDevice::Device) ***ooo_x28_out ::usageUnlock() const <--- END
k3b: (K3bDevice::DeviceHandler) ***ooo_x4h_2 success (success &&
dev->eject()) = true
k3b: (K3bDevice::DeviceHandler) ***ooo_x4i
k3b: (K3bDevice::DeviceHandler) ***ooo_x4j
k3b: (K3bDevice::DeviceHandler) ***ooo_x4k
(K3bDevice::Device) ***ooo_x8_in ::close() const
(K3bDevice::Device) ***ooo_x8_a Q_OS_LINUX d->deviceFd = 15 if != -1
then ::close( d->deviceFd )
(K3bDevice::Device) ***ooo_x8_out ::close() const <--- END
k3b: (K3bDevice::DeviceHandler) ***ooo_x4_out DeviceHandlerThread: if( dev )
<--- END
k3b: (K3bThreadJob) waiting for the thread to finish.
k3b: (K3bDevice::DeviceHandler) ***ooo_x4_out DeviceHandlerThread: run()
<--- END
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
This is the k3b output which doesn't secceed:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
k3b: (K3bDevice::DeviceHandler) ***ooo_x4_in DeviceHandlerThread: run() dev
= 0x834c1e0
k3b: (K3bDevice::DeviceHandler) ***ooo_x4_in DeviceHandlerThread: if( dev )
(K3bDevice::Device) ***ooo_x5_in ::open( bool write ) const ---> write = 0
d->openedReadWrite = 0
(K3bDevice::Device) ***ooo_x5a
(K3bDevice::Device) ***ooo_x5b
(K3bDevice::Device) ***ooo_x5c
(K3bDevice::Device) ***ooo_x5d d->deviceFd = 13 if == -1 then openDevice(
QFile::encodeName(devicename()), write )
(K3bDevice::Device) ***ooo_x5e d->deviceFd = 13
(K3bDevice::Device) ***ooo_x5_out ::open( bool write ) const <--- END if
d->deviceFd != -1 then TRUE
k3b: (K3bDevice::DeviceHandler) ***ooo_x4a success (dev->open()) = true
k3b: (K3bDevice::DeviceHandler) ***ooo_x4b
k3b: (K3bDevice::DeviceHandler) ***ooo_x4c
k3b: (K3bDevice::DeviceHandler) ***ooo_x4d
k3b: (K3bDevice::DeviceHandler) ***ooo_x4e
k3b: (K3bDevice::DeviceHandler) ***ooo_x4f
k3b: (K3bDevice::DeviceHandler) ***ooo_x4g
k3b: (K3bDevice::DeviceHandler) ***ooo_x4h
k3b: (K3bDevice::DeviceHandler) ***ooo_x4h_1 if( !m_bCanceled && command &
EJECT )
................................
(K3bDevice::Device) ***ooo_x12_in ::eject() const
(K3bDevice::Device) ***ooo_x12a Q_OS_LINUX
(K3bDevice::Device) ***ooo_x9_in ::isOpen() const
(K3bDevice::Device) ***ooo_x9a d->deviceFd = 13 if != -1 then TRUE
(K3bDevice::Device) ***ooo_x9_out ::isOpen() const <--- END
(K3bDevice::Device) ***ooo_x12c needToClose = 0
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_2 i = 0
(K3bDevice::ScsiCommand) ***ooo_x14d_4 i = 0
(K3bDevice::ScsiCommand) ***ooo_x14d_5 i = 0
(K3bDevice::ScsiCommand) ***ooo_x14f
(K3bDevice::ScsiCommand) ***ooo_x14g
(K3bDevice::ScsiCommand) ***ooo_x14h_1
>>(K3bDevice::Device) ***ooo_x28_out ::usageUnlock() const <--- END (2)
(K3bDevice::ScsiCommand) ***ooo_x14h_2
(K3bDevice::Device) ***ooo_x15_in ::currentProfile() const
(K3bDevice::ScsiCommand) ***ooo_x14_in ::transport( TransportDirection dir,
(K3bDevice::ScsiCommand) ***ooo_x14a_1
(K3bDevice::Device) ***ooo_x27_out ::usageLock() const <--- END
(K3bDevice::ScsiCommand) ***ooo_x14a_2
(K3bDevice::Device) ***ooo_x9_in ::isOpen() const
(K3bDevice::Device) ***ooo_x9a d->deviceFd = 13 if != -1 then TRUE
(K3bDevice::Device) ***ooo_x9_out ::isOpen() const <--- END
(K3bDevice::Device) ***ooo_x5_in ::open( bool write ) const ---> write = 0
d->openedReadWrite = 0
(K3bDevice::Device) ***ooo_x5a
(K3bDevice::Device) ***ooo_x5b
(K3bDevice::Device) ***ooo_x5c
(K3bDevice::Device) ***ooo_x5d d->deviceFd = 13 if == -1 then openDevice(
QFile::encodeName(devicename()), write )
(K3bDevice::Device) ***ooo_x5e d->deviceFd = 13
(K3bDevice::Device) ***ooo_x5_out ::open( bool write ) const <--- END if
d->deviceFd != -1 then TRUE
(K3bDevice::ScsiCommand) ***ooo_x14a_3
(K3bDevice::ScsiCommand) ***ooo_x14a_4
(K3bDevice::ScsiCommand) ***ooo_x14c m_deviceHandle = 13
(K3bDevice::ScsiCommand) ***ooo_x14d
(K3bDevice::ScsiCommand) ***ooo_x14d_1
(K3bDevice::ScsiCommand) ***ooo_x14d_2
(K3bDevice::ScsiCommand) ***ooo_x14d_2a
(K3bDevice::ScsiCommand) ***ooo_x14d_3
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1 m_deviceHandle = 13 SG_IO = 8837
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1a d->useSgIo = 1
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1b &d->sgIo = 0x85f3050
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_2 i = 0
(K3bDevice::ScsiCommand) ***ooo_x14d_4 i = 0
(K3bDevice::ScsiCommand) ***ooo_x14d_5 i = 0
(K3bDevice::ScsiCommand) ***ooo_x14f
(K3bDevice::ScsiCommand) ***ooo_x14g
(K3bDevice::ScsiCommand) ***ooo_x14h_1
(K3bDevice::Device) ***ooo_x28_out ::usageUnlock() const <--- END
(K3bDevice::ScsiCommand) ***ooo_x14h_2
(K3bDevice::Device) ***ooo_x15_out <--- END profile = 27
(K3bDevice::Device) ***ooo_x16_out ::mediaType() const <--- END m = 8192
(K3bDevice::Device) ***ooo_y13
(K3bDevice::ScsiCommand) ***ooo_x14_in ::transport( TransportDirection dir,
(K3bDevice::ScsiCommand) ***ooo_x14a_1
(K3bDevice::Device) ***ooo_x27_out ::usageLock() const <--- END
(K3bDevice::ScsiCommand) ***ooo_x14a_2
(K3bDevice::Device) ***ooo_x9_in ::isOpen() const
(K3bDevice::Device) ***ooo_x9a d->deviceFd = 13 if != -1 then TRUE
(K3bDevice::Device) ***ooo_x9_out ::isOpen() const <--- END
(K3bDevice::Device) ***ooo_x5_in ::open( bool write ) const ---> write = 0
d->openedReadWrite = 0
(K3bDevice::Device) ***ooo_x5a
(K3bDevice::Device) ***ooo_x5b
(K3bDevice::Device) ***ooo_x5c
(K3bDevice::Device) ***ooo_x5d d->deviceFd = 13 if == -1 then openDevice(
QFile::encodeName(devicename()), write )
(K3bDevice::Device) ***ooo_x5e d->deviceFd = 13
(K3bDevice::Device) ***ooo_x5_out ::open( bool write ) const <--- END if
d->deviceFd != -1 then TRUE
(K3bDevice::ScsiCommand) ***ooo_x14a_3
(K3bDevice::ScsiCommand) ***ooo_x14a_4
(K3bDevice::ScsiCommand) ***ooo_x14c m_deviceHandle = 13
(K3bDevice::ScsiCommand) ***ooo_x14d
(K3bDevice::ScsiCommand) ***ooo_x14d_1
(K3bDevice::ScsiCommand) ***ooo_x14d_2
(K3bDevice::ScsiCommand) ***ooo_x14d_2a
(K3bDevice::ScsiCommand) ***ooo_x14d_3
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1 m_deviceHandle = 13 SG_IO = 8837
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1a d->useSgIo = 1
(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1b &d->sgIo = 0x85f3050
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
K3b-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/k3b-user
k3b-1.0.2-ooo-k3bscsicommand_linux.diff
(text/x-diff, 4.5 KB)
--- ./libk3bdevice/k3bscsicommand_linux.cpp 2007-06-23 20:35:15.000000000 +0200
+++ ./libk3bdevice/k3bscsicommand_linux.cpp 2007-07-04 13:42:48.000000000 +0200
@@ -31,6 +31,9 @@
#include <sys/types.h>
#include <sys/utsname.h>
+#include <iostream> //ooo
+using namespace std; //ooo
+#include <qmutex.h> //ooo
#if !defined(SG_FLAG_LUN_INHIBIT)
# if defined(SG_FLAG_UNUSED_LUN_INHIBIT)
@@ -93,19 +96,36 @@
void* data,
size_t len )
{
+ //QMutex mutex; //ooo
+ //QMutexLocker locker(&mutex); //ooo
+
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14_in " << " ::transport( TransportDirection dir, " << endl;
+
bool needToClose = false;
if( m_device ) {
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14a_1 " << endl;
m_device->usageLock();
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14a_2 " << endl;
if( !m_device->isOpen() ) {
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14a_2a " << endl;
needToClose = true;
}
if ( !m_device->open( dir == TR_DIR_WRITE ) ) {
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14a_2b_1 " << endl;
m_device->usageUnlock();
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14a_2b_2 " << endl;
return -1;
}
+
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14a_3 " << endl;
+
m_deviceHandle = m_device->handle();
+
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14a_4 " << endl;
}
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14c " << " m_deviceHandle = " << m_deviceHandle << endl;
+
if( m_deviceHandle == -1 ) {
return -1;
}
@@ -113,7 +133,11 @@
int i = -1;
#ifdef SG_IO
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d " << endl;
+
if( d->useSgIo ) {
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_1 " << endl;
+
d->sgIo.interface_id= 'S';
d->sgIo.mx_sb_len = sizeof( struct request_sense );
d->sgIo.cmdp = d->cmd.cmd;
@@ -122,20 +146,46 @@
d->sgIo.dxferp = data;
d->sgIo.dxfer_len = len;
d->sgIo.timeout = 5000;
- if( dir == TR_DIR_READ )
+
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_2 " << endl;
+
+ if( dir == TR_DIR_READ ) {
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_2a " << endl;
d->sgIo.dxfer_direction = SG_DXFER_FROM_DEV;
- else if( dir == TR_DIR_WRITE )
+ }
+ else if( dir == TR_DIR_WRITE ) {
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_2b " << endl;
d->sgIo.dxfer_direction = SG_DXFER_TO_DEV;
- else
+ }
+ else {
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_2c " << endl;
d->sgIo.dxfer_direction = SG_DXFER_NONE;
+ }
- i = ::ioctl( m_deviceHandle, SG_IO, &d->sgIo );
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_3 " << endl;
+
+ if( m_deviceHandle ) {
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1 " << " m_deviceHandle = " << m_deviceHandle << " SG_IO = " << SG_IO << endl;
+ if(d->useSgIo) {
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1a " << " d->useSgIo = " << d->useSgIo << endl;
+ cout << "(K3bDevice::ScsiCommand) ***ooo_x14d_3a_1b " << " &d->sgIo = " << &d->sgIo << endl;
+ i = ::ioctl( m_deviceHandle, SG_IO, &d->sgIo );
+ }
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_3a_2 " << " i = " << i << endl;
+ }
+ else
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_3b " << " m_deviceHandle = " << m_deviceHandle << endl;
+
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_4 " << " i = " << i << endl;
if( ( d->sgIo.info&SG_INFO_OK_MASK ) != SG_INFO_OK )
i = -1;
+
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14d_5 " << " i = " << i << endl;
}
else {
#endif
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14e " << endl;
d->cmd.buffer = (unsigned char*)data;
d->cmd.buflen = len;
if( dir == TR_DIR_READ )
@@ -149,15 +199,21 @@
#ifdef SG_IO
}
#endif
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14f " << endl;
if( needToClose )
m_device->close();
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14g " << endl;
+
if ( m_device ) {
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14h_1 " << endl;
m_device->usageUnlock();
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14h_2 " << endl;
}
if( i ) {
+ k3bDebug() << "(K3bDevice::ScsiCommand) ***ooo_x14i " << endl;
debugError( d->cmd.cmd[0],
d->sense.error_code,
d->sense.sense_key,
k3b-1.0.2-ooo-k3bdevice.diff
(text/x-diff, 8.5 KB)
--- ./libk3bdevice/k3bdevice.cpp 2007-07-21 21:53:25.000000000 +0200
+++ ./libk3bdevice/k3bdevice.cpp 2007-07-31 01:23:50.000000000 +0200
@@ -596,6 +596,8 @@
bool K3bDevice::Device::isDVD() const
{
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x18_in " << " ::isDVD() const " << endl;
+
if( readsDvd() )
return( mediaType() & MEDIA_DVD_ALL );
else
@@ -648,6 +650,8 @@
int K3bDevice::Device::numSessions() const
{
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x19_in " << " ::numSessions() " << endl;
+
//
// Session Info
// ============
@@ -751,6 +755,8 @@
K3bDevice::Toc K3bDevice::Device::readToc() const
{
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x20_in " << " ::readToc() " << endl;
+
// if the device is already opened we do not close it
// to allow fast multiple method calls in a row
bool needToClose = !isOpen();
@@ -1542,6 +1548,13 @@
bool K3bDevice::Device::eject() const
{
+ //QMutex mutex; //ooo
+ //QMutexLocker locker(&mutex); //ooo
+
+ k3bDebug() << " ................................ " << endl;
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x12_in " << " ::eject() const " << endl;
+
+
#ifdef Q_OS_NETBSD
bool success = false;
bool needToClose = !isOpen();
@@ -1558,19 +1571,45 @@
if ( success )
return success;
#elif defined(Q_OS_LINUX)
+
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x12a " << " Q_OS_LINUX " << endl;
+
bool success = false;
+
+ //k3bDebug() << "(K3bDevice::Device) ***ooo_x12b " << " needToClose = " << needToClose << endl;
+
bool needToClose = !isOpen();
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x12c " << " needToClose = " << needToClose << endl;
+
usageLock();
+
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x12d " << " usageLock() " << endl;
+
if( open() ) {
+
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x12d_1 " << " if( open() ) { " << endl;
+
if( ::ioctl( d->deviceFd, CDROMEJECT ) >= 0 )
success = true;
if( needToClose )
close();
+
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x12d_2 " << " success ( if( open() ) { ) = " << success << endl;
+
}
+
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x12e " << " success = " << success << endl;
+
usageUnlock();
- if ( success )
+
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x12f " << " usageUnlock() " << endl;
+
+ if ( success ) {
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x12_out " << " ::eject() const " << " <--- END " << endl;
+ k3bDebug() << " ................................ " << endl;
return success;
+ }
#endif
ScsiCommand cmd( this );
@@ -1585,6 +1624,8 @@
cmd[4] = 0x2; // LoEj = 1, Start = 0
+ k3bDebug() << "(K3bDevice::Device) ***ooo " << " !cmd.transport() = " << !cmd.transport() << endl;
+
return !cmd.transport();
}
@@ -1674,13 +1715,24 @@
bool K3bDevice::Device::open( bool write ) const
{
+
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x5_in " << " ::open( bool write ) const " << " ---> "
+ << " write = " << write << " "
+ << " d->openedReadWrite = " << d->openedReadWrite << endl;
+
if( d->openedReadWrite != write )
close();
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x5a " << endl;
+
QMutexLocker ml( &d->openCloseMutex );
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x5b " << endl;
+
d->openedReadWrite = write;
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x5c " << endl;
+
#ifdef Q_OS_FREEBSD
if( !d->cam ) {
d->cam = cam_open_pass (m_passDevice.latin1(), O_RDWR,0 /* NULL */);
@@ -1691,9 +1743,15 @@
return (d->cam != 0);
#endif
#if defined(Q_OS_LINUX) || defined(Q_OS_NETBSD)
+
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x5d " << " d->deviceFd = " << d->deviceFd << " if == -1 then openDevice( QFile::encodeName(devicename()), write )" << endl;
+
if( d->deviceFd == -1 )
d->deviceFd = openDevice( QFile::encodeName(devicename()), write );
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x5e " << " d->deviceFd = " << d->deviceFd << endl;
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x5_out " << " ::open( bool write ) const " << " <--- END " << " if d->deviceFd != -1 then TRUE " << endl;
+
return ( d->deviceFd != -1 );
#endif
}
@@ -1702,6 +1760,7 @@
void K3bDevice::Device::close() const
{
QMutexLocker ml( &d->openCloseMutex );
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x8_in " << " ::close() const " << endl;
#ifdef Q_OS_FREEBSD
if( d->cam ) {
@@ -1710,20 +1769,25 @@
}
#endif
#if defined(Q_OS_LINUX) || defined(Q_OS_NETBSD)
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x8_a " << " Q_OS_LINUX " << " d->deviceFd = " << d->deviceFd << " if != -1 then ::close( d->deviceFd ) " << endl;
if( d->deviceFd != -1 ) {
::close( d->deviceFd );
d->deviceFd = -1;
}
#endif
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x8_out " << " ::close() const " << " <--- END " << endl;
}
bool K3bDevice::Device::isOpen() const
{
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x9_in " << " ::isOpen() const " << endl;
#ifdef Q_OS_FREEBSD
return d->cam;
#endif
#if defined(Q_OS_LINUX) || defined(Q_OS_NETBSD)
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x9a " << " d->deviceFd = " << d->deviceFd << " if != -1 then TRUE " << endl;
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x9_out " << " ::isOpen() const " << " <--- END " << endl;
return ( d->deviceFd != -1 );
#endif
}
@@ -1737,6 +1801,8 @@
int K3bDevice::Device::currentProfile() const
{
+ k3bDebug() << "(K3bDevice::Device) " << "***ooo_x15_in " << " ::currentProfile() const" << endl;
+
unsigned char profileBuf[8];
::memset( profileBuf, 0, 8 );
@@ -1777,6 +1843,7 @@
delete[] data;
}
}
+ k3bDebug() << "(K3bDevice::Device) " << "***ooo_x15_out " << " <--- END" << " profile = " << profile << endl;
switch (profile) {
case 0x00: return MEDIA_NONE;
@@ -1813,6 +1880,8 @@
K3bDevice::DiskInfo K3bDevice::Device::diskInfo() const
{
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x21_in " << " ::diskInfo() const " << endl;
+
DiskInfo inf;
// if the device is already opened we do not close it
@@ -2259,6 +2328,7 @@
if( needToClose )
close();
}
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x21_out " << " ::diskInfo() const <--- END " << endl;
return inf;
}
@@ -2266,6 +2336,8 @@
int K3bDevice::Device::mediaType() const
{
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x16_in " << " ::mediaType() const " << endl;
+
int m = MEDIA_UNKNOWN;
if( testUnitReady() ) {
@@ -2343,6 +2415,7 @@
m = MEDIA_CD_ROM;
}
}
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x16_out " << " ::mediaType() const <--- END " << " m = " << m << endl;
return m;
}
@@ -2388,6 +2461,8 @@
void K3bDevice::Device::checkFeatures()
{
+ k3bDebug() << "(K3bDevice::Device) " << "***ooo " << " ::checkFeatures()" << endl;
+
unsigned char header[1024];
::memset( header, 0, 1024 );
@@ -3070,6 +3145,8 @@
int K3bDevice::Device::determineMaximalWriteSpeed() const
{
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x22_in " << " ::determineMaximalWriteSpeed() " << endl;
+
int ret = 0;
unsigned char* data = 0;
unsigned int dataLen = 0;
@@ -3104,6 +3181,8 @@
QValueList<int> K3bDevice::Device::determineSupportedWriteSpeeds() const
{
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x23_in " << " ::determineSupportedWriteSpeeds() const " << endl;
+
QValueList<int> ret;
if( burner() ) {
@@ -3489,6 +3568,8 @@
bool K3bDevice::Device::getNextWritableAdress( unsigned int& lastSessionStart, unsigned int& nextWritableAdress ) const
{
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x24_in " << " ::getNextWritableAdress( unsigned int& lastSessionStart, unsigned int& nextWritableAdress ) const " << endl;
+
bool success = false;
// FIXME: add CD media handling
@@ -3579,6 +3660,8 @@
QCString K3bDevice::Device::mediaId( int mediaType ) const
{
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x17_in " << " ::mediaId( int mediaType ) const " << endl;
+
QCString id;
if( mediaType & MEDIA_CD_ALL ) {
@@ -3615,6 +3698,7 @@
delete [] data;
}
}
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x17_out " << " ::mediaId( int mediaType ) const <--- END " << endl;
return id;
}
@@ -3640,10 +3724,12 @@
void K3bDevice::Device::usageLock() const
{
d->mutex.lock();
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x27_out" << " ::usageLock() const" << " <--- END " << endl;
}
void K3bDevice::Device::usageUnlock() const
{
d->mutex.unlock();
+ k3bDebug() << "(K3bDevice::Device) ***ooo_x28_out" << " ::usageUnlock() const" << " <--- END " << endl;
}