Re: VLC not ejecting CD/DVDs

2023-01-05 Thread Charles Curley
On Wed, 04 Jan 2023 09:34:38 +0100
"Thomas Schmitt"  wrote:

> > 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 ?

Yes.

charles@jhegaala:~$ eject -r /dev/sr0 ; echo $?
0
charles@jhegaala:~$


Given the rest of your comments, I'm inclined to file a bug report.

-- 
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/



Re: VLC not ejecting CD/DVDs

2023-01-04 Thread David Wright
On Tue 03 Jan 2023 at 21:22:00 (-0700), Charles Curley wrote:
> VLC is not ejecting CD/DVDs when I run it as my regular user, charles.
> I get the error message "qt interface error: could not eject /dev/sr0".
> I have not tried it as root. eject, however, does work when run by the
> same user.

In the past, I used cdtool's cdplay to play background music
(though more modern hardware seems to lack the necessary internal
analogue cable). If I tried to eject the disc with cdeject, I'd
get an I/O error and the drive's door would lock. Workaround:
I just aliased cdeject to eject, as the latter always worked.

I'm afraid I didn't try to track down the error.

Cheers,
David.



Re: VLC not ejecting CD/DVDs

2023-01-04 Thread Thomas Schmitt
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



VLC not ejecting CD/DVDs

2023-01-03 Thread Charles Curley
VLC is not ejecting CD/DVDs when I run it as my regular user, charles.
I get the error message "qt interface error: could not eject /dev/sr0".
I have not tried it as root. eject, however, does work when run by the
same user.

root@jhegaala:/dev# ll cdrom cdrw sr0
lrwxrwxrwx  1 root root  3 Jan  3 20:26 cdrom -> sr0
lrwxrwxrwx  1 root root  3 Jan  3 20:26 cdrw -> sr0
brw-rw+ 1 root cdrom 11, 0 Jan  3 20:26 sr0
root@jhegaala:/dev# grep cdrom /etc/group
cdrom:x:24:charles
root@jhegaala:/dev# 

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

However, the man page for eject says,

There are four different methods of ejecting, depending on whether
the device is a CD-ROM, SCSI device, removable floppy, or tape.
By default eject tries all four methods in order until it succeeds.

One of those four methods is via SCSI. When I specify that method,
eject ejects the CD/DVD.

charles@jhegaala:~$ eject -s /dev/sr0 
charles@jhegaala:~$ echo $?
0
charles@jhegaala:~$ 

Any thoughts?

-- 
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/