|
Hi all,
I'm in the process of understanding UDF CDR code. I have seen many isues which make the code not usable.
- Cache MUST be flushed after a writepacket
- In writefiles function, all files data are loaded in RAM memory : If you write 10 files of 20MB, 200MB will be loaded in RAM. Not a realistic programming method.
- function writepacket sends data to the burner without check/retry algorythm. It may work with small amount of data but will NEVER work with big amount of data. It may work untill the burner cache is full. Then it will crash.
- Code needs more than few modifications. There are many issues that need to be corrected to make code usable to generate a true UDF compliant disc. Using "udf_test" tool from Philips helps a lot in this task.
Nicolas
|
|
|
|
|
Before i append files to the CDR,what should i do?
Could anyone detail the process?;)
Thanks for your responses.
photograph
|
|
|
|
|
After i finished appending files to the disc, i got an
Error which means "Session Fixation Error-Imcomplete track in session ".
can anyone help me out of this question?;)
Thanks for your responses.
photograph
|
|
|
|
|
Hello,
It is able to format the CD-R. But when i tried to write a file onto it,I got an error code "Out of memory".
In function SCSI2::WriteFiles , the flags of the icbTag i got by the function "SCSIRead" is equal to 0.
Can anyone suggest a way out to this problem?
I very much appreciate your responses.
photograph
|
|
|
|
|
I think your ReadTrackInfo() don't return a correct value.
Check the value of next_writtable_addr is right.
If you use ATAPI CD-writer, see below to correct SetWriteParameters() function.
|
|
|
|
|
I have corrected SetWriteParameters() function,but the problem still exists.
Another question: i use a ATAPI DVD-writer. Do this code support DVD-writer?
I very much appreciate your response.
photograph
|
|
|
|
|
well.. I don't know about DVD-writer
but I think it would work..
if the same problem still exist, look up the related document about DVD-writer or ATAPI document.
DVD-writer may differ from CD-writer in some commands.
Good luck to u.
|
|
|
|
|
Thanks for your reponse.
I have sucessfully Written a UDF disc..
Thank you very much.
photograph
|
|
|
|
|
Can you show me how to write a UDF disc (removable media with Universal Disc Format)? Thank you so much!
|
|
|
|
|
Hello,
I have downloaded this sample and tried executing it. It is able to detect the CD drive attached to my system. But when I tried to format it, it fails in the function SetWriteParameters() returning an error code
"SenseKey: 0X5,ASC = 0X24, ASCQ =0X0".
What does this error code indicate?
Can anyone please suggest a way out to this problem.
Thanks.
S.sunilkumar
|
|
|
|
|
5:24 means invalid CDB.. if u use ATAPI cd writer u should the code like this.. this code exactly works on my PC
bool SCSI2::SetWriteParameters (int write_type,int dbtype,int track_mode,
int session_format) {
unsigned char szBuffer[0x100];
SRB_ExecSCSICmd srbExec;
memset ( &srbExec, 0, sizeof ( SRB_ExecSCSICmd ) );
srbExec.SRB_Cmd = SC_EXEC_SCSI_CMD;
srbExec.SRB_HaId = m_HA;
srbExec.SRB_Target = m_ID;
srbExec.SRB_Lun = m_LUN;
srbExec.SRB_Flags = SRB_DIR_IN;
srbExec.SRB_BufLen = sizeof(cd_mode_page_05)+8;
srbExec.SRB_BufPointer = szBuffer;
srbExec.SRB_SenseLen = 18;
srbExec.SRB_CDBLen = 12;
srbExec.CDBByte [ 0 ] = SCSI_MODE_SEN10;
srbExec.CDBByte [ 1 ] = 0x08;
srbExec.CDBByte [ 2 ] = 0x05;
srbExec.CDBByte [ 8 ] = sizeof(cd_mode_page_05)+4;
pfnSendASPI32Command ( ( LPSRB ) &srbExec );
while ( srbExec.SRB_Status == SS_PENDING );
if ( srbExec.SRB_Status == SS_COMP ){
cd_mode_page_05 *p=(cd_mode_page_05 *)(szBuffer+8);
p->write_type=write_type; //Packet
p->fp=0; //Variable Packet Size
p->dbtype=dbtype; //Mode 2 form 1
p->track_mode=track_mode; //Data,incremental
p->session_format=session_format; //CDROM
p->sub_h.subMode=0x08;
srbExec.SRB_Status = 0;
srbExec.SRB_HaStat=0;
srbExec.SRB_Flags = SRB_DIR_OUT;
srbExec.SRB_SenseLen = 18;
srbExec.SRB_CDBLen = 12;
srbExec.CDBByte [ 0 ] = SCSI_MODE_SEL10;
srbExec.CDBByte [ 1 ] = 0x10;
srbExec.CDBByte [ 2 ] = 0;
srbExec.CDBByte [ 8 ] = sizeof(cd_mode_page_05)+4;
pfnSendASPI32Command ( ( LPSRB ) &srbExec );
while ( srbExec.SRB_Status == SS_PENDING )
if(srbExec.SRB_TargStat == STATUS_CHKCOND&&!m_silence){
m_sense=*(scsi_sense *)srbExec.SenseArea;
AfxMessageBox(checkSense());
}
}
WriteParameters();
return srbExec.SRB_Status == SS_COMP;
}
|
|
|
|
|
You ask about this note
4. Needs to double check the write address and re-allocation buffer in the
write files routines. Note: The sync cache after write fixs the problem.
The next write address is then properly read.
--------------------------------------------
I can't understand what this words mean...
Can I get the explanation about this?
I need your help ...
It'll be very nice if you can help me..
--------------------------------------------
Answer:
To issue a SYNC_CACHE command after ATAPI write is to force the data in the buffer out to disc and update the track information. The read track information will then return the proper information, specially, the next available write address. Thus:
in the early part of
bool SCSI2::WriteFiles (CString fileName) {
add the following statement:
SyncCache();
while( TestUnitReady() );
some time before the
ReadTrackInfo(0,&ti);
int lastLeadOut=toInt32(ti.track_start_addr)+toInt32(ti.track_size);
m_lba=toInt32(ti.next_writtable_addr);
With these arrangement, the statement at later would not fail.
BYTE* buffer=new BYTE[block_size*totalBlocks];
if(m_lba+totalBlocks+7>lastLeadOut){
AfxMessageBox("Disk Full!");
return false;
To ensure the file data is all out and not stuck in the buffer. add
SyncCache();
while( TestUnitReady() );
ReadDiskInfo(&di); // this one is not necessary
at close to end of the routine before
delete buffer;
delete list;
return result;
This arrangement also eliminate the "drive is stuck in the write " unless the buffer gets empty.
|
|
|
|
|
Thank you for reply ~
This is very helpful to me~!
But I have still some problem..
After Formatting the disc I can't get right VATICB addr..
I think there's some serious problem in my code..
bool SCSI2::SyncCache()
{
srbExec.SRB_Cmd = SC_EXEC_SCSI_CMD;
srbExec.SRB_HaId = m_HA;
srbExec.SRB_Target = m_ID;
srbExec.SRB_Lun = m_LUN;
srbExec.SRB_Flags = SRB_DIR_OUT;
srbExec.SRB_SenseLen = SENSE_LEN;
srbExec.SRB_BufLen = 0;
srbExec.SRB_BufPointer = 0;
srbExec.SRB_CDBLen = 12;
srbExec.CDBByte [ 0 ] = SCSI_SYNC_CACHE;
srbExec.CDBByte [ 7 ] = 0;
srbExec.CDBByte [ 8 ] = 0;
pfnSendASPI32Command ( ( LPSRB ) &srbExec );
while ( srbExec.SRB_Status == SS_PENDING );
if(checkError(srbExec.SRB_Status)!="SUCCESS"&&!m_silence){
m_sense=*(scsi_sense *)srbExec.SenseArea;
AfxMessageBox(checkSense());
}
Is there any problem?
|
|
|
|
|
1. srbExec.SRB_Flags = SRB_EVENT_NOTIFY;
2. your still need buffer for sense data
3. after sync cache, then
ReadTrackInfo(0,&ti);
sample for yor reference
memset ( &srbExec, 0, sizeof ( SRB_ExecSCSICmd ) );
srbExec.SRB_Cmd = SC_EXEC_SCSI_CMD;
srbExec.SRB_HaId = m_HA;
srbExec.SRB_Flags = SRB_EVENT_NOTIFY;
srbExec.SRB_Target = m_ID;
srbExec.SRB_Lun = m_LUN;
srbExec.SRB_BufLen = 36;
srbExec.SRB_BufPointer = szBuffer;
srbExec.SRB_SenseLen = SENSE_LEN;
srbExec.SRB_CDBLen = 12;
srbExec.CDBByte [ 0 ] = 0x35;
srbExec.CDBByte [ 1 ] = 0; //Immediate is 1
srbExec.CDBByte [ 5 ] = 0; //logi addr 0
srbExec.CDBByte [ 8 ] = 0;
pfnSendASPI32Command ( ( LPSRB ) &srbExec );
while ( srbExec.SRB_Status == SS_PENDING );
if(checkError(srbExec.SRB_Status)!="SUCCESS"&&!m_silence){
m_sense=*(scsi_sense*)srbExec.SenseArea;
AfxMessageBox(checkSense());
return false;
}
memset(blk,0,block_size);
track_info ti;
ReadTrackInfo(0,&ti);
int lastLeadOut=toInt32(ti.track_start_addr)+toInt32(ti.track_size);
m_lba=toInt32(ti.next_writtable_addr);
int lastVATICB_Addr=m_lba-8;
|
|
|
|
|
sense key: 0×5, asc=0×21, ascq=0×0
brown baek
|
|
|
|
|
|
Will this work with a DVD RAM ? Can this format a dvd ram in udf ?
|
|
|
|
|
This code must be modified to run with DVD-RAM.
DVD-RAM works like a hard drive : No tracks, sessions... Only sectors (or blocks).
|
|
|
|
|
I modified your code to format a DVD-RAM (in Vista) However, vista is unable to read the disc afterwards. (It says its blank)
Here are my questions:
First: When you write the udf header you start at a location other than 0, why is that?
Second: How many blocks does the header take up?
My work around was somewhat interesting. I've used vista to format the DVD, then I opened the volume and copied the first 4096 blocks into a file on my hard drive. When I want a blank DVD, I simply copy the bytes back on to the volume. Do you see a major issue with this approach?
Ken
|
|
|
|
|
Hi,
This is Prashant from India. I have down load your sample application from codeproject.com. When I run this application, it is not detecting CD writer connected there to my system. On system I am using has WindowsXp OS, and Adaptec Drivers
1. aspi32.sys (ver. 4.71.2)
2. wowpost.exe (ver. 4.6(1021))
3. winaspi.dll (ver. 4.6(1021))
4. wnaspi32.dll (ver. 4.71.2)
Please let me know what shoud I do so using Adaptec driver this application will detect IDE CD Writer (IDE Sony CD writer.)
regards
Prashant
|
|
|
|
|
Hi,
I am working on UDF file system decoder. I am blocked as of now and I cannot proceed further until I get to know how to get last block information. Please help me out!
Regards
Kiran
|
|
|
|
|
It seems this demo can't write directories. What shall be considered when write dirctories? Cdr-tools offers this ability, but the source code is hard to read. Can somebody gives me some tips or URLs upon this topic?
|
|
|
|
|
Can I get the disc manufaturer off the disc with this code?
|
|
|
|
|
After so problems with the sample code to run an ATAPI CD-RW drive, I took a close look with the code. There are few basic problems with the code to run ATAPI CD-R/RW drives:
1. ATAPI CDB length is 12 (this in not critical)
2. Mode sense and select pages should be 0x5A and 0x55 command code
3. Need to issue Sync CACHE 0x35 and read disc info 0x55 after done all
intended write(s) (not every write) to force clean write buffer data to
the disc before any other command.
4. Needs to double check the write address and re-allocation buffer in the
write files routines. Note: The sync cache after write fixs the problem.
The next write address is then properly read.
This may fix most of the problems in the sample code.
F King
|
|
|
|
|
OS : window 2000
CD/RW Model : Yamaha CRW8824S or YAMAHA CRW2100S
During Format CD/RW Media ...
Occur Write Error
but Sense key, ASC and ASCQ's value are zero(0x00, 0x00,0x00 )
SCSI2::WritePacket (unsigned char* buffer,long addr,long len,bool packet)
{
.
.
.
//////////////////////////////////////////////////
// here write errror occured position
// Question
// 1. Why the value is zeor for
// srbExec.SRB_BufLen = 0;
// srbExec.SRB_BufPointer=0;
// .
// .
// srbExec.CDBByte [ 7 ] = 0;
// srbExec.CDBByte [ 8 ] = 0;
//
// 2. Why error code( sensekey, asc, ascq's value are zero ?
//
if(srbExec.SRB_Status == SS_COMP && packet)
{
m_lba+=7;
srbExec.SRB_BufLen = 0;
srbExec.SRB_BufPointer=0;
srbExec.CDBByte [ 2 ] = (m_lba>>24)&0xff;
srbExec.CDBByte [ 3 ] = (m_lba>>16)&0xff;
srbExec.CDBByte [ 4 ] = (m_lba>>8)&0xff;
srbExec.CDBByte [ 5 ] = m_lba&0xff;
srbExec.CDBByte [ 7 ] = 0;
srbExec.CDBByte [ 8 ] = 0;
pfnSendASPI32Command ( ( LPSRB ) &srbExec );
while ( srbExec.SRB_Status == SS_PENDING );
if(checkError(srbExec.SRB_Status)!="SUCCESS"&&!m_silence)
{
m_sense=*(scsi_sense *)srbExec.SenseArea;
AfxMessageBox(checkSense());
}
}
////////////////////////////////////////////
}
|
|
|
|