Commit b865e213 authored by Jakob Leben's avatar Jakob Leben

udev: improve disc type recognition for -R -RW and alikes

parent 58e693a2
...@@ -561,20 +561,29 @@ static char *disc_get_name (struct udev_device *dev) ...@@ -561,20 +561,29 @@ static char *disc_get_name (struct udev_device *dev)
static char *disc_get_cat (struct udev_device *dev) static char *disc_get_cat (struct udev_device *dev)
{ {
const char *val; const char *val;
const char *cat = "Unknown"; const char *name;
int i_val;
const char *cat = _("Unknown Type");
val = udev_device_get_property_value (dev, "ID_CDROM_MEDIA_CD"); struct udev_list_entry *prop_list
if (val && atoi (val)) = udev_device_get_properties_list_entry( dev );
cat = "CD";
val = udev_device_get_property_value (dev, "ID_CDROM_MEDIA_DVD"); udev_list_entry_foreach( prop_list, prop_list )
if (val && atoi (val)) {
cat = "DVD"; name = udev_list_entry_get_name ( prop_list );
val = udev_device_get_property_value (dev, "ID_CDROM_MEDIA_BD"); i_val = atoi( udev_list_entry_get_value ( prop_list ) );
if (val && atoi (val)) if( !i_val ) continue;
cat = "Blue-ray disc"; if( strncmp( name, "ID_CDROM_MEDIA_CD", strlen( "ID_CDROM_MEDIA_CD" ) ) )
val = udev_device_get_property_value (dev, "ID_CDROM_MEDIA_HDDVD"); cat = _("CD");
if (val && atoi (val)) else if( !strncmp( name, "ID_CDROM_MEDIA_DVD", strlen( "ID_CDROM_MEDIA_DVD" ) ) )
cat = "HD DVD"; cat = _("DVD");
else if( !strncmp( name, "ID_CDROM_MEDIA_BD", strlen( "ID_CDROM_MEDIA_BD" ) ) )
cat = _("Blu-Ray");
else if( !strncmp( name, "ID_CDROM_MEDIA_HDDVD", strlen( "ID_CDROM_MEDIA_HDDVD" ) ) )
cat = _("HD DVD");
}
free( prop_list );
return strdup (cat); return strdup (cat);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment