This fixes problems with the devices where ID_SERIAL or
ID_WWN_WITH_EXTENSION is not set. For example, block devices from the
rts_pstor driver.
See https://bugzilla.redhat.com/show_bug.cgi?id=828492
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
static gchar *
check_for_vpd (GUdevDevice *device)
{
- gchar *ret;
+ gchar *ret = NULL;
const gchar *serial;
const gchar *wwn;
+ const gchar *path;
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE);
- ret = NULL;
-
- /* prefer WWN to serial */
+ /* order of preference: WWN, serial, path */
serial = g_udev_device_get_property (device, "ID_SERIAL");
wwn = g_udev_device_get_property (device, "ID_WWN_WITH_EXTENSION");
+ path = g_udev_device_get_property (device, "ID_PATH");
if (wwn != NULL && strlen (wwn) > 0)
{
ret = g_strdup (wwn);
{
ret = g_strdup (serial);
}
+ else if (path != NULL && strlen (path) > 0)
+ {
+ ret = g_strdup (path);
+ }
return ret;
}