* EJECT ioctl fails on empty SCSI CD-ROM @ 2000-11-15 17:59 W. Michael Petullo 2000-11-15 20:08 ` James Stevenson 0 siblings, 1 reply; 4+ messages in thread From: W. Michael Petullo @ 2000-11-15 17:59 UTC (permalink / raw) To: linux-kernel Apparently using the CDROMEJECT ioctl with kernel 2.4-testX fails on a SCSI CD-ROM that does not have a disc in it. The errno returned corresponds to the string ``No such file or directory.'' The Linux CD-ROM Standard states that CDROMEJECT opens the drive tray. It does not mention any prerequisite such as media being present. Is this the expected behavior? If so, I am curious to hear the rationale behind it. Thanks! -- W. Michael Petullo :wq - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: EJECT ioctl fails on empty SCSI CD-ROM 2000-11-15 17:59 EJECT ioctl fails on empty SCSI CD-ROM W. Michael Petullo @ 2000-11-15 20:08 ` James Stevenson 2000-11-15 20:15 ` Richard B. Johnson 0 siblings, 1 reply; 4+ messages in thread From: James Stevenson @ 2000-11-15 20:08 UTC (permalink / raw) To: mike; +Cc: linux-kernel Hi this is what i get on 2.2.17 open("/dev/scd1", O_RDONLY|O_NONBLOCK) = 3 ioctl(3, CDROMEJECT, 0xbffffc78) = 0 close(3) = 0 In local.linux-kernel-list, you wrote: >Apparently using the CDROMEJECT ioctl with kernel 2.4-testX fails on >a SCSI CD-ROM that does not have a disc in it. The errno returned >corresponds to the string ``No such file or directory.'' > >The Linux CD-ROM Standard states that CDROMEJECT opens the drive tray. >It does not mention any prerequisite such as media being present. > >Is this the expected behavior? If so, I am curious to hear the rationale >behind it. -- --------------------------------------------- Check Out: http://stev.org E-Mail: mistral@stev.org 8:00pm up 32 days, 7:56, 5 users, load average: 0.17, 0.53, 0.29 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: EJECT ioctl fails on empty SCSI CD-ROM 2000-11-15 20:08 ` James Stevenson @ 2000-11-15 20:15 ` Richard B. Johnson 2000-11-15 22:32 ` Richard B. Johnson 0 siblings, 1 reply; 4+ messages in thread From: Richard B. Johnson @ 2000-11-15 20:15 UTC (permalink / raw) To: James Stevenson; +Cc: mike, linux-kernel On Wed, 15 Nov 2000, James Stevenson wrote: > > Hi > > this is what i get on 2.2.17 > > open("/dev/scd1", O_RDONLY|O_NONBLOCK) = 3 > ioctl(3, CDROMEJECT, 0xbffffc78) = 0 > close(3) = 0 > > > > In local.linux-kernel-list, you wrote: > >Apparently using the CDROMEJECT ioctl with kernel 2.4-testX fails on > >a SCSI CD-ROM that does not have a disc in it. The errno returned > >corresponds to the string ``No such file or directory.'' > > > >The Linux CD-ROM Standard states that CDROMEJECT opens the drive tray. > >It does not mention any prerequisite such as media being present. > > > >Is this the expected behavior? If so, I am curious to hear the rationale > >behind it. > Well the open fails with ENOMEDIUM (errno 123). This is hardly appropriate since you can't insert any "media" on some machines without a paperclip. readlink("/dev/cdrom", "", 256) = 9 open("/dev/scd0", O_RDONLY) = -1 ERRNO_123 (errno 123) Cheers, Dick Johnson Penguin : Linux version 2.4.0 on an i686 machine (799.54 BogoMips). "Memory is like gasoline. You use it up when you are running. Of course you get it all back when you reboot..."; Actual explanation obtained from the Micro$oft help desk. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: EJECT ioctl fails on empty SCSI CD-ROM 2000-11-15 20:15 ` Richard B. Johnson @ 2000-11-15 22:32 ` Richard B. Johnson 0 siblings, 0 replies; 4+ messages in thread From: Richard B. Johnson @ 2000-11-15 22:32 UTC (permalink / raw) To: James Stevenson; +Cc: mike, linux-kernel On Wed, 15 Nov 2000, Richard B. Johnson wrote: > On Wed, 15 Nov 2000, James Stevenson wrote: > > > > > Hi > > > > this is what i get on 2.2.17 > > > > open("/dev/scd1", O_RDONLY|O_NONBLOCK) = 3 > > ioctl(3, CDROMEJECT, 0xbffffc78) = 0 > > close(3) = 0 > > > > > > > > > >Is this the expected behavior? If so, I am curious to hear the rationale > > >behind it. > > > > Well the open fails with ENOMEDIUM (errno 123). This is hardly appropriate > since you can't insert any "media" on some machines without a paperclip. > > readlink("/dev/cdrom", "", 256) = 9 > open("/dev/scd0", O_RDONLY) = -1 ERRNO_123 (errno 123) > Well, here is another 'eject'. #include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> #include <fcntl.h> #include <linux/cdrom.h> int main(int arg, char *argv[]) { int fd; if(((fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK)) > 0) || (arg > 1) && ((fd = open(argv[1], O_RDONLY|O_NONBLOCK)) > 0)) { if(ioctl(fd, CDROMEJECT, NULL)) /* If it failed */ { (void)ioctl(fd, CDROMRESET, NULL); /* Reset it */ (void)ioctl(fd, CDROMEJECT, NULL); } (void)close(fd); exit(EXIT_SUCCESS); } perror("open"); exit(EXIT_FAILURE); } If there is no media in the drive, it fails to eject (open the tray). open("/dev/cdrom", O_RDONLY|O_NONBLOCK) = 3 ioctl(3, CDROMEJECT, 0) = 671088642 -> error = 0 ioctl(3, 0x5312, 0) = 0 CDROMRESET ioctl(3, CDROMEJECT, 0) = 671088642 close(3) = 0 _exit(0) = ? I don't see an ioctl for CDROMOPENTRAY so I suppose CDROMEJECT is the correct ioctl. The last time I used CDROMEJECT, (Linux 2.2.17), it worked if there was no media. Cheers, Dick Johnson Penguin : Linux version 2.4.0 on an i686 machine (799.54 BogoMips). "Memory is like gasoline. You use it up when you are running. Of course you get it all back when you reboot..."; Actual explanation obtained from the Micro$oft help desk. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-11-15 23:03 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2000-11-15 17:59 EJECT ioctl fails on empty SCSI CD-ROM W. Michael Petullo 2000-11-15 20:08 ` James Stevenson 2000-11-15 20:15 ` Richard B. Johnson 2000-11-15 22:32 ` Richard B. Johnson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®