[lkml]   [2002]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectCDROM_SEND_PACKET and ide-cd

I'm working on a program that sends packets to cdrom devices. I'm using the
CDROM_SEND_PACKET ioctl() to do it. The problem is when I specify the buffer
length in cdrom_generic_command buflen field, all my ioctl calls are ends
with EIO. So I can issue command only that not use a buffer (TEST UNIT READY,
LOAD EJECT, etc) But this happens only with ide-cd, if I use the cdrom with
ide-scsi and the scsi CD-ROM driver, it works. Here's a test program:

int main() {

struct cdrom_generic_command cgc;
struct request_sense sense;
char result[0x2c];
int fd;

if ((fd=open("/dev/hdc",O_RDONLY | O_NONBLOCK))<0) {
perror("Error opening device");
memset(&cgc, 0, sizeof(cgc));
memset(&sense, 0, sizeof(sense));

cgc.buffer=(void*) &result;
cgc.buflen=0x2c; //when it's 0 it works, but no data transfer

cgc.cmd[0] = 0x12; // INQUIRY
cgc.cmd[4] = 0x2c;

if (!ioctl(fd,CDROM_SEND_PACKET,&cgc)) {
perror("Command ok\n");

fprintf(stderr,"Error: %s code=%d\n",strerror(errno),errno);
fprintf(stderr,"Sense error code: %02x key: %02x\n",


So, where's the error? I couldn't find any other program that uses this ioctl
(altough cd-writing programs should use it). The above test program fails
with EIO in the ioctl() call with ide-cd and works perfectly with ide-scsi
and scsi cd driver (of course I replace /dev/hdc with /dev/sr0). (Sorry if I
posted to the wrong list, but I didn't find better place)

Thanks for advance,
György Szombathelyi

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:28    [W:0.111 / U:0.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site