From 4575df30a94c94ab151b2ba1cb964f3e0037e4e6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 7 May 2009 02:07:35 +0200 Subject: if the ID_ATA_SMART_ACCESS udev env var is set for a device read the access method from it --- atasmart.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/atasmart.c b/atasmart.c index 0d71926..d11ab08 100644 --- a/atasmart.c +++ b/atasmart.c @@ -2275,6 +2275,7 @@ static int disk_find_type(SkDisk *d, dev_t devnum) { struct udev *udev; struct udev_device *dev = NULL, *usb; int r = -1; + const char *a; assert(d); @@ -2288,6 +2289,27 @@ static int disk_find_type(SkDisk *d, dev_t devnum) { goto finish; } + if ((a = udev_device_get_property_value(dev, "ID_ATA_SMART_ACCESS"))) { + unsigned u; + + for (u = 0; u < _SK_DISK_TYPE_MAX; u++) { + const char *t; + + if (!(t = disk_type_to_prefix_string(u))) + continue; + + if (!strcmp(a, t)) { + d->type = u; + r = 0; + goto finish; + } + } + + d->type = SK_DISK_TYPE_NONE; + r = 0; + goto finish; + } + if ((usb = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_device"))) { const char *product, *vendor; uint32_t pid, vid; -- cgit