[vlc-commits] udev: probe all optical drives without state at start-up
Rémi Denis-Courmont
git at videolan.org
Sun May 5 07:50:32 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 5 08:49:21 2013 +0300| [b91ec5f14e12669fbbf0f4cb475647796b20f810] | committer: Rémi Denis-Courmont
udev: probe all optical drives without state at start-up
Unfortunately, this works only when starting up the SD, not when
inserting a disc afterwards.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b91ec5f14e12669fbbf0f4cb475647796b20f810
---
modules/services_discovery/udev.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/modules/services_discovery/udev.c b/modules/services_discovery/udev.c
index 1149217..736bdb6 100644
--- a/modules/services_discovery/udev.c
+++ b/modules/services_discovery/udev.c
@@ -523,6 +523,7 @@ int OpenALSA (vlc_object_t *obj)
/*** Discs support ***/
static char *disc_get_mrl (struct udev_device *dev)
{
+ const char *node = udev_device_get_devnode (dev);
const char *val;
val = udev_device_get_property_value (dev, "ID_CDROM");
@@ -530,7 +531,13 @@ static char *disc_get_mrl (struct udev_device *dev)
return NULL; /* Ignore non-optical block devices */
val = udev_device_get_property_value (dev, "ID_CDROM_MEDIA_STATE");
- if (val && !strcmp (val, "blank"))
+ if (val == NULL)
+ { /* Force probing of the disc in the drive if any. */
+ int fd = open (node, O_RDONLY);
+ close (fd);
+ return NULL;
+ }
+ if (!strcmp (val, "blank"))
return NULL; /* ignore empty drives and virgin recordable discs */
const char *scheme = NULL;
@@ -556,8 +563,7 @@ static char *disc_get_mrl (struct udev_device *dev)
if (scheme == NULL)
return NULL;
- val = udev_device_get_devnode (dev);
- return vlc_path2uri (val, scheme);
+ return vlc_path2uri (node, scheme);
}
static char *disc_get_name (struct udev_device *dev)
More information about the vlc-commits
mailing list