[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: VLC not ejecting CD/DVDs



Hi,

Charles Curley wrote:
> If I read the source for VLC correctly, VLC uses a SCSI ioctl to attempt to
> eject.
> https://github.com/videolan/vlc/blob/master/modules/gui/eject.c

Yes. EjectSCSI() in line 67 does what a burn program would do for
ejecting an optical medium. But the ioctl SCSI_IOCTL_SEND_COMMAND is the
dull way to perform an SCSI transaction. If the drive does not like the
command, then the caller of this ioctl gets no specific error indication.

(I wonder about the middle ioctl SCSI_IOCTL_SEND_COMMAND which tells the
drive to speed up. The third ioctl then tells it to slow down and to
eject the tray.)
(The call of  ioctl( i_fd, BLKRRPART )  will do nothing with /dev/sr.
Regrettably Linux does not offer an ioctl to re-assess optical media.)

The message "could not eject" seems to come from a combined attempt in
line 163 with  ioctl( fd, CDROMEJECT, 0 )  and above SCSI gesture.
The ioctl CDROMEJECT will in the kernel cause similar SCSI commands as
EjectSCSI() emits.


> One of those four methods is via SCSI. When I specify that method,
> eject ejects the CD/DVD.
> charles@jhegaala:~$ eject -s /dev/sr0

Does
  eject -r /dev/sr0
work too ?


> Any thoughts?

One would have to modify the code to learn which errno comes back from
the ioctls when one of them fails. I.e.:
Line 163:
  Separate the call of ioctl( fd, CDROMEJECT, 0 ) from the call of
  EjectSCSI( fd ) and print the errno value after each of them.
Lines 85, 96, 107:
  Print the failed SCSI command name ("ALLOW_MEDIA_REMOVAL", "START",
  or "STOP_EJECT") and the  errno value before returning VLC_EGENERIC.

If one of the ioctls SCSI_IOCTL_SEND_COMMAND indicates failure, then
one would have to replace it by ioctl(SG_IO) with its more elaborate
 struct sg_io_hdr_t , which would return the SCSI error code triple.
I could make proposals how to do that.But this will be no picknick.


Have a nice day :)

Thomas


Reply to: