Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
  • 1
  • 2
  • 3(current)
  • 4
  • 5
  • 7
Linux How to associate "Play disc" with the Blu-ray discs?
#31
Looks like udev can launch a script when a disc is inserted and Ive been tryng to get udev to mount the bd with the mount command as this works with the play disc menu option. Here is the rule I have so far although it isnt working:

Code:
SUBSYSTEM=="block", KERNEL=="sr0", ENV{ID_CDROM_MEDIA_BD}=="1", RUN+="/bin/mount -o ro,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,iocharset=utf8,umask=0077 /dev/sr0 /media/"

The run command works from the command line but doesnt work via the udev rule.. can anyone see what Im doing wrong in the above rule or know another way of doing this?
Reply
#32
After having another go at this Ive finally gotten somewhere. Adding the following line to /etc/udev/rules.d/70-persistent-cd.rules

Code:
SUBSYSTEM=="block", ENV{ID_CDROM_MEDIA_BD}=="1", ENV{ID_PATH}=="pci-0000:00:11.0-scsi-0:0:0:0", RUN+="/bin/mount -o ro,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,iocharset=utf8,umask=0077 /dev/sr0 /media/"

Mounts Blurays automatically and I can play them via the Play Disc menu option.

To find out your bd-rom's ID use the following
Code:
ls -l /dev/disk/by-path/

I tested some DVD's too and they all work fine, about half of the 6 Blurays I tested worked.

I dont use xbmcbuntu, but from the sounds of it, not being able to play unenceypted blurays from the main menu affects xbmcbuntu users, could someone who uses xbmcbuntu test this and see if it needs to be included as a fix?
Reply
#33
Hi teeedubb,
I just tried to replace my rule:
Code:
# SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-1:0:0:0", ENV{ID_FS_TYPE}=="udf", SYMLINK+="bd1", ENV{GENERATED}="1", ENV{ID_FS_LA
BEL_ENC}="bd-dvd"
with yours:
Code:
SUBSYSTEM==\"block\", ENV{ID_CDROM_MEDIA_BD}==\"1\", ENV{ID_PATH}==\"pci-0000:00:1f.2-scsi-1:0:0:0\", RUN+=\"/bin/mount -o ro,nosuid,nodev,uhelper=udisks,uid=1000
,gid=1000,iocharset=utf8,umask=0077 /dev/sr0 /media/\"

From what I can see now, the blu-ray discs are now mounted under /media/<DISC_ID> (e.g. /media/PRESUME_COUPABLE ), instead of /media/bd-dvd with my rule.
Under XBMCbuntu Eden (updated to XBMC Frodo RC3 using stable PPA), I am still unable to use the "Play disc" button with these discs.
When I insert a blu-ray disc, I get a popup window asking "browse videos, browse music, browse pictures, browse files". I close it and then I cannot use the "Play disc" button: it just does nothing.
In the xbmc.log file, I can see these related lines:
Code:
18:13:47 T:2988059504    INFO: Detecting DVD-ROM media filesystem...
18:13:47 T:2988059504   ERROR: Detection of DVD-ROM media failed.

Anyway, I can still manually select the /media/<DISC_ID>/BDMV/index.bdmv from the Videos section by browsing the files. However, it is not convenient because the DISC_ID changes for every disc.
So for the moment I will keep my rule with the /media/bd-dvd/BDMB/index.bdmv shortcut.
Reply
#34
This is really wierd... First off Im running a minimal ubuntu 12.04 with xbmc 12 RC3 ontop with confulence skin (what version of ubuntu are you running? uname -a to find out) . I just tried again with my rule and blurays are definitely being played from the 'Play disc' menu option. ( I tried after a fresh boot and after ejecting a disc). But what s strange is that for me it mounts to /media, not /media/DISC_ID. I could have sworn that they were mounting to /media/DISC_ID when I was mucking about with it last time and you say it mounts to /media/DISC_ID for you. When I insert the disk I get a popup saying 'DISC_ID has been mounted'.
Having the disc mounted to /media would block other mount points in /media so Ive changed my udev rule to mount blurays to /media/br. I tried mucking about with udev to have it mount to /media/DISC_ID but I didnt get anywhere and since mounting to /media/br work well Im going to leave it as is...

Spontex I dont know where you could look to see what your problem is.. Do DVD's play from the 'Play disc" menu option? This is really strange... from the looks of it both our rules achieve the same end result (mounting a bluray to /media/*), but my rule has different outcomes on both our systems (mounting to /media/DISC_ID).

You could try disabling the udev rule and trying to mount the bluray via cli to see if that works..
Reply
#35
Hi,
XBMCbuntu Eden is based on Ubuntu 11.10:
Code:
spontex@pchc:~$ uname -a
Linux pchc 3.0.0-29-generic-pae #46-Ubuntu SMP Tue Dec 4 12:38:10 UTC 2012 i686 i686 i386 GNU/Linux
Our udev version is perhaps different, but the result seems to be the same since we both achieve to mount Blu-rays in /media/<fixed_point>.
Then the difference is inside the "Play disc" button behaviour: DVDs play fine but for Blu-rays I had to create a sub-item (using Transparency skin) pointing to index.bdmv while you managed to use the standard button. It is perhaps related to our Ubuntu version. I will install XBMCbuntu Frodo when it is out.
Reply
#36
(2013-01-04, 07:57)teeedubb Wrote: After having another go at this Ive finally gotten somewhere. Adding the following line to /etc/udev/rules.d/70-persistent-cd.rules

Code:
SUBSYSTEM=="block", ENV{ID_CDROM_MEDIA_BD}=="1", ENV{ID_PATH}=="pci-0000:00:11.0-scsi-0:0:0:0", RUN+="/bin/mount -o ro,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,iocharset=utf8,umask=0077 /dev/sr0 /media/"

Tried this on a gentoo and works like a charm. Only things I changed (except for the mount path and /dev path) is the ENV{ID_PATH} : I deleted it completely as I've got only one BR drive. But I can't eject from XBMC, I have to do it manually.

Thanks for the tip teeedubb
Reply
#37
.....
Reply
#38
Spontex try this rule. None of the previous rules would work for me in Openelec and using one of the rules included in openelec as a template I was able to get reliable bluray mounting.

cdrom.rules
Code:
ACTION!="add|change", GOTO="cdrom_end"
KERNEL=="sr*", RUN+="/usr/bin/udisks --mount /dev/sr*"
LABEL="cdrom_end"

Make sure to not include a number in the filename - the rule will be run last overriding other rules.
Reply
#39
Hi teeedubb,
Today I installed a vanilla XBMCBuntu Frodo using the ISO.
It does not play the blu-rays from scratch. After installing libaacs0 and libbluray1, the play disc menu in XBMC does not work.
I tried your last rule inside 70-persistent-cd.rules (I do not have any cdrom.rules):
Code:
ACTION!="add|change", GOTO="cdrom_end"
KERNEL=="sr*", RUN+="/usr/bin/udisks --mount /dev/sr0"
LABEL="cdrom_end"
but it did not help.

Instead, I tried again your previous rule:
Code:
SUBSYSTEM=="block", ENV{ID_CDROM_MEDIA_BD}=="1", ENV{ID_PATH}=="pci-0000:00:11.0-scsi-0:0:0:0", RUN+="/bin/mount -o ro,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,iocharset=utf8,umask=0077 /dev/sr0 /media/"

Now the Blu-ray discs are mounted fine. But I still cannot use the "Play disc" button. I have to manually look for the index.bdmv file. So I will have to set up my "Transparency skin" trick again...
Reply
#40
Strange... surely this has nothing to do with hardware. What happens when you run the udisks command from my last rule in a terminal with a bluray inserted? I've only tested the last one in openelec so it may need to be changed for Ubuntu. (Since that post I've changed /usr/bin/udisks --mount /dev/sr0 to /usr/bin/udisks --mount /dev/sr*)

I've posted in this thread

https://github.com/OpenELEC/OpenELEC.tv/issues/456

And from there it seems like this was a bug in xbmc that has since been fixed, but I was having the exact same problems as the op.
Reply
#41
Hi teeedubb,
I just inserted a Blu-ray disc and typed the following commands:

Code:
spontex@pchc:~$ /usr/bin/udisks --mount /dev/sr0
Mount failed: /dev/sr0 is mounted
spontex@pchc:~$ umount /dev/sr0
spontex@pchc:~$ /usr/bin/udisks --mount /dev/sr0
Mounted /org/freedesktop/UDisks/devices/sr0 at /media/KIRIKOU ET LA SORCIERE

