PATCH: Fixes problems with the cdrom driver not reporting certain data correctly

Waldeck Schutzer schutzer at math.rutgers.edu
Wed Jan 29 18:31:56 CST 2003


Hi Eric,

I did some testing on Windows and while I don't have actual CD's of all 
different standards what I got is always the same answer for those 
fields I "hard-coded". Independently of the standard, in cooked mode the 
frame size is supposed to be 2048, and that also seems to be the sector 
size. I suppose that RAW access doesn't go through that driver anyway, 
does it?

The computation of the number of cylinders using the data on the TOC 
seems to be correct for CD's but will certainly be wrong for most DVD's 
since they are huge (their lead-out shows as 255:59:74). Most certainly 
I will need to get raw data on the DVD other than the TOC to get it 
right. Can you give me some hint on that?

I'll be fixing the computation of Length in the BSD case too.

Best,
Waldeck

Eric Pouech wrote:

> Waldeck Schutzer wrote:
>
>> Some applications I tested failed to work correctly because of 
>> incomplete/missing data received from the cdrom driver. The following 
>> issues are addressed and should be fixed by this patch:
>
> a few comments
> A+
>
>> @@ -380,15 +385,22 @@ static DWORD CDROM_GetDeviceNumber(int d
>>  
>>  static DWORD CDROM_GetDriveGeometry(int dev, DISK_GEOMETRY* dg)
>>  {
>> -#if 0
>> -    dg->Cylinders.s.LowPart = 1; /* FIXME */
>> -    dg->Cylinders.s.HighPart = 0; /* FIXME */
>> -    dg->MediaType = 1; /* FIXME */
>> -    dg->TracksPerCylinder = 1; /* FIXME */
>> -    dg->SectorsPerTrack = 1; /* FIXME */
>> -    dg->BytesPerSector= 1; /* FIXME */
>> -#endif
>> -    return STATUS_NOT_SUPPORTED;
>> +  CDROM_TOC   toc;
>> +  DWORD ret = 0;
>> +  int fsize=0;
>> +
>> +  if ((ret = CDROM_ReadTOC(dev, &toc)) != 0) return ret;
>> +
>> +  fsize = FRAME_OF_TOC(toc, toc.LastTrack+1)
>> +        - FRAME_OF_TOC(toc, 1); /* Total size in frames */
>> +  +  dg->Cylinders.s.LowPart = fsize / (64 * 32); +  
>> dg->Cylinders.s.HighPart = 0; +  dg->MediaType = RemovableMedia;  +  
>> dg->TracksPerCylinder = 64; +  dg->SectorsPerTrack = 32;  +  
>> dg->BytesPerSector= 2048; +  return ret;
>>  }
>
> I wonder if the bytes per sector doesn't depend on the mode (XA, CDDA...)
>
>
>> +    tsz = sizeof(toc->FirstTrack) + sizeof(toc->LastTrack)
>> +       + sizeof(TRACK_DATA) * (hdr.cdth_trk1-hdr.cdth_trk0+2);
>> +    toc->Length[0] = tsz >> 8;
>> +    toc->Length[1] = tsz;
>
> this computation should also be used in the FreeBSD/NetBSD case (at 
> least initialize Length to some value)








More information about the wine-patches mailing list