Logo Search packages:      
Sourcecode: k9copy version File versions  Download package

bool K3bDevice::Device::readDiscInfo ( unsigned char **  data,
int &  dataLen 
) const

if true is returned dataLen specifies the actual length of *data which needs to be deleted after using.

Definition at line 748 of file k3bdevice_mmc.cpp.

References blockDeviceName().

Referenced by discSize(), diskInfo(), isEmpty(), remainingSize(), and rewritable().

{
  unsigned char header[2];
  ::memset( header, 0, 2 );

  ScsiCommand cmd( this );
  cmd[0] = MMC_READ_DISK_INFORMATION;
  cmd[8] = 2;

  if( cmd.transport( TR_DIR_READ, header, 2 ) == 0 ) {
    // again with real length
    dataLen = from2Byte( header ) + 2;

    *data = new unsigned char[dataLen];
    ::memset( *data, 0, dataLen );

    cmd[7] = dataLen>>8;
    cmd[8] = dataLen;
    if( cmd.transport( TR_DIR_READ, *data, dataLen ) == 0 )
      return true;
    else {
      kdDebug() << "(K3bDevice::Device) " << blockDeviceName() << ": READ DISC INFORMATION with real length "
            << dataLen << " failed." << endl;
      delete [] *data;
    }
  }
  else {
    kdDebug() << "(K3bDevice::Device) " << blockDeviceName() << ": READ DISC INFORMATION length det failed" << endl;
  }

  return false;
}


Generated by  Doxygen 1.6.0   Back to index