My Blu-ray disc was mounted. XBMC displayed a popup showing that it noticed the new volume. But it did not add any "Play disc" button to the main menu, which it does when I insert a DVD.
I went to "Videos" and displayed the contextual menu of the disc. Among other options, I was proposed "Play" and "Play disc". "Play disc" did not work, but "Play" ran the movie.

In xbmc.log, I noticed:

Code:
08:08:03 T:3007940416  NOTICE: start dvd mediatype detection
08:08:03 T:3007940416  NOTICE: initializing playlistplayer
08:08:03 T:3007940416  NOTICE: DONE initializing playlistplayer
08:08:03 T:2986838848  NOTICE: Thread CDetectDVDMedia start, auto delete: false
08:08:03 T:2986838848   ERROR: Detection of DVD-ROM media failed.
Reply
#42
Not sure what going on here, if I got the 'mount failed' message you got above I could play the discs from the main menu as it has been mounted. If i got the popup in xbmc the disc would play.

You could try make a udev rule to automatically mount then play the disk using the jsonrpc command I posted earlier. Also maybe try openelec?

Im out of ideas and I think the problem is within xbmc but Im not sure, but this thread makes me think it is

http://forum.xbmc.org/showthread.php?tid=156764
Reply
#43
@teeedubb

That rule doesnt really do anything in Ubuntu minimal.

Code:
ACTION!="add|change", GOTO="cdrom_end"
KERNEL=="sr*", RUN+="/usr/bin/udisks --mount /dev/sr0"
LABEL="cdrom_end"

Im not familiar with udev rules but to mount from boot with media inserted

Code:
KERNEL!="sr[0-9]*", GOTO="disc_by_label_auto_mount_end"

# Get label
ACTION=="add", PROGRAM=="/sbin/blkid -o value -s LABEL %E{device}", ENV{dir_name}="%c"

ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'", RUN+="/bin/mount -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"
ACTION=="add", RUN+="/bin/ln -s /media/%E{dir_name} /media/disc"
ACTION=="remove", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"

# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"

# Get a label if present, otherwise specify one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="%k"

# Mount the device
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount /dev/%k /media/%E{dir_name}"
ACTION=="add", RUN+="/bin/ln -s /media/%E{dir_name} /media/disc"

# Clean up after removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/unmout -l /media/disc", RUN+="/bin/rmdir /media/disc}"

# Exit
LABEL="disc_by_label_auto_mount_end"

that above looks complicated but when a disk is inserted (when machine is rebooted) the media is mounted if I remove that and insert yours or add yours as extra rule nothing changes, except when disks are attached on boot they dont mount anymore if the rule I pasted is removed.

Playdisk always shows up with or without any extra rules, mind I dont have bluray anyway.
the problem is when eject and insert other media nothing happens.

uNi
Reply
#44
Hey uni,

Last night I put in a bluray and experienced the same issue - the only thing that has changed is I upgraded fron openelec 2.99.2 to 2.99.3 which I believe is xbmc 12 to xbmc 12.1. I'll downgrade when I get the chance to see if it was the update.

When I issued the udisks command after inserting the disk the disk mounts as it should which leads me to believe the udev rule isn't being run at all... really strange as it was rock solid before.... surely udev rules cannot be so finnicky...
Reply
#45
Ok it seem like udisks doesnt like to be executed from a udev rule, from the looks of it the udisks command wasnt being run at all.

Changing my rule to

Code:
ACTION!="add|change", GOTO="cdrom_end"
KERNEL=="sr*", RUN+="/bin/mount /dev/sr0 /media/bdrom/"
LABEL="cdrom_end"

Is giving me reliable mounting (5 times in a row, but this happened to me with more tries when using the udisks rule) and I know the rule is being run because the disk is being mounted elsewhere, but it is not without some strangeness - it being mounted to /media/disk instead of /media/bdrom. I dont know whats going on there....
Reply
  • 1
  • 2
  • 3(current)
  • 4
  • 5
  • 7

Logout Mark Read Team Forum Stats Members Help
How to associate "Play disc" with the Blu-ray discs?2
This forum uses Lukasz Tkacz MyBB addons.