Reputation: 21
I am developing an application which supports a relatively low-level CD interface, and am trying to read data sectors from the CD.
Reading the TOC works just fine, and querying CD type reveals it is a Mode 1 data CD (for what it's worth, it has a filesystem which is mounted as /media/[username]/[cd label]
that I can browse in Thunar, so it doesn't appear to be corrupt)
Track 1 is listed as starting at MSF 0:2:0 (with the lead-out track starting at 8:47:49), so I try and issue a CDROMREADMODE1 as follows:
union {
struct cdrom_msf msf;
unsigned char buffer[CD_FRAMESIZE]; // 2048 bytes
} arg;
arg.msf.cdmsf_min0 = 0;
arg.msf.cdmsf_sec0 = 2;
arg.msf.cdmsf_frame0 = 0;
int result = ioctl(cd_handle, CDROMREADMODE1, &arg);
The resource I was reading indicated that only the start values in the cdrom_msf structure mattered, so I left the others unfilled.
However, the return value of this is always -1, with errno
set to EIO, and I really don't know what I'm doing wrong here.
I have tried googling for this, but unfortunately information on this seems to be relatively scarce so I'm kind of flying blind here. Any help would be appreciated.
EDIT: oh, interestingly a CDROMREADRAW ioctl succeeds. Is it possible this USB CD-ROM drive just does not support CDROMREADMODE1?
Upvotes: 1
Views: 53