[mythtv] Media monitoring few questions

Denys Dmytriyenko denis at denix.org
Sun Mar 7 22:21:29 EST 2004

Denys Dmytriyenko wrote:
> I've been playing with mythvideo to solve this problem for some time 
> now. Here are my findings:
> 1. It is possible just to have a symbolic link to your cdrom mounting 
> point in the directory your video files are. When videotree starts and 
> builds a tree of video files, it scans that directory and adds all files 
> on CD if it is mounted.
> 2. If you don't use supermount to mount your CDs, mythfrontend has to be 
> suid root. The reason is, that kernel cdrom driver only allows root to 
> unlock the tray, if it's mounted. That's why you cannot open the tray if 
> it is mounted. Doing "chmod +s mythfrontend" solves this. But it may be 
> a security risk to run it as root.
> 3. If you use supermount, it is possible to open/close the tray at any 
> time you want and a drive stays mounted all the time. Myth's media 
> monitor supports supermount with iso9660 filesystem only, but this is 
> not the problem. The real problem I've encountered is that it takes 34 
> seconds (!) to access /mnt/cdrom mount point if there is no disc in the 
> drive. Otherwise accessing /mnt/cdrom takes no time and reflects the 
> content of the current disc - i.e. no mount/umount necessary!
> If I'm able to resolve this issue with supermount, it only takes a 
> little modification to rebuild a videotree when new disc is inserted and 
> everything else is already taken care of!

Replying to myself. From supermount's FAQ:

Q: When I do ls -l /mnt it pauses for some time and LED on CD-ROM start 

A: Try sysctl -w dev.cdrom.autoclose=0. Apparently most CD-ROM drives do 
not distinguish between NO MEDIA and TRAY OPEN conditions and always 
return TRAY OPEN. In return cdrom driver tries to close tray that makes 
CD-ROM drive to check for media presence - and that is exactly what is 
causing those delays and unwanted drive activity. It was reported that 
some drives need very long time to give up. Setting autoclose to 0 makes 
cdrom driver to return immediately with ENOMEDIA.

Anyway, here is what I've done to make mythvideo play videos from CD-ROM 
(/media/video is where mythvideo looks for files):

# ln -s /mnt/cdrom /media/video
# sysctl -w dev.cdrom.autoclose=0
# grep supermount /etc/fstab
none /mnt/cdrom supermount fs=iso9660,dev=/dev/hdb,ro,user 0 0

Now, I can run mythfrontend as a normal user and be able to change CDs 
without mounting/unmounting them and when I enter videotree it scans for 
video files on a disc.

More information about the mythtv-dev mailing list