rework how SMART is done; express it in properties and export attributes
authorDavid Zeuthen <davidz@redhat.com>
Sat, 3 May 2008 21:16:09 +0000 (17:16 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Sat, 3 May 2008 21:16:09 +0000 (17:16 -0400)
Also add some test files from the smartmontools project and provide a
new simulate= option. This is very useful for testing clients
consuming this data. See test/smart/README for details.

29 files changed:
src/devkit-disks-device-private.h
src/devkit-disks-device.c
src/devkit-disks-device.h
src/org.freedesktop.DeviceKit.Disks.Device.xml
test/smart/FUJITSU1.txt [new file with mode: 0644]
test/smart/FUJITSU_MHR2020AT.txt [new file with mode: 0644]
test/smart/HITACHI_DK23AA-12B.txt [new file with mode: 0644]
test/smart/HITACHI_DK23BA-20-0.txt [new file with mode: 0644]
test/smart/IC35L120AVV207-0.txt [new file with mode: 0644]
test/smart/IC35L120AVV207-1.txt [new file with mode: 0644]
test/smart/IC35L120AVVA07-0-0.txt [new file with mode: 0644]
test/smart/IC35L120AVVA07-0-1.txt [new file with mode: 0644]
test/smart/MAXTOR-0.txt [new file with mode: 0644]
test/smart/MAXTOR-1.txt [new file with mode: 0644]
test/smart/MAXTOR-10.txt [new file with mode: 0644]
test/smart/MAXTOR-2.txt [new file with mode: 0644]
test/smart/MAXTOR-3.txt [new file with mode: 0644]
test/smart/MAXTOR-4.txt [new file with mode: 0644]
test/smart/MAXTOR-6.txt [new file with mode: 0644]
test/smart/MAXTOR-7.txt [new file with mode: 0644]
test/smart/MAXTOR-8.txt [new file with mode: 0644]
test/smart/MAXTOR-9.txt [new file with mode: 0644]
test/smart/Maxtor-5.txt [new file with mode: 0644]
test/smart/README [new file with mode: 0644]
test/smart/ST910021AS.txt [new file with mode: 0644]
test/smart/TOSHIBA-0.txt [new file with mode: 0644]
test/smart/TOSHIBA-MK6021GAS.txt [new file with mode: 0644]
test/smart/WD2500JB.txt [new file with mode: 0644]
tools/devkit-disks.c

index 9418da4..cafba43 100644 (file)
@@ -127,6 +127,16 @@ struct DevkitDisksDevicePrivate
                 GPtrArray *slaves_objpath;
                 GPtrArray *holders_objpath;
         } info;
+
+        /* We want S.M.A.R.T. to persist over change events */
+        gboolean drive_smart_is_capable;
+        gboolean drive_smart_is_enabled;
+        guint64 drive_smart_time_collected;
+        gboolean drive_smart_is_failing;
+        double drive_smart_temperature;
+        guint64 drive_smart_time_powered_on;
+        char *drive_smart_last_self_test_result;
+        GPtrArray *drive_smart_attributes;
 };
 
 
index accb8c2..97d833a 100644 (file)
@@ -174,6 +174,15 @@ enum
         PROP_DRIVE_MEDIA_COMPATIBILITY,
         PROP_DRIVE_MEDIA,
 
+        PROP_DRIVE_SMART_IS_CAPABLE,
+        PROP_DRIVE_SMART_IS_ENABLED,
+        PROP_DRIVE_SMART_TIME_COLLECTED,
+        PROP_DRIVE_SMART_IS_FAILING,
+        PROP_DRIVE_SMART_TEMPERATURE,
+        PROP_DRIVE_SMART_TIME_POWERED_ON,
+        PROP_DRIVE_SMART_LAST_SELF_TEST_RESULT,
+        PROP_DRIVE_SMART_ATTRIBUTES,
+
         PROP_LINUX_MD_COMPONENT_LEVEL,
         PROP_LINUX_MD_COMPONENT_NUM_RAID_DEVICES,
         PROP_LINUX_MD_COMPONENT_UUID,
@@ -465,6 +474,31 @@ get_property (GObject         *object,
                g_value_set_string (value, device->priv->info.drive_media);
                break;
 
+       case PROP_DRIVE_SMART_IS_CAPABLE:
+               g_value_set_boolean (value, device->priv->drive_smart_is_capable);
+               break;
+       case PROP_DRIVE_SMART_IS_ENABLED:
+               g_value_set_boolean (value, device->priv->drive_smart_is_enabled);
+               break;
+       case PROP_DRIVE_SMART_TIME_COLLECTED:
+               g_value_set_uint64 (value, device->priv->drive_smart_time_collected);
+               break;
+       case PROP_DRIVE_SMART_IS_FAILING:
+               g_value_set_boolean (value, device->priv->drive_smart_is_failing);
+               break;
+       case PROP_DRIVE_SMART_TEMPERATURE:
+               g_value_set_double (value, device->priv->drive_smart_temperature);
+               break;
+       case PROP_DRIVE_SMART_TIME_POWERED_ON:
+               g_value_set_uint64 (value, device->priv->drive_smart_time_powered_on);
+               break;
+       case PROP_DRIVE_SMART_LAST_SELF_TEST_RESULT:
+               g_value_set_string (value, device->priv->drive_smart_last_self_test_result);
+               break;
+       case PROP_DRIVE_SMART_ATTRIBUTES:
+               g_value_set_boxed (value, device->priv->drive_smart_attributes);
+               break;
+
        case PROP_LINUX_MD_COMPONENT_LEVEL:
                g_value_set_string (value, device->priv->info.linux_md_component_level);
                break;
@@ -521,6 +555,16 @@ get_property (GObject         *object,
         }
 }
 
+#define SMART_DATA_STRUCT_TYPE (dbus_g_type_get_struct ("GValueArray",   \
+                                                        G_TYPE_INT,      \
+                                                        G_TYPE_STRING,   \
+                                                        G_TYPE_INT,      \
+                                                        G_TYPE_INT,      \
+                                                        G_TYPE_INT,      \
+                                                        G_TYPE_INT,      \
+                                                        G_TYPE_STRING,   \
+                                                        G_TYPE_INVALID))
+
 static void
 devkit_disks_device_class_init (DevkitDisksDeviceClass *klass)
 {
@@ -795,6 +839,40 @@ devkit_disks_device_class_init (DevkitDisksDeviceClass *klass)
                 PROP_DRIVE_MEDIA,
                 g_param_spec_string ("drive-media", NULL, NULL, NULL, G_PARAM_READABLE));
 
+        g_object_class_install_property (
+                object_class,
+                PROP_DRIVE_SMART_IS_CAPABLE,
+                g_param_spec_boolean ("drive-smart-is-capable", NULL, NULL, FALSE, G_PARAM_READABLE));
+        g_object_class_install_property (
+                object_class,
+                PROP_DRIVE_SMART_IS_ENABLED,
+                g_param_spec_boolean ("drive-smart-is-enabled", NULL, NULL, FALSE, G_PARAM_READABLE));
+        g_object_class_install_property (
+                object_class,
+                PROP_DRIVE_SMART_TIME_COLLECTED,
+                g_param_spec_uint64 ("drive-smart-time-collected", NULL, NULL, 0, G_MAXUINT64, 0, G_PARAM_READABLE));
+        g_object_class_install_property (
+                object_class,
+                PROP_DRIVE_SMART_IS_FAILING,
+                g_param_spec_boolean ("drive-smart-is-failing", NULL, NULL, FALSE, G_PARAM_READABLE));
+        g_object_class_install_property (
+                object_class,
+                PROP_DRIVE_SMART_TEMPERATURE,
+                g_param_spec_double ("drive-smart-temperature", NULL, NULL, -G_MAXDOUBLE, G_MAXDOUBLE, 0, G_PARAM_READABLE));
+        g_object_class_install_property (
+                object_class,
+                PROP_DRIVE_SMART_TIME_POWERED_ON,
+                g_param_spec_uint64 ("drive-smart-time-powered-on", NULL, NULL, 0, G_MAXUINT64, 0, G_PARAM_READABLE));
+        g_object_class_install_property (
+                object_class,
+                PROP_DRIVE_SMART_LAST_SELF_TEST_RESULT,
+                g_param_spec_string ("drive-smart-last-self-test-result", NULL, NULL, NULL, G_PARAM_READABLE));
+        g_object_class_install_property (
+                object_class,
+                PROP_DRIVE_SMART_ATTRIBUTES,
+                g_param_spec_boxed ("drive-smart-attributes", NULL, NULL,
+                                    dbus_g_type_get_collection ("GPtrArray", SMART_DATA_STRUCT_TYPE),
+                                    G_PARAM_READABLE));
 
         g_object_class_install_property (
                 object_class,
@@ -880,6 +958,7 @@ devkit_disks_device_init (DevkitDisksDevice *device)
 {
         device->priv = DEVKIT_DISKS_DEVICE_GET_PRIVATE (device);
         init_info (device);
+        device->priv->drive_smart_attributes = g_ptr_array_new ();
 }
 
 static void
@@ -901,6 +980,10 @@ devkit_disks_device_finalize (GObject *object)
 
         free_info (device);
 
+        g_free (device->priv->drive_smart_last_self_test_result);
+        g_ptr_array_foreach (device->priv->drive_smart_attributes, (GFunc) g_value_array_free, NULL);
+        g_ptr_array_free (device->priv->drive_smart_attributes, TRUE);
+
         if (device->priv->linux_md_poll_timeout_id > 0)
                 g_source_remove (device->priv->linux_md_poll_timeout_id);
 
@@ -1910,6 +1993,28 @@ update_info (DevkitDisksDevice *device)
         if (device->priv->info.device_is_drive)
                 update_drive_properties (device);
 
+        /* Update whether device is S.M.A.R.T. capable
+         *
+         * TODO: need to check that it's hard disk and not e.g. an optical drive
+         *
+         * TODO: need to honor a quirk for certain USB drives being smart capable, cf.
+         *
+         *         Thanks to contributor Matthieu Castet, smartctl has
+         *         a new option '-d usbcypress'. So you can address
+         *         USB devices with cypress chips. The chipset
+         *         contains an ATACB proprietary pass through for ATA
+         *         commands passed through SCSI commands. Get current
+         *         version from CVS.
+         *
+         *       from http://smartmontools.sourceforge.net/
+         */
+        if (device->priv->info.drive_connection_interface != NULL) {
+                if (g_str_has_prefix (device->priv->info.drive_connection_interface, "ata") ||
+                    g_str_has_prefix (device->priv->info.drive_connection_interface, "scsi")) {
+                        device->priv->drive_smart_is_capable = TRUE;
+                }
+        }
+
         ret = TRUE;
 
 out:
@@ -5167,16 +5272,36 @@ out:
 
 /*--------------------------------------------------------------------------------------------------------------*/
 
+typedef struct {
+        gboolean simulation;
+} DriveRefreshSmartDataData;
+
+static DriveRefreshSmartDataData *
+drive_smart_refresh_data_data_new (gboolean simulation)
+{
+        DriveRefreshSmartDataData *data;
+        data = g_new0 (DriveRefreshSmartDataData, 1);
+        data->simulation = simulation;
+        return data;
+}
+
 static void
-smart_retrieve_data_completed_cb (DBusGMethodInvocation *context,
-                                  DevkitDisksDevice *device,
-                                  PolKitCaller *pk_caller,
-                                  gboolean job_was_cancelled,
-                                  int status,
-                                  const char *stderr,
-                                  const char *stdout,
-                                  gpointer user_data)
+drive_smart_refresh_data_unref (DriveRefreshSmartDataData *data)
 {
+        g_free (data);
+}
+
+static void
+drive_smart_refresh_data_completed_cb (DBusGMethodInvocation *context,
+                                       DevkitDisksDevice *device,
+                                       PolKitCaller *pk_caller,
+                                       gboolean job_was_cancelled,
+                                       int status,
+                                       const char *stderr,
+                                       const char *stdout,
+                                       gpointer user_data)
+{
+        DriveRefreshSmartDataData *data = user_data;
         int rc;
         gboolean passed;
         int n;
@@ -5185,6 +5310,8 @@ smart_retrieve_data_completed_cb (DBusGMethodInvocation *context,
         int power_on_hours;
         int temperature;
         const char *last_self_test_result;
+        GTimeVal now;
+        gboolean attributes_has_upd;
 
         if (job_was_cancelled || stdout == NULL) {
                 if (job_was_cancelled) {
@@ -5203,23 +5330,43 @@ smart_retrieve_data_completed_cb (DBusGMethodInvocation *context,
         rc = WEXITSTATUS (status);
 
         if ((rc & (0x01|0x02|0x04)) != 0) {
+                /* update our setting if we "thought" (cf. update_info()) that this device
+                 * was S.M.A.R.T. capable
+                 */
+                if (device->priv->drive_smart_is_capable) {
+                        device->priv->drive_smart_is_capable = FALSE;
+                        emit_changed (device);
+                }
                 throw_error (context,
                              DEVKIT_DISKS_DEVICE_ERROR_NOT_SMART_CAPABLE,
                              "Device is not S.M.A.R.T. capable");
                 goto out;
         }
 
+        /* TODO: is_enabled */
+        device->priv->drive_smart_is_enabled = TRUE;
+
+        g_get_current_time (&now);
+        device->priv->drive_smart_time_collected = now.tv_sec;
+
+        g_ptr_array_foreach (device->priv->drive_smart_attributes, (GFunc) g_value_array_free, NULL);
+        g_ptr_array_free (device->priv->drive_smart_attributes, TRUE);
+        device->priv->drive_smart_attributes = g_ptr_array_new ();
+
         passed = TRUE;
         power_on_hours = 0;
         temperature = 0;
         last_self_test_result = "";
 
-        if ((rc & 0x08) != 0)
+        if ((rc & 0x08) != 0) {
                 passed = FALSE;
+                device->priv->drive_smart_is_failing = TRUE;
+        }
 
         lines = g_strsplit (stdout, "\n", 0);
 
         in_attributes = FALSE;
+        attributes_has_upd = FALSE;
         for (n = 0; lines[n] != NULL; n++) {
                 const char *line = (const char *) lines[n];
                 int id;
@@ -5231,8 +5378,10 @@ smart_retrieve_data_completed_cb (DBusGMethodInvocation *context,
                 char type[256];
                 char updated[256];
                 char when_failed[256];
+                char raw_string_value[256];
                 int raw_value;
                 int self_test_execution_status;
+                gboolean parsed_attr;
 
                 /* We're looking at parsing this block of the output
                  *
@@ -5256,8 +5405,19 @@ smart_retrieve_data_completed_cb (DBusGMethodInvocation *context,
                  *
                  */
 
+                if (data->simulation) {
+                        if (strstr (line, "self-assessment test result") != NULL) {
+                                if (strstr (line, "PASSED") != NULL)
+                                        passed = TRUE;
+                                else
+                                        passed = FALSE;
+                        }
+                }
+
                 if (g_str_has_prefix (line, "ID# ATTRIBUTE_NAME ")) {
                         in_attributes = TRUE;
+                        if (strstr (line, "UPDATED") != NULL)
+                                attributes_has_upd = TRUE;
                         continue;
                 }
 
@@ -5303,6 +5463,8 @@ smart_retrieve_data_completed_cb (DBusGMethodInvocation *context,
                                         last_self_test_result = "unknown";
                                         break;
                                 }
+                                g_free (device->priv->drive_smart_last_self_test_result);
+                                device->priv->drive_smart_last_self_test_result = g_strdup (last_self_test_result);
 
                         }
                         continue;
@@ -5312,45 +5474,85 @@ smart_retrieve_data_completed_cb (DBusGMethodInvocation *context,
                         break;
                 }
 
-                if (sscanf (line, "%d %s 0x%x %d %d %d %s %s %s %d",
-                            &id, name, &flags, &value, &worst, &threshold,
-                            type, updated, when_failed, &raw_value) == 10) {
-#if 0
-                        g_printerr ("           id=%d\n", id);
-                        g_printerr ("         name='%s'\n", name);
-                        g_printerr ("        flags=0x%x\n", flags);
-                        g_printerr ("        value=%d\n", value);
-                        g_printerr ("        worst=%d\n", worst);
-                        g_printerr ("    threshold=%d\n", threshold);
-                        g_printerr ("         type='%s'\n", type);
-                        g_printerr ("      updated='%s'\n", updated);
-                        g_printerr ("  when_failed='%s'\n", when_failed);
-                        g_printerr ("    raw_value=%d\n", raw_value);
-#endif
+                parsed_attr = FALSE;
+                memset (raw_string_value, '\0', sizeof raw_string_value);
+                if (attributes_has_upd) {
+                        parsed_attr = sscanf (line, "%d %s 0x%x %d %d %d %s %s %s %255c",
+                                              &id, name, &flags, &value, &worst, &threshold,
+                                              type, updated, when_failed, raw_string_value) == 10;
+                } else {
+                        parsed_attr = sscanf (line, "%d %s 0x%x %d %d %d %s %s %255c",
+                                              &id, name, &flags, &value, &worst, &threshold,
+                                              type, when_failed, raw_string_value) == 9;
+                }
+
+                if (parsed_attr) {
+                        /*
+                        g_printerr ("                id=%d\n", id);
+                        g_printerr ("              name='%s'\n", name);
+                        g_printerr ("             flags=0x%x\n", flags);
+                        g_printerr ("             value=%d\n", value);
+                        g_printerr ("             worst=%d\n", worst);
+                        g_printerr ("         threshold=%d\n", threshold);
+                        g_printerr ("              type='%s'\n", type);
+                        g_printerr ("           updated='%s'\n", updated);
+                        g_printerr ("       when_failed='%s'\n", when_failed);
+                        g_printerr ("  raw_string_value='%s'\n", raw_string_value);
+                        */
+
+                        if (sscanf (raw_string_value, "%d", &raw_value) == 1) {
+                                if (id == 9) {
+                                        power_on_hours = raw_value;
+                                        device->priv->drive_smart_time_powered_on = raw_value * 3600;
+                                } else if (id == 194) {
+                                        temperature = raw_value;
+                                        device->priv->drive_smart_temperature = raw_value;
+                                }
+                        }
 
-                        if (id == 9) {
-                                power_on_hours = raw_value;
-                        } else if (id == 194) {
-                                temperature = raw_value;
+                        if (id == 197) {
                         }
+
+                        GValue elem = {0};
+                        g_value_init (&elem, SMART_DATA_STRUCT_TYPE);
+                        g_value_take_boxed (&elem, dbus_g_type_specialized_construct (SMART_DATA_STRUCT_TYPE));
+                        dbus_g_type_struct_set (&elem,
+                                                0, id,
+                                                1, name,
+                                                2, flags,
+                                                3, value,
+                                                4, worst,
+                                                5, threshold,
+                                                6, raw_string_value,
+                                                G_MAXUINT);
+                        g_ptr_array_add (device->priv->drive_smart_attributes, g_value_get_boxed (&elem));
+
                 }
 
         }
         g_strfreev (lines);
 
+        device->priv->drive_smart_is_failing = !passed;
+
+        /* emit change event since we've updated the smart data */
+        emit_changed (device);
+
         dbus_g_method_return (context, passed, power_on_hours, temperature, last_self_test_result);
 out:
         ;
 }
 
 gboolean
-devkit_disks_device_smart_retrieve_data (DevkitDisksDevice     *device,
-                                         DBusGMethodInvocation *context)
+devkit_disks_device_drive_smart_refresh_data (DevkitDisksDevice     *device,
+                                              char                 **options,
+                                              DBusGMethodInvocation *context)
 {
         int n;
         char *argv[10];
         GError *error;
         PolKitCaller *pk_caller;
+        const char *simulpath;
+        gboolean nowakeup;
 
         if ((pk_caller = devkit_disks_damon_local_get_caller_for_context (device->priv->daemon, context)) == NULL)
                 goto out;
@@ -5361,6 +5563,13 @@ devkit_disks_device_smart_retrieve_data (DevkitDisksDevice     *device,
                 goto out;
         }
 
+        if (!device->priv->drive_smart_is_capable) {
+                throw_error (context,
+                             DEVKIT_DISKS_DEVICE_ERROR_NOT_SMART_CAPABLE,
+                             "Device is not S.M.A.R.T. capable");
+                goto out;
+        }
+
 #if 0
         if (!devkit_disks_damon_local_check_auth (device->priv->daemon,
                                                   pk_caller,
@@ -5371,23 +5580,48 @@ devkit_disks_device_smart_retrieve_data (DevkitDisksDevice     *device,
         }
 #endif
 
-        n = 0;
-        argv[n++] = "smartctl";
-        argv[n++] = "--all";
-        argv[n++] = device->priv->info.device_file;
-        argv[n++] = NULL;
+        simulpath = NULL;
+        nowakeup = FALSE;
+        for (n = 0; options[n] != NULL; n++) {
+                if (g_str_has_prefix (options[n], "simulate=")) {
+                        uid_t uid;
+                        if (!polkit_caller_get_uid (pk_caller, &uid) || uid != 0) {
+                                throw_error (context,
+                                             DEVKIT_DISKS_DEVICE_ERROR_GENERAL,
+                                             "Only uid 0 may use the simulate= option");
+                                goto out;
+                        }
+                        simulpath = (const char *) options[n] + 9;
+                } else if (strcmp (options[n], "nowakeup") == 0) {
+                        nowakeup = TRUE;
+                }
+        }
+
+        if (simulpath != NULL) {
+                n = 0;
+                argv[n++] = "cat";
+                argv[n++] = (char *) simulpath;
+                argv[n++] = NULL;
+        } else {
+                n = 0;
+                /* TODO: honor option 'nowakeup' */
+                argv[n++] = "smartctl";
+                argv[n++] = "--all";
+                argv[n++] = device->priv->info.device_file;
+                argv[n++] = NULL;
+        }
 
         error = NULL;
         if (!job_new (context,
-                      "SmartRetrieveData",
+                      "DriveSmartRefreshData",
                       FALSE,
                       device,
                       pk_caller,
                       argv,
                       NULL,
-                      smart_retrieve_data_completed_cb,
-                      NULL,
-                      NULL)) {
+                      drive_smart_refresh_data_completed_cb,
+                      drive_smart_refresh_data_data_new (simulpath != NULL),
+                      (GDestroyNotify) drive_smart_refresh_data_unref)) {
                 goto out;
         }
 
@@ -5400,14 +5634,14 @@ out:
 /*--------------------------------------------------------------------------------------------------------------*/
 
 static void
-smart_initiate_selftest_completed_cb (DBusGMethodInvocation *context,
-                                 DevkitDisksDevice *device,
-                                 PolKitCaller *pk_caller,
-                                 gboolean job_was_cancelled,
-                                 int status,
-                                 const char *stderr,
-                                 const char *stdout,
-                                 gpointer user_data)
+drive_smart_initiate_selftest_completed_cb (DBusGMethodInvocation *context,
+                                            DevkitDisksDevice *device,
+                                            PolKitCaller *pk_caller,
+                                            gboolean job_was_cancelled,
+                                            int status,
+                                            const char *stderr,
+                                            const char *stdout,
+                                            gpointer user_data)
 {
         if (WEXITSTATUS (status) == 0 && !job_was_cancelled) {
 
@@ -5428,10 +5662,10 @@ smart_initiate_selftest_completed_cb (DBusGMethodInvocation *context,
 }
 
 gboolean
-devkit_disks_device_smart_initiate_selftest (DevkitDisksDevice     *device,
-                                        const char            *test,
-                                        gboolean               captive,
-                                        DBusGMethodInvocation *context)
+devkit_disks_device_drive_smart_initiate_selftest (DevkitDisksDevice     *device,
+                                                   const char            *test,
+                                                   gboolean               captive,
+                                                   DBusGMethodInvocation *context)
 {
         int n;
         char *argv[10];
@@ -5480,13 +5714,13 @@ devkit_disks_device_smart_initiate_selftest (DevkitDisksDevice     *device,
 
         error = NULL;
         if (!job_new (context,
-                      "SmartInitiateSelftest",
+                      "DriveSmartInitiateSelftest",
                       TRUE,
                       device,
                       pk_caller,
                       argv,
                       NULL,
-                      smart_initiate_selftest_completed_cb,
+                      drive_smart_initiate_selftest_completed_cb,
                       NULL,
                       NULL)) {
                 goto out;
index 1ab4069..74c747c 100644 (file)
@@ -181,13 +181,14 @@ gboolean devkit_disks_device_filesystem_set_label (DevkitDisksDevice     *device
                                                    const char            *new_label,
                                                    DBusGMethodInvocation *context);
 
-gboolean devkit_disks_device_smart_retrieve_data (DevkitDisksDevice     *device,
-                                                  DBusGMethodInvocation *context);
-
-gboolean devkit_disks_device_smart_initiate_selftest (DevkitDisksDevice     *device,
-                                                      const char            *test,
-                                                      gboolean               captive,
-                                                      DBusGMethodInvocation *context);
+gboolean devkit_disks_device_drive_smart_refresh_data (DevkitDisksDevice     *device,
+                                                       char                 **options,
+                                                       DBusGMethodInvocation *context);
+
+gboolean devkit_disks_device_drive_smart_initiate_selftest (DevkitDisksDevice     *device,
+                                                            const char            *test,
+                                                            gboolean               captive,
+                                                            DBusGMethodInvocation *context);
 
 gboolean devkit_disks_device_linux_md_stop (DevkitDisksDevice     *device,
                                             char                 **options,
index 4eb518f..1941c14 100644 (file)
 
     <!-- ************************************************************ -->
 
-    <method name="SmartRetrieveData">
+    <method name="DriveSmartRefreshData">
       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
-
-      <arg name="is_healthy" direction="out" type="b">
-        <doc:doc><doc:summary>Returns an assessment of whether the drive is healthy or not.</doc:summary></doc:doc>
-      </arg>
-      <arg name="power_on_hours" direction="out" type="i">
-        <doc:doc><doc:summary>Number of hours that the drive has been powered on.</doc:summary></doc:doc>
-      </arg>
-      <arg name="temperature" direction="out" type="i">
-        <doc:doc><doc:summary>Temperature of the drive, in Celcius.</doc:summary></doc:doc>
-      </arg>
-      <arg name="last_self_test_result" direction="out" type="s">
-        <doc:doc><doc:summary>Result of the last self test.</doc:summary></doc:doc>
+      <arg name="options" direction="in" type="as">
+        <doc:doc><doc:summary>
+            The option <doc:tt>nowakeup</doc:tt> can be passed to
+            avoid spinning up the disk if it's in a low-power mode.
+            The option <doc:tt>simulate=/path/to/smartctl-output</doc:tt> can be
+            passed to read the given file instead of invoking <doc:tt>smartctl(8)</doc:tt> tool.
+            The <doc:tt>simulate=</doc:tt> can only be used by the super user.
+        </doc:summary></doc:doc>
       </arg>
-
       <doc:doc>
         <doc:description>
           <doc:para>
-            Retrieves S.M.A.R.T. data from the device. TODO: We
-            probably should return all attributes or something more
-            detailed. And at the same time try to abstract the
-            difference between SCSI and ATA.
-          </doc:para>
-          <doc:para>
-            The result of last_self_test_result is a string; the following
-            values are known:
-            completed_ok,
-            not_completed_aborted,
-            not_completed_aborted_reset,
-            not_completed_unknown_reason,
-            completed_failed_unknown_reason,
-            completed_failed_electrical,
-            completed_failed_servo,
-            completed_failed_read,
-            completed_failed_damage,
-            unknown,
+            Refreshes the
+            <doc:ulink url="http://en.wikipedia.org/wiki/S.M.A.R.T">S.M.A.R.T.</doc:ulink>
+            data for the given drive.
           </doc:para>
         </doc:description>
         <doc:errors>
 
     <!-- ************************************************************ -->
 
-    <method name="SmartInitiateSelftest">
+    <method name="DriveSmartInitiateSelftest">
       <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
 
       <arg name="test" direction="in" type="s">
       </doc:para></doc:description></doc:doc>
     </property>
 
+    <property name="drive-smart-is-capable" type="b" access="read">
+      <doc:doc><doc:description><doc:para>
+            TRUE only if drive is
+            <doc:ulink url="http://en.wikipedia.org/wiki/S.M.A.R.T">S.M.A.R.T.</doc:ulink>
+            capable.
+      </doc:para></doc:description></doc:doc>
+    </property>
+    <property name="drive-smart-is-enabled" type="b" access="read">
+      <doc:doc><doc:description><doc:para>
+            TRUE only if S.M.A.R.T. is enabled for the drive.
+            This property is only valid if
+            <doc:ref type="property" to="Device:drive-smart-time-collected">drive-smart-time-collected</doc:ref>
+            is greater than zero.
+      </doc:para></doc:description></doc:doc>
+    </property>
+    <property name="drive-smart-time-collected" type="t" access="read">
+      <doc:doc><doc:description><doc:para>
+            The point in time (seconds since the Epoch Jan 1, 1970
+            0:00 UTC) when the S.M.A.R.T. data was collected. If data
+            was never collected, this property will assume the value
+            0.  This property is only valid if
+            <doc:ref type="property" to="Device:drive-smart-is-capable">drive-smart-is-capable</doc:ref>
+            is TRUE.
+      </doc:para></doc:description></doc:doc>
+    </property>
+    <property name="drive-smart-is-failing" type="b" access="read">
+      <doc:doc><doc:description><doc:para>
+            TRUE only if the drive is assessed to be failing.
+            This property is only valid if
+            <doc:ref type="property" to="Device:drive-smart-time-collected">drive-smart-time-collected</doc:ref>
+            is greater than zero.
+      </doc:para></doc:description></doc:doc>
+    </property>
+    <property name="drive-smart-temperature" type="d" access="read">
+      <doc:doc><doc:description><doc:para>
+            Temperature of the drive, in degrees celcius.
+            This property is only valid if
+            <doc:ref type="property" to="Device:drive-smart-time-collected">drive-smart-time-collected</doc:ref>
+            is greater than zero.
+      </doc:para></doc:description></doc:doc>
+    </property>
+    <property name="drive-smart-time-powered-on" type="t" access="read">
+      <doc:doc><doc:description><doc:para>
+            Number of seconds the drive has been powered on.
+            This property is only valid if
+            <doc:ref type="property" to="Device:drive-smart-time-collected">drive-smart-time-collected</doc:ref>
+            is greater than zero.
+      </doc:para></doc:description></doc:doc>
+    </property>
+    <property name="drive-smart-last-self-test-result" type="s" access="read">
+      <doc:doc><doc:description><doc:para>
+            The result of the last self-test to run. The following values are known:
+            <doc:list>
+              <doc:item>
+                <doc:term>completed_ok</doc:term>
+                <doc:definition>Completed without error or never run</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>not_completed_aborted</doc:term>
+                <doc:definition>Aborted</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>not_completed_aborted_reset</doc:term>
+                <doc:definition>Aborted by host</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>not_completed_unknown_reason</doc:term>
+                <doc:definition>Aborted for unknown reason</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>completed_failed_unknown_reason</doc:term>
+                <doc:definition>Completed, with failure:</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>completed_failed_electrical</doc:term>
+                <doc:definition>Completed, with failure: electrical subsystem</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>completed_failed_servo</doc:term>
+                <doc:definition>Completed, with failure: servo/seek subsystem</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>completed_failed_read</doc:term>
+                <doc:definition>Completed, with failure: read failure</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>completed_failed_damage</doc:term>
+                <doc:definition>Completed, with failure: handling damage</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>unknown</doc:term>
+                <doc:definition>Unknown test result</doc:definition>
+              </doc:item>
+            </doc:list>
+            This property is only valid if
+            <doc:ref type="property" to="Device:drive-smart-time-collected">drive-smart-time-collected</doc:ref>
+            is greater than zero.
+      </doc:para></doc:description></doc:doc>
+    </property>
+    <property name="drive-smart-attributes" type="a(isiiiis)" access="read">
+      <doc:doc><doc:description><doc:para>
+            An array of S.M.A.R.T. attributes. Each element contains the following members
+            <doc:list>
+              <doc:item>
+                <doc:term>attribute id</doc:term>
+                <doc:definition>the identifier of the attribute</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>attribute name</doc:term>
+                <doc:definition>a human readable name of the attribute or blank</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>flags</doc:term>
+                <doc:definition>Flags (TODO: link to spec)</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>value</doc:term>
+                <doc:definition>The normalized value of the attribute</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>worst</doc:term>
+                <doc:definition>The worst value seen</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>threshold</doc:term>
+                <doc:definition>The threshold of the attribute</doc:definition>
+              </doc:item>
+              <doc:item>
+                <doc:term>raw</doc:term>
+                <doc:definition>The raw vendor specific value of the attribute</doc:definition>
+              </doc:item>
+            </doc:list>
+            This property is only valid if
+            <doc:ref type="property" to="Device:drive-smart-time-collected">drive-smart-time-collected</doc:ref>
+            is greater than zero.
+      </doc:para></doc:description></doc:doc>
+    </property>
+
     <!-- The device is a component of a Linux MD (Software RAID) array;
          see property device-is-linux-md-component
       -->
diff --git a/test/smart/FUJITSU1.txt b/test/smart/FUJITSU1.txt
new file mode 100644 (file)
index 0000000..b10abf7
--- /dev/null
@@ -0,0 +1,80 @@
+[root/]# smartctl -v 9,seconds -v 200,writeerrorcount /dev/hda
+
+smartctl version 5.1-18 Copyright (C) 2002-3 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     FUJITSU MHR2040AT
+Serial Number:    NJ41T291391J
+Firmware Version: 40BA
+Device is:        Not in smartctl database [for details use: -P showall]
+ATA Version is:   6
+ATA Standard is:  ATA/ATAPI-6 T13 1410D revision 1
+Local Time is:    Thu Sep  4 22:18:48 2003 CEST
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: FAILED!
+Drive failure expected in less than 24 hours. SAVE ALL DATA.
+See vendor-specific Attribute list for failed Attributes.
+
+General SMART Values:
+Off-line data collection status: (0x00)        Offline data collection activity was
+                                       never started.
+                                       Auto Off-line Data Collection: Disabled.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                ( 468) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+                                       No Conveyance Self-test supported.
+                                       No Selective Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+                                       No General Purpose Logging support.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine
+recommended polling time:       (  60) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000f   100   100   046    Pre-fail  Always       -       52685626284
+  2 Throughput_Performance  0x0005   100   100   020    Pre-fail  Offline      -       0
+  3 Spin_Up_Time            0x0003   093   093   025    Pre-fail  Always       -       24065
+  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       160
+  5 Reallocated_Sector_Ct   0x0033   099   099   024    Pre-fail  Always       -       31
+  7 Seek_Error_Rate         0x000f   100   100   047    Pre-fail  Always       -       131071
+  8 Seek_Time_Performance   0x0005   100   100   019    Pre-fail  Offline      -       0
+  9 Power_On_Seconds        0x0032   092   092   000    Old_age   Always       -       1335h+10m+34s
+ 10 Spin_Retry_Count        0x0013   100   100   020    Pre-fail  Always       -       0
+ 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       150
+192 Power-Off_Retract_Count 0x0032   099   099   000    Old_age   Always       -       7
+193 Load_Cycle_Count        0x0032   074   074   000    Old_age   Always       -       95890
+194 Temperature_Celsius     0x0022   090   100   000    Old_age   Always       -       57
+195 Hardware_ECC_Recovered  0x001a   100   100   000    Old_age   Always       -       10141348
+196 Reallocated_Event_Count 0x0032   099   099   000    Old_age   Always       -       30
+197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
+198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
+199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
+200 Write_Error_Count       0x000f   036   033   060    Pre-fail  Always   FAILING_NOW 2883583
+203 Run_Out_Cancel          0x0002   091   091   000    Old_age   Always       -       2589872160305
+
+SMART Error Log Version: 1
+No Errors Logged
+
+SMART Self-test log structure revision number 1
+No self-tests have been logged
+
+
diff --git a/test/smart/FUJITSU_MHR2020AT.txt b/test/smart/FUJITSU_MHR2020AT.txt
new file mode 100644 (file)
index 0000000..4f8dc82
--- /dev/null
@@ -0,0 +1,158 @@
+smartctl version 5.32 Copyright (C) 2002-4 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     FUJITSU MHR2020AT
+Serial Number:    NJ13T2215TUH
+Firmware Version: 30B8
+Device is:        Not in smartctl database [for details use: -P showall]
+ATA Version is:   6
+ATA Standard is:  ATA/ATAPI-6 T13 1410D revision 1
+Local Time is:    Sun Aug 15 13:21:33 2004 MEST
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: FAILED!
+Drive failure expected in less than 24 hours. SAVE ALL DATA.
+See vendor-specific Attribute list for failed Attributes.
+
+General SMART Values:
+Offline data collection status:  (0x00)        Offline data collection activity
+                                       was never started.
+                                       Auto Offline Data Collection: Disabled.
+Self-test execution status:      ( 105)        The previous self-test completed having
+                                       the servo (and/or seek) element of the 
+                                       test failed.
+Total time to complete Offline 
+data collection:                ( 234) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Auto Offline data collection on/off support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+                                       No Conveyance Self-test supported.
+                                       No Selective Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+                                       No General Purpose Logging support.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine
+recommended polling time:       (  30) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000f   007   001   046    Pre-fail  Always   FAILING_NOW 154618843423
+  2 Throughput_Performance  0x0005   100   100   020    Pre-fail  Offline      -       145
+  3 Spin_Up_Time            0x0003   094   083   025    Pre-fail  Always       -       24321
+  4 Start_Stop_Count        0x0032   097   097   000    Old_age   Always       -       1887
+  5 Reallocated_Sector_Ct   0x0033   099   099   024    Pre-fail  Always       -       1
+  7 Seek_Error_Rate         0x000f   100   100   047    Pre-fail  Always       -       458751
+  8 Seek_Time_Performance   0x0005   100   100   019    Pre-fail  Offline      -       0
+  9 Power_On_Seconds        0x0032   088   088   000    Old_age   Always       -       1819h+16m+52s
+ 10 Spin_Retry_Count        0x0013   100   100   020    Pre-fail  Always       -       0
+ 12 Power_Cycle_Count       0x0032   091   091   000    Old_age   Always       -       1467
+192 Power-Off_Retract_Count 0x0032   099   099   000    Old_age   Always       -       44
+193 Load_Cycle_Count        0x0032   086   086   000    Old_age   Always       -       49810
+194 Temperature_Celsius     0x0022   100   100   000    Old_age   Always       -       32
+195 Hardware_ECC_Recovered  0x001a   100   100   000    Old_age   Always       -       1221
+196 Reallocated_Event_Count 0x0032   099   099   000    Old_age   Always       -       1
+197 Current_Pending_Sector  0x0012   001   001   000    Old_age   Always       -       10
+198 Offline_Uncorrectable   0x0010   092   092   000    Old_age   Offline      -       17
+199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
+200 Multi_Zone_Error_Rate   0x000f   100   100   060    Pre-fail  Always       -       393215
+203 Run_Out_Cancel          0x0002   100   100   000    Old_age   Always       -       429515210380
+
+SMART Error Log Version: 1
+ATA Error Count: 6861 (device log contains only the most recent five errors)
+       CR = Command Register [HEX]
+       FR = Features Register [HEX]
+       SC = Sector Count Register [HEX]
+       SN = Sector Number Register [HEX]
+       CL = Cylinder Low Register [HEX]
+       CH = Cylinder High Register [HEX]
+       DH = Device/Head Register [HEX]
+       DC = Device Command Register [HEX]
+       ER = Error register [HEX]
+       ST = Status register [HEX]
+Powered_Up_Time is measured from power on, and printed as
+DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
+SS=sec, and sss=millisec. It "wraps" after 49.710 days.
+
+Error 6861 occurred at disk power-on lifetime: 1818 hours (75 days + 18 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 59 8b 7d 16 51 f0  Error: UNC 139 sectors at LBA = 0x0051167d = 5314173
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 90 78 16 51 f0 00      08:22:32.857  READ DMA EXT
+
+Error 6860 occurred at disk power-on lifetime: 1818 hours (75 days + 18 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 59 8b 7d 16 51 f0  Error: UNC 139 sectors at LBA = 0x0051167d = 5314173
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 98 70 16 51 f0 00      08:22:27.700  READ DMA EXT
+
+Error 6859 occurred at disk power-on lifetime: 1818 hours (75 days + 18 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 59 8b 7d 16 51 f0  Error: UNC 139 sectors at LBA = 0x0051167d = 5314173
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 a0 68 16 51 f0 00      08:22:22.558  READ DMA EXT
+
+Error 6858 occurred at disk power-on lifetime: 1818 hours (75 days + 18 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 59 8b 7d 16 51 f0  Error: UNC 139 sectors at LBA = 0x0051167d = 5314173
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 a8 60 16 51 f0 00      08:22:17.458  READ DMA EXT
+
+Error 6857 occurred at disk power-on lifetime: 1818 hours (75 days + 18 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 59 8b 7d 16 51 f0  Error: UNC 139 sectors at LBA = 0x0051167d = 5314173
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 b0 58 16 51 f0 00      08:22:12.558  READ DMA EXT
+
+SMART Self-test log structure revision number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Short offline       Completed: servo/seek failure 90%      1819         -
+# 2  Extended offline    Completed: servo/seek failure 90%      1816         -
+
+Device does not support Selective Self Tests/Logging
diff --git a/test/smart/HITACHI_DK23AA-12B.txt b/test/smart/HITACHI_DK23AA-12B.txt
new file mode 100644 (file)
index 0000000..6f9b62e
--- /dev/null
@@ -0,0 +1,173 @@
+smartctl version 5.30 Copyright (C) 2002-4 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     HITACHI_DK23AA-12B
+Serial Number:    xxxxxx
+Firmware Version: 00XDA0B6
+Device is:        Not in smartctl database [for details use: -P showall]
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+Local Time is:    Sat Apr 24 17:19:58 2004 EST
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: FAILED!
+Drive failure expected in less than 24 hours. SAVE ALL DATA.
+See vendor-specific Attribute list for failed Attributes.
+
+General SMART Values:
+Offline data collection status:  (0x00)        Offline data collection activity was
+                                       never started.
+                                       Auto Offline Data Collection: Disabled.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete Offline 
+data collection:                (1110) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Auto Offline data collection on/off support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+                                       No Conveyance Self-test supported.
+                                       No Selective Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+                                       No General Purpose Logging support.
+Short self-test routine 
+recommended polling time:       (   1) minutes.
+Extended self-test routine
+recommended polling time:       (  19) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000d   099   099   050    Pre-fail  Offline      -       68719476757
+  4 Start_Stop_Count        0x0032   097   097   050    Old_age   Always       -       3259
+  5 Reallocated_Sector_Ct   0x0033   001   001   010    Pre-fail  Always   FAILING_NOW 1876
+  7 Seek_Error_Rate         0x000b   100   100   050    Pre-fail  Always       -       760
+  9 Power_On_Hours          0x0032   090   090   060    Old_age   Always       -       21783
+ 10 Spin_Retry_Count        0x0013   100   100   050    Pre-fail  Always       -       0
+196 Reallocated_Event_Count 0x0032   001   001   001    Old_age   Always   FAILING_NOW 254
+197 Current_Pending_Sector  0x0032   097   093   001    Old_age   Always       -       3
+198 Offline_Uncorrectable   0x0010   100   100   001    Old_age   Offline      -       0
+199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age   Always       -       0
+221 G-Sense_Error_Rate      0x000a   100   100   050    Old_age   Always       -       42
+223 Load_Retry_Count        0x0012   100   100   050    Old_age   Always       -       149
+225 Load_Cycle_Count        0x0032   050   050   050    Old_age   Always   FAILING_NOW 5110222858734
+250 Read_Error_Retry_Rate   0x000a   090   001   050    Old_age   Always   In_the_past 103
+
+SMART Error Log Version: 1
+ATA Error Count: 1151 (device log contains only the most recent five errors)
+       CR = Command Register [HEX]
+       FR = Features Register [HEX]
+       SC = Sector Count Register [HEX]
+       SN = Sector Number Register [HEX]
+       CL = Cylinder Low Register [HEX]
+       CH = Cylinder High Register [HEX]
+       DH = Device/Head Register [HEX]
+       DC = Device Command Register [HEX]
+       ER = Error register [HEX]
+       ST = Status register [HEX]
+Timestamp = decimal seconds since the previous disk power-on.
+Note: timestamp "wraps" after 2^32 msec = 49.710 days.
+
+Error 1151 occurred at disk power-on lifetime: 5445 hours
+  When the command that caused the error occurred, the device was doing SMART Offline or Self-test.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  01 51 01 01 4f c2 e0  Error: obs
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  b0 d5 01 01 4f c2 e0 00   46273.155  SMART READ LOG
+  b0 d1 01 01 4f c2 e0 00   46273.138  SMART READ ATTRIBUTE THRESHOLDS [OBS-4]
+  b0 d0 01 00 4f c2 e0 00   46273.009  SMART READ DATA
+  b0 da 00 00 4f c2 a0 00   46272.881  SMART RETURN STATUS
+  b0 da 00 00 4f c2 e0 00   46272.760  SMART RETURN STATUS
+
+Error 1150 occurred at disk power-on lifetime: 5354 hours
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  01 51 01 56 36 54 e1  Error: AMNF 1 sectors at LBA = 0x01543656 = 22296150
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  c8 00 80 d7 35 54 e1 00    1517.332  READ DMA
+  c8 00 80 57 35 54 e1 00    1517.329  READ DMA
+  ca 00 08 67 1d cb e0 00    1516.014  WRITE DMA
+  ca 00 30 37 1d cb e0 00    1515.992  WRITE DMA
+  ca 00 10 2f e0 ca e0 00    1515.874  WRITE DMA
+
+Error 1149 occurred at disk power-on lifetime: 5352 hours
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  01 51 0c bb c5 57 e1  Error: AMNF 12 sectors at LBA = 0x0157c5bb = 22529467
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  c8 00 20 a7 c5 57 e1 00     380.146  READ DMA
+  10 00 3f 00 00 00 e0 00     380.146  RECALIBRATE [OBS-4]
+  c8 00 20 a7 c5 57 e1 00     377.932  READ DMA
+  c8 00 20 a7 c5 57 e1 00     373.729  READ DMA
+  c8 00 80 6f 41 5f e1 00     371.776  READ DMA
+
+Error 1148 occurred at disk power-on lifetime: 5352 hours
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  01 51 0c bb c5 57 e1  Error: AMNF 12 sectors at LBA = 0x0157c5bb = 22529467
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  c8 00 20 a7 c5 57 e1 00     377.932  READ DMA
+  c8 00 20 a7 c5 57 e1 00     373.729  READ DMA
+  c8 00 80 6f 41 5f e1 00     371.776  READ DMA
+  c8 00 80 ef 40 5f e1 00     371.742  READ DMA
+  ca 00 08 57 1f cb e0 00     371.291  WRITE DMA
+
+Error 1147 occurred at disk power-on lifetime: 5352 hours
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  01 51 0c bb c5 57 e1  Error: AMNF 12 sectors at LBA = 0x0157c5bb = 22529467
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  c8 00 20 a7 c5 57 e1 00     373.729  READ DMA
+  c8 00 80 6f 41 5f e1 00     371.776  READ DMA
+  c8 00 80 ef 40 5f e1 00     371.742  READ DMA
+  ca 00 08 57 1f cb e0 00     371.291  WRITE DMA
+  ca 00 10 47 1f cb e0 00     371.262  WRITE DMA
+
+SMART Self-test log structure revision number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Short offline       Completed without error       00%      5445         -
+# 2  Short offline       Completed without error       00%      5445         -
+# 3  Short offline       Aborted by host               90%      5445         -
+# 4  Short offline       Completed without error       00%      5445         -
+# 5  Short offline       Completed without error       00%      5445         -
+
diff --git a/test/smart/HITACHI_DK23BA-20-0.txt b/test/smart/HITACHI_DK23BA-20-0.txt
new file mode 100644 (file)
index 0000000..13e9cb0
--- /dev/null
@@ -0,0 +1,163 @@
+[root@ballen www]# /usr/sbin/smartctl -am /dev/hda
+
+smartctl version 5.0-25 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     HITACHI_DK23BA-20                       
+Serial Number:    12H7M8
+Firmware Version: 00E0A0D2
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+See vendor-specific Attribute list for marginal Attributes.
+
+General SMART Values:
+Off-line data collection status: (0x00)        Offline data collection activity was
+                                       never started.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                (1530) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  26) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000d   100   083   050    Pre-fail     -       677
+  3 Spin_Up_Time            0x0007   100   100   050    Pre-fail     -       0
+  4 Start_Stop_Count        0x0032   100   100   050    Old_age      -       249
+  5 Reallocated_Sector_Ct   0x0033   099   099   010    Pre-fail     -       30
+  7 Seek_Error_Rate         0x000f   100   100   050    Pre-fail     -       319
+  9 Power_On_Hours          0x0032   099   099   060    Old_age      -       701 h + 42 m
+ 10 Spin_Retry_Count        0x0013   100   100   050    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   050    Old_age      -       249
+192 Power-Off_Retract_Count 0x0032   100   100   050    Old_age      -       15
+195 Hardware_ECC_Recovered  0x001a   100   001   050    Old_age  In_the_past 559
+196 Reallocated_Event_Count 0x0032   097   097   001    Old_age      -       30
+197 Current_Pending_Sector  0x0032   095   095   001    Old_age      -       5
+198 Offline_Uncorrectable   0x0010   095   095   001    Old_age      -       31
+199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age      -       0
+221 G-Sense_Error_Rate      0x000a   100   100   050    Old_age      -       0
+223 Load_Retry_Count        0x0012   100   100   050    Old_age      -       0
+225 Load_Cycle_Count        0x0032   095   095   050    Old_age      -       18446744072753281791
+230 Unknown_Attribute       0x0032   100   100   060    Old_age      -       18484
+250 Unknown_Attribute       0x000a   100   070   050    Old_age      -       601
+
+SMART Error Log Version: 1
+ATA Error Count: 9 (device log contains only the most recent five errors)
+       DCR = Device Control Register
+       FR  = Features Register
+       SC  = Sector Count Register
+       SN  = Sector Number Register
+       CL  = Cylinder Low Register
+       CH  = Cylinder High Register
+       D/H = Device/Head Register
+       CR  = Content written to Command Register
+       ER  = Error register
+       STA = Status register
+Timestamp is seconds since the previous disk power-on.
+Note: timestamp "wraps" after 2^32 msec = 49.710 days.
+
+Error 1 occurred at disk power-on lifetime: 458 hours
+When the command that caused the error occurred, the device was active or idle.
+After command completion occurred, registers were:
+ER:40 SC:01 SN:15 CL:be CH:2e D/H:e0 ST:51
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 00   00   01   15   be   2e    e0   c8     831.599
+ 00   00   01   14   be   2e    e0   c8     831.594
+ 00   00   01   13   be   2e    e0   c8     831.594
+ 00   00   01   12   be   2e    e0   c8     831.594
+ 00   00   01   11   be   2e    e0   c8     831.594
+
+Error 2 occurred at disk power-on lifetime: 458 hours
+When the command that caused the error occurred, the device was active or idle.
+After command completion occurred, registers were:
+ER:40 SC:45 SN:15 CL:be CH:2e D/H:e0 ST:51
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 00   00   80   da   bd   2e    e0   c8     829.680
+ 00   00   80   5a   bd   2e    e0   c8     829.677
+ 00   00   80   da   bc   2e    e0   c8     829.673
+ 00   00   80   5a   bc   2e    e0   c8     829.671
+ 00   00   01   58   bc   2e    e0   c8     829.671
+
+Error 3 occurred at disk power-on lifetime: 458 hours
+When the command that caused the error occurred, the device was active or idle.
+After command completion occurred, registers were:
+ER:40 SC:01 SN:47 CL:bc CH:2e D/H:e0 ST:51
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 00   00   01   47   bc   2e    e0   c8     826.962
+ 00   00   01   46   bc   2e    e0   c8     826.961
+ 00   00   01   45   bc   2e    e0   c8     826.961
+ 00   00   01   44   bc   2e    e0   c8     826.961
+ 00   00   01   43   bc   2e    e0   c8     826.961
+
+Error 4 occurred at disk power-on lifetime: 458 hours
+When the command that caused the error occurred, the device was active or idle.
+After command completion occurred, registers were:
+ER:40 SC:13 SN:47 CL:bc CH:2e D/H:e0 ST:51
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 00   00   80   da   bb   2e    e0   c8     825.038
+ 00   00   80   5a   bb   2e    e0   c8     825.033
+ 00   00   80   da   ba   2e    e0   c8     825.030
+ 00   00   80   5a   ba   2e    e0   c8     824.940
+ 00   00   80   da   b9   2e    e0   c8     824.937
+
+Error 5 occurred at disk power-on lifetime: 458 hours
+When the command that caused the error occurred, the device was active or idle.
+After command completion occurred, registers were:
+ER:40 SC:01 SN:85 CL:19 CH:2c D/H:e0 ST:51
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 00   00   01   85   19   2c    e0   c8     816.487
+ 00   00   01   84   19   2c    e0   c8     816.487
+ 00   00   01   83   19   2c    e0   c8     816.486
+ 00   00   01   82   19   2c    e0   c8     816.486
+ 00   00   01   81   19   2c    e0   c8     816.486
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Short off-line      Completed                     00%       691         
+# 2  Extended off-line   Completed: read failure       40%       661         0x002c1985
+# 3  Extended off-line   Completed: read failure       40%       661         0x002c1985
+# 4  Short off-line      Completed                     00%       660         
+# 5  Extended off-line   Completed: read failure       40%       658         0x002c1985
+# 6  Short off-line      Completed                     00%       658         
+# 7  Short off-line      Completed                     00%       658         
+# 8  Extended off-line   Completed: read failure       40%       658         0x002c1985
+# 9  Extended off-line   Completed: read failure       40%       657         0x002c1985
+#10  Short off-line      Completed                     00%       647         
+#11  Short off-line      Completed                     00%       587         
+#12  Short off-line      Completed                     00%       583         
+#13  Short off-line      Completed                     00%       551         
+#14  Short captive       Interrupted (host reset)      40%       551         
+#15  Short off-line      Completed                     00%       551         
+#16  Extended off-line   Completed: read failure       40%       550         0x002c1985
+#17  Extended off-line   Aborted by host               50%       550         
+#18  Short off-line      Completed                     00%       550         
+#19  Short off-line      Completed                     00%       537         
+#20  Extended off-line   Completed: read failure       40%       536         0x002c1985
+#21  Short off-line      Completed                     00%       536         
diff --git a/test/smart/IC35L120AVV207-0.txt b/test/smart/IC35L120AVV207-0.txt
new file mode 100644 (file)
index 0000000..4e43e8c
--- /dev/null
@@ -0,0 +1,67 @@
+# smartctl -a /dev/hda
+smartctl version 5.0-45 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     IC35L120AVV207-0                        
+Serial Number:    VNVD02G4G4BDEG
+Firmware Version: V24OA63A
+ATA Version is:   6
+ATA Standard is:  ATA/ATAPI-6 T13 1410D revision 3a
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+General SMART Values:
+Off-line data collection status: (0x00)        Offline data collection activity was
+                                       never started.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                (2855) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   1) minutes.
+Extended self-test routine 
+recommended polling time:       (  48) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000b   100   100   060    Pre-fail     -       0
+  2 Throughput_Performance  0x0005   100   100   050    Pre-fail     -       0
+  3 Spin_Up_Time            0x0007   102   102   024    Pre-fail     -       16974103
+  4 Start_Stop_Count        0x0012   100   100   000    Old_age      -       14
+  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail     -       0
+  7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail     -       0
+  8 Seek_Time_Performance   0x0005   100   100   020    Pre-fail     -       0
+  9 Power_On_Hours          0x0012   100   100   000    Old_age      -       242
+ 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   000    Old_age      -       14
+192 Power-Off_Retract_Count 0x0032   100   100   050    Old_age      -       24
+193 Load_Cycle_Count        0x0012   100   100   050    Old_age      -       24
+194 Temperature_Celsius     0x0002   203   203   000    Old_age      -       27 (Lifetime Min/Max 20/37)
+196 Reallocated_Event_Count 0x0032   100   100   000    Old_age      -       0
+197 Current_Pending_Sector  0x0022   100   100   000    Old_age      -       0
+198 Offline_Uncorrectable   0x0008   100   100   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age      -       0
+
+SMART Error Log Version: 1
+No Errors Logged
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended off-line   Completed                     00%        54         
diff --git a/test/smart/IC35L120AVV207-1.txt b/test/smart/IC35L120AVV207-1.txt
new file mode 100644 (file)
index 0000000..48a6991
--- /dev/null
@@ -0,0 +1,191 @@
+smartctl version 5.31 Copyright (C) 2002-4 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     IC35L120AVV207-1
+Serial Number:    VNVD09G4H3HPMT
+Firmware Version: V24OA66A
+Device is:        In smartctl database [for details use: -P show]
+ATA Version is:   6
+ATA Standard is:  ATA/ATAPI-6 T13 1410D revision 3a
+Local Time is:    Tue Jun 15 23:38:56 2004 CDT
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: FAILED!
+Drive failure expected in less than 24 hours. SAVE ALL DATA.
+See vendor-specific Attribute list for failed Attributes.
+
+General SMART Values:
+Offline data collection status:  (0x84)        Offline data collection activity
+                                       was suspended by an interrupting command from host.
+                                       Auto Offline Data Collection: Enabled.
+Self-test execution status:      ( 121)        The previous self-test completed having
+                                       the read element of the test failed.
+Total time to complete Offline 
+data collection:                (2855) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Auto Offline data collection on/off support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+                                       No Conveyance Self-test supported.
+                                       No Selective Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+                                       General Purpose Logging supported.
+Short self-test routine 
+recommended polling time:       (   1) minutes.
+Extended self-test routine
+recommended polling time:       (  48) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000b   089   089   060    Pre-fail  Always       -       1703986
+  2 Throughput_Performance  0x0005   015   015   050    Pre-fail  Offline  FAILING_NOW 5518
+  3 Spin_Up_Time            0x0007   100   100   024    Pre-fail  Always       -       278
+  4 Start_Stop_Count        0x0012   100   100   000    Old_age   Always       -       9
+  5 Reallocated_Sector_Ct   0x0033   091   091   005    Pre-fail  Always       -       277
+  7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail  Always       -       0
+  8 Seek_Time_Performance   0x0005   123   123   020    Pre-fail  Offline      -       37
+  9 Power_On_Hours          0x0012   100   100   000    Old_age   Always       -       2759
+ 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail  Always       -       0
+ 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       9
+192 Power-Off_Retract_Count 0x0032   100   100   050    Old_age   Always       -       45
+193 Load_Cycle_Count        0x0012   100   100   050    Old_age   Always       -       45
+194 Temperature_Celsius     0x0002   166   166   000    Old_age   Always       -       33 (Lifetime Min/Max 23/44)
+196 Reallocated_Event_Count 0x0032   092   092   000    Old_age   Always       -       319
+197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       49
+198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       20
+199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age   Always       -       0
+
+SMART Error Log Version: 1
+ATA Error Count: 161 (device log contains only the most recent five errors)
+       CR = Command Register [HEX]
+       FR = Features Register [HEX]
+       SC = Sector Count Register [HEX]
+       SN = Sector Number Register [HEX]
+       CL = Cylinder Low Register [HEX]
+       CH = Cylinder High Register [HEX]
+       DH = Device/Head Register [HEX]
+       DC = Device Command Register [HEX]
+       ER = Error register [HEX]
+       ST = Status register [HEX]
+Powered_Up_Time is measured from power on, and printed as
+DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
+SS=sec, and sss=millisec. It "wraps" after 49.710 days.
+
+Error 161 occurred at disk power-on lifetime: 2752 hours (114 days + 16 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 46 c2 a7 02 e0  Error: UNC 70 sectors at LBA = 0x0002a7c2 = 174018
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 46 c2 a7 02 e0 00  23d+03:19:20.800  READ DMA EXT
+  25 00 48 c0 a7 02 e0 00  23d+03:19:16.000  READ DMA EXT
+  25 00 1c a4 a7 02 e0 00  23d+03:19:15.200  READ DMA EXT
+  25 00 1e a2 a7 02 e0 00  23d+03:19:10.400  READ DMA EXT
+  25 00 20 a0 a7 02 e0 00  23d+03:19:02.200  READ DMA EXT
+
+Error 160 occurred at disk power-on lifetime: 2752 hours (114 days + 16 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 47 c1 a7 02 e0  Error: UNC 71 sectors at LBA = 0x0002a7c1 = 174017
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 48 c0 a7 02 e0 00  23d+03:19:16.000  READ DMA EXT
+  25 00 1c a4 a7 02 e0 00  23d+03:19:15.200  READ DMA EXT
+  25 00 1e a2 a7 02 e0 00  23d+03:19:10.400  READ DMA EXT
+  25 00 20 a0 a7 02 e0 00  23d+03:19:02.200  READ DMA EXT
+  25 00 22 9e a7 02 e0 00  23d+03:18:57.400  READ DMA EXT
+
+Error 159 occurred at disk power-on lifetime: 2752 hours (114 days + 16 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 02 be a7 02 e0  Error: UNC 2 sectors at LBA = 0x0002a7be = 174014
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 1e a2 a7 02 e0 00  23d+03:19:10.400  READ DMA EXT
+  25 00 20 a0 a7 02 e0 00  23d+03:19:02.200  READ DMA EXT
+  25 00 22 9e a7 02 e0 00  23d+03:18:57.400  READ DMA EXT
+  25 00 24 9c a7 02 e0 00  23d+03:18:52.400  READ DMA EXT
+  25 00 26 9a a7 02 e0 00  23d+03:18:40.200  READ DMA EXT
+
+Error 158 occurred at disk power-on lifetime: 2752 hours (114 days + 16 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 02 be a7 02 e0  Error: UNC 2 sectors at LBA = 0x0002a7be = 174014
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 20 a0 a7 02 e0 00  23d+03:19:02.200  READ DMA EXT
+  25 00 22 9e a7 02 e0 00  23d+03:18:57.400  READ DMA EXT
+  25 00 24 9c a7 02 e0 00  23d+03:18:52.400  READ DMA EXT
+  25 00 26 9a a7 02 e0 00  23d+03:18:40.200  READ DMA EXT
+  25 00 28 98 a7 02 e0 00  23d+03:18:32.100  READ DMA EXT
+
+Error 157 occurred at disk power-on lifetime: 2752 hours (114 days + 16 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 03 bd a7 02 e0  Error: UNC 3 sectors at LBA = 0x0002a7bd = 174013
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 22 9e a7 02 e0 00  23d+03:18:57.400  READ DMA EXT
+  25 00 24 9c a7 02 e0 00  23d+03:18:52.400  READ DMA EXT
+  25 00 26 9a a7 02 e0 00  23d+03:18:40.200  READ DMA EXT
+  25 00 28 98 a7 02 e0 00  23d+03:18:32.100  READ DMA EXT
+  25 00 2a 96 a7 02 e0 00  23d+03:18:26.400  READ DMA EXT
+
+SMART Self-test log structure revision number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended offline    Completed: read failure       90%      2692         173893
+# 2  Short offline       Completed: read failure       10%      2654         173911
+# 3  Extended offline    Completed: read failure       90%      2524         174132
+# 4  Extended offline    Completed without error       00%      2358         -
+# 5  Extended offline    Completed without error       00%      2192         -
+# 6  Extended offline    Completed without error       00%      2023         -
+# 7  Extended offline    Completed without error       00%      1857         -
+# 8  Extended offline    Completed without error       00%      1689         -
+# 9  Extended offline    Completed without error       00%      1521         -
+#10  Extended offline    Completed without error       00%      1355         -
+#11  Extended offline    Completed without error       00%      1187         -
+#12  Extended offline    Completed without error       00%      1020         -
+#13  Extended offline    Completed without error       00%       854         -
+#14  Extended offline    Completed without error       00%       685         -
+#15  Extended offline    Completed without error       00%       517         -
+#16  Extended offline    Completed without error       00%       349         -
+#17  Extended offline    Completed without error       00%       181         -
+#18  Extended offline    Completed without error       00%        13         -
+#19  Extended offline    Completed without error       00%         4         -
+
+Device does not support Selective Self Tests/Logging
diff --git a/test/smart/IC35L120AVVA07-0-0.txt b/test/smart/IC35L120AVVA07-0-0.txt
new file mode 100644 (file)
index 0000000..57926cc
--- /dev/null
@@ -0,0 +1,69 @@
+smartctl version 5.0-24 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     IC35L120AVVA07-0                        
+Serial Number:    VNC605A6GG8W8A
+Firmware Version: VA6OA52A
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+General SMART Values:
+Off-line data collection status: (0x00)        Offline data collection activity was
+                                       never started.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                (3399) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   1) minutes.
+Extended self-test routine 
+recommended polling time:       (  57) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000b   100   100   060    Pre-fail     -       0
+  2 Throughput_Performance  0x0005   147   147   050    Pre-fail     -       266
+  3 Spin_Up_Time            0x0007   093   093   024    Pre-fail     -       23593335
+  4 Start_Stop_Count        0x0012   100   100   000    Old_age      -       13
+  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail     -       0
+  7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail     -       0
+  8 Seek_Time_Performance   0x0005   138   138   020    Pre-fail     -       30
+  9 Power_On_Hours          0x0012   100   100   000    Old_age      -       554
+ 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   000    Old_age      -       13
+192 Power-Off_Retract_Count 0x0032   100   100   050    Old_age      -       36
+193 Load_Cycle_Count        0x0012   100   100   050    Old_age      -       36
+194 Temperature_Centigrade  0x0002   183   183   000    Old_age      -       30 (Lifetime Min/Max 23/39)
+196 Reallocated_Event_Count 0x0032   100   100   000    Old_age      -       0
+197 Current_Pending_Sector  0x0022   100   100   000    Old_age      -       0
+198 Offline_Uncorrectable   0x0008   100   100   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age      -       0
+
+SMART Error Log Version: 1
+No Errors Logged
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended off-line   Completed                     00%       492         
+# 2  Short off-line      Completed                     00%       296         
+# 3  Extended off-line   Completed                     00%       169         
+# 4  Short off-line      Completed                     00%       168         
diff --git a/test/smart/IC35L120AVVA07-0-1.txt b/test/smart/IC35L120AVVA07-0-1.txt
new file mode 100644 (file)
index 0000000..992a620
--- /dev/null
@@ -0,0 +1,67 @@
+smartctl version 5.0-24 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     IC35L120AVVA07-0                        
+Serial Number:    VNC605A6GEWZDA
+Firmware Version: VA6OA52A
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+General SMART Values:
+Off-line data collection status: (0x00)        Offline data collection activity was
+                                       never started.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                (3399) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   1) minutes.
+Extended self-test routine 
+recommended polling time:       (  57) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000b   100   100   060    Pre-fail     -       0
+  2 Throughput_Performance  0x0005   100   100   050    Pre-fail     -       0
+  3 Spin_Up_Time            0x0007   098   098   024    Pre-fail     -       22348126
+  4 Start_Stop_Count        0x0012   100   100   000    Old_age      -       13
+  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail     -       0
+  7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail     -       0
+  8 Seek_Time_Performance   0x0005   100   100   020    Pre-fail     -       0
+  9 Power_On_Hours          0x0012   100   100   000    Old_age      -       554
+ 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   000    Old_age      -       13
+192 Power-Off_Retract_Count 0x0032   100   100   050    Old_age      -       36
+193 Load_Cycle_Count        0x0012   100   100   050    Old_age      -       36
+194 Temperature_Centigrade  0x0002   189   189   000    Old_age      -       29 (Lifetime Min/Max 23/36)
+196 Reallocated_Event_Count 0x0032   100   100   000    Old_age      -       0
+197 Current_Pending_Sector  0x0022   100   100   000    Old_age      -       0
+198 Offline_Uncorrectable   0x0008   100   100   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age      -       0
+
+SMART Error Log Version: 1
+No Errors Logged
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended off-line   Completed                     00%       492         
+# 2  Extended off-line   Completed                     00%       169         
diff --git a/test/smart/MAXTOR-0.txt b/test/smart/MAXTOR-0.txt
new file mode 100644 (file)
index 0000000..13e0eb2
--- /dev/null
@@ -0,0 +1,139 @@
+smartctl version 5.0-24 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     MAXTOR 4K080H4                          
+Serial Number:    674205306226        
+Firmware Version: A08.1500
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+General SMART Values:
+Off-line data collection status: (0x02)        Offline data collection activity 
+                                       completed without error.
+Self-test execution status:      ( 112)        The previous self-test completed having
+                                       the read element of the test failed.
+Total time to complete off-line 
+data collection:                (  44) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  50) minutes.
+
+SMART Attributes Data Structure revision number: 11
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x0029   100   253   020    Pre-fail     -       0
+  3 Spin_Up_Time            0x0027   077   077   020    Pre-fail     -       2909
+  4 Start_Stop_Count        0x0032   100   100   008    Old_age      -       29
+  5 Reallocated_Sector_Ct   0x0033   100   100   020    Pre-fail     -       1
+  7 Seek_Error_Rate         0x000b   100   100   023    Pre-fail     -       0
+  9 Power_On_Hours          0x0012   097   097   001    Old_age      -       1992
+ 10 Spin_Retry_Count        0x0026   100   100   000    Old_age      -       0
+ 11 Calibration_Retry_Count 0x0013   100   100   020    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   008    Old_age      -       29
+ 13 Read_Soft_Error_Rate    0x000b   100   100   023    Pre-fail     -       0
+194 Temperature_Centigrade  0x0022   093   090   042    Old_age      -       19
+195 Hardware_ECC_Recovered  0x001a   100   006   000    Old_age      -       7683906
+196 Reallocated_Event_Count 0x0010   099   099   020    Old_age      -       1
+197 Current_Pending_Sector  0x0032   100   100   020    Old_age      -       1
+198 Offline_Uncorrectable   0x0010   100   100   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x001a   198   198   000    Old_age      -       2
+
+SMART Error Log Version: 1
+ATA Error Count: 11 (device log contains only the most recent five errors)
+       DCR = Device Control Register
+       FR  = Features Register
+       SC  = Sector Count Register
+       SN  = Sector Number Register
+       CL  = Cylinder Low Register
+       CH  = Cylinder High Register
+       D/H = Device/Head Register
+       CR  = Content written to Command Register
+       ER  = Error register
+       STA = Status register
+Timestamp is seconds since the previous disk power-on.
+Note: timestamp "wraps" after 2^32 msec = 49.710 days.
+
+Error 1 occurred at disk power-on lifetime: 1029 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:40 SC:02 SN:41 CL:2d CH:70 D/H:e8 ST:d1
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 70   08   02   41   2d   70    e8   c4     90.713
+ 70   08   04   3f   2d   70    e8   c4     86.648
+ 70   08   06   3d   2d   70    e8   c4     82.584
+ 70   08   08   3b   2d   70    e8   c4     78.342
+ 28   08   04   8b   2c   28    e8   c5     78.341
+
+Error 2 occurred at disk power-on lifetime: 1029 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:40 SC:04 SN:3f CL:2d CH:70 D/H:e8 ST:d1
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 70   08   04   3f   2d   70    e8   c4     86.648
+ 70   08   06   3d   2d   70    e8   c4     82.584
+ 70   08   08   3b   2d   70    e8   c4     78.342
+ 28   08   04   8b   2c   28    e8   c5     78.341
+ 28   08   08   4b   2c   28    e8   c5     78.339
+
+Error 3 occurred at disk power-on lifetime: 1029 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:40 SC:06 SN:3d CL:2d CH:70 D/H:e8 ST:d1
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 70   08   06   3d   2d   70    e8   c4     82.584
+ 70   08   08   3b   2d   70    e8   c4     78.342
+ 28   08   04   8b   2c   28    e8   c5     78.341
+ 28   08   08   4b   2c   28    e8   c5     78.339
+ 28   08   08   0b   2c   28    e8   c5     78.338
+
+Error 4 occurred at disk power-on lifetime: 1029 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:40 SC:08 SN:3b CL:2d CH:70 D/H:e8 ST:d1
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 70   08   08   3b   2d   70    e8   c4     78.342
+ 28   08   04   8b   2c   28    e8   c5     78.341
+ 28   08   08   4b   2c   28    e8   c5     78.339
+ 28   08   08   0b   2c   28    e8   c5     78.338
+ 28   08   08   cb   2b   28    e8   c5     78.337
+
+Error 5 occurred at disk power-on lifetime: 1029 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:40 SC:66 SN:41 CL:2d CH:70 D/H:e8 ST:d1
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 70   08   66   41   2d   70    e8   c4     69.020
+ 70   08   68   3f   2d   70    e8   c4     64.956
+ 70   08   6a   3d   2d   70    e8   c4     60.891
+ 70   08   6c   3b   2d   70    e8   c4     56.826
+ 70   08   fe   a9   2c   70    e8   c4     52.713
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended off-line   Completed: read failure       90%      1965         0x08702f11
+# 2  Short off-line      Completed                     00%      1800         
+# 3  Short off-line      Completed                     00%      1778         
+# 4  Short off-line      Completed                     00%      1777         
diff --git a/test/smart/MAXTOR-1.txt b/test/smart/MAXTOR-1.txt
new file mode 100644 (file)
index 0000000..b1ed8ac
--- /dev/null
@@ -0,0 +1,143 @@
+smartctl version 5.0-24 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     MAXTOR 4K080H4                          
+Serial Number:    674119123435        
+Firmware Version: A08.1500
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: FAILED!
+Drive failure expected in less than 24 hours. SAVE ALL DATA.
+See vendor-specific Attribute list for failed Attributes.
+
+General SMART Values:
+Off-line data collection status: (0x04)        Offline data collection activity was 
+                                       suspended by an interrupting command from host.
+Self-test execution status:      (  89)        The previous self-test completed having
+                                       the electrical element of the test
+                                       failed.
+Total time to complete off-line 
+data collection:                (2536) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  50) minutes.
+
+SMART Attributes Data Structure revision number: 11
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x0029   100   253   020    Pre-fail     -       0
+  3 Spin_Up_Time            0x0027   074   074   020    Pre-fail     -       3294
+  4 Start_Stop_Count        0x0032   100   100   008    Old_age      -       32
+  5 Reallocated_Sector_Ct   0x0033   001   001   020    Pre-fail FAILING_NOW 499
+  7 Seek_Error_Rate         0x000b   100   001   023    Pre-fail In_the_past 0
+  9 Power_On_Hours          0x0012   086   086   001    Old_age      -       9812
+ 10 Spin_Retry_Count        0x0026   100   100   000    Old_age      -       0
+ 11 Calibration_Retry_Count 0x0013   100   100   020    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   008    Old_age      -       32
+ 13 Read_Soft_Error_Rate    0x000b   100   001   023    Pre-fail In_the_past 0
+194 Temperature_Centigrade  0x0022   091   086   042    Old_age      -       24
+195 Hardware_ECC_Recovered  0x001a   006   004   000    Old_age      -       417912090
+196 Reallocated_Event_Count 0x0010   100   100   020    Old_age      -       0
+197 Current_Pending_Sector  0x0032   033   032   020    Old_age      -       338
+198 Offline_Uncorrectable   0x0010   100   100   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x001a   200   200   000    Old_age      -       0
+
+SMART Error Log Version: 1
+ATA Error Count: 20255 (device log contains only the most recent five errors)
+       DCR = Device Control Register
+       FR  = Features Register
+       SC  = Sector Count Register
+       SN  = Sector Number Register
+       CL  = Cylinder Low Register
+       CH  = Cylinder High Register
+       D/H = Device/Head Register
+       CR  = Content written to Command Register
+       ER  = Error register
+       STA = Status register
+Timestamp is seconds since the previous disk power-on.
+Note: timestamp "wraps" after 2^32 msec = 49.710 days.
+
+Error 1 occurred at disk power-on lifetime: 9574 hours
+When the command that caused the error occurred, the device was in a vendor specific or reserved state.
+After command completion occurred, registers were:
+ER:40 SC:60 SN:b8 CL:c6 CH:02 D/H:e5 ST:d1
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 02   05   60   b8   c6   02    e5   c4     474.857
+ 02   05   f8   20   c6   02    e5   c4     470.748
+ 02   05   08   18   c6   02    e5   c4     470.746
+ 00   00   f8   20   c5   02    e5   c4     470.732
+ 00   00   08   18   c5   02    e5   c4     470.730
+
+Error 2 occurred at disk power-on lifetime: 9574 hours
+When the command that caused the error occurred, the device was in a vendor specific or reserved state.
+After command completion occurred, registers were:
+ER:40 SC:68 SN:b0 CL:c6 CH:02 D/H:e5 ST:d1
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 02   05   f8   20   c6   02    e5   c4     470.748
+ 02   05   08   18   c6   02    e5   c4     470.746
+ 00   00   f8   20   c5   02    e5   c4     470.732
+ 00   00   08   18   c5   02    e5   c4     470.730
+ 02   05   f8   20   c4   02    e5   c4     470.717
+
+Error 3 occurred at disk power-on lifetime: 9574 hours
+When the command that caused the error occurred, the device was in a vendor specific or reserved state.
+After command completion occurred, registers were:
+ER:40 SC:08 SN:c0 CL:3e CH:0e D/H:e5 ST:d1
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 0e   05   08   c0   3e   0e    e5   c4     181.677
+ d0   04   08   b0   67   d0    e4   c5     181.651
+ 0e   05   08   a0   45   0e    e5   c4     181.646
+ 0e   05   80   20   43   0e    e5   c4     181.635
+ 0e   05   80   20   41   0e    e5   c4     181.622
+
+Error 4 occurred at disk power-on lifetime: 9574 hours
+When the command that caused the error occurred, the device was in a vendor specific or reserved state.
+After command completion occurred, registers were:
+ER:40 SC:60 SN:c0 CL:3e CH:0e D/H:e5 ST:d1
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 0e   05   80   a0   3e   0e    e5   c4     172.530
+ 0e   05   80   20   3d   0e    e5   c4     172.335
+ 0e   05   80   20   3c   0e    e5   c4     164.744
+ 0e   05   10   10   3b   0e    e5   c4     164.736
+ 0e   05   f8   18   3a   0e    e5   c4     157.202
+
+Error 5 occurred at disk power-on lifetime: 9574 hours
+When the command that caused the error occurred, the device was in a vendor specific or reserved state.
+After command completion occurred, registers were:
+ER:40 SC:c0 SN:18 CL:04 CH:d3 D/H:e4 ST:d1
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ d3   04   c0   18   04   d3    e4   c4     502.837
+ d3   04   f8   e0   03   d3    e4   c4     498.739
+ d3   04   f8   e8   02   d3    e4   c4     498.716
+ 55   01   c8   90   70   55    e1   c4     498.705
+ 55   01   38   48   70   55    e1   c4     498.680
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Short off-line      Completed: electrical failure 90%      9786         
+# 2  Extended captive    Completed: servo/seek failure 90%      9676         0x04b7ed3d
+# 3  Extended captive    Completed                     00%      9575         
+# 4  Extended off-line   Completed                     00%      9432         
+# 5  Extended off-line   Completed                     00%      9415         
diff --git a/test/smart/MAXTOR-10.txt b/test/smart/MAXTOR-10.txt
new file mode 100644 (file)
index 0000000..adb8beb
--- /dev/null
@@ -0,0 +1,188 @@
+smartctl version 5.22 Copyright (C) 2002-3 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     MAXTOR 4K080H4
+Serial Number:    674119014987
+Firmware Version: A08.1500
+Device is:        In smartctl database [for details use: -P show]
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+Local Time is:    Mon Oct 27 14:30:17 2003 CST
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+General SMART Values:
+Offline data collection status:  (0x80)        Offline data collection activity was
+                                       never started.
+                                       Auto Offline Data Collection: Enabled.
+Self-test execution status:      ( 112)        The previous self-test completed having
+                                       the read element of the test failed.
+Total time to complete Offline 
+data collection:                (  44) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Auto Offline data collection on/off support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+                                       No Conveyance Self-test supported.
+                                       No Selective Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+                                       No General Purpose Logging support.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine
+recommended polling time:       (  50) minutes.
+
+SMART Attributes Data Structure revision number: 11
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x0029   100   253   020    Pre-fail  Offline      -       0
+  3 Spin_Up_Time            0x0027   075   074   020    Pre-fail  Always       -       3135
+  4 Start_Stop_Count        0x0032   100   100   008    Old_age   Always       -       54
+  5 Reallocated_Sector_Ct   0x0033   098   097   020    Pre-fail  Always       -       14
+  7 Seek_Error_Rate         0x000b   100   100   023    Pre-fail  Always       -       0
+  9 Power_On_Hours          0x0012   072   072   001    Old_age   Always       -       18875
+ 10 Spin_Retry_Count        0x0026   100   100   000    Old_age   Always       -       0
+ 11 Calibration_Retry_Count 0x0013   100   100   020    Pre-fail  Always       -       0
+ 12 Power_Cycle_Count       0x0032   100   100   008    Old_age   Always       -       53
+ 13 Read_Soft_Error_Rate    0x000b   100   085   023    Pre-fail  Always       -       0
+194 Temperature_Celsius     0x0022   093   088   042    Old_age   Always       -       20
+195 Hardware_ECC_Recovered  0x001a   028   002   000    Old_age   Always       -       1472864733
+196 Reallocated_Event_Count 0x0010   100   099   020    Old_age   Offline      -       0
+197 Current_Pending_Sector  0x0032   100   100   020    Old_age   Always       -       2
+198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
+199 UDMA_CRC_Error_Count    0x001a   200   200   000    Old_age   Always       -       0
+
+SMART Error Log Version: 1
+ATA Error Count: 28 (device log contains only the most recent five errors)
+       CR = Command Register [HEX]
+       FR = Features Register [HEX]
+       SC = Sector Count Register [HEX]
+       SN = Sector Number Register [HEX]
+       CL = Cylinder Low Register [HEX]
+       CH = Cylinder High Register [HEX]
+       DH = Device/Head Register [HEX]
+       DC = Device Command Register [HEX]
+       ER = Error register [HEX]
+       ST = Status register [HEX]
+Timestamp = decimal seconds since the previous disk power-on.
+Note: timestamp "wraps" after 2^32 msec = 49.710 days.
+
+Error 28 occurred at disk power-on lifetime: 18785 hours
+  When the command that caused the error occurred, the device was in an unknown state.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 d1 38 ce 8f 40 e0  Error: UNC
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  c8 00 38 ce 8f 40 e0 40     315.769  READ DMA
+  c8 00 40 c6 8f 40 e0 40     311.634  READ DMA
+  b0 00 01 01 4f c2 e0 1f     284.485  [Reserved SMART command]
+  b0 00 01 06 4f c2 e0 34     284.470  [Reserved SMART command]
+  b0 00 01 00 4f c2 e0 34     284.399  [Reserved SMART command]
+
+Error 27 occurred at disk power-on lifetime: 18785 hours
+  When the command that caused the error occurred, the device was in an unknown state.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 59 38 ce 8f 40 e0  Error: UNC
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  c8 00 40 c6 8f 40 e0 40     311.634  READ DMA
+  b0 00 01 01 4f c2 e0 1f     284.485  [Reserved SMART command]
+  b0 00 01 06 4f c2 e0 34     284.470  [Reserved SMART command]
+  b0 00 01 00 4f c2 e0 34     284.399  [Reserved SMART command]
+  b0 00 00 00 4f c2 00 34     284.328  [Reserved SMART command]
+
+Error 26 occurred at disk power-on lifetime: 18744 hours
+  When the command that caused the error occurred, the device was in an unknown state.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 d1 08 bf 00 30 e0  Error: UNC
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  c8 00 08 bf 00 30 e0 30     134.258  READ DMA
+  c8 00 08 cf 3d 34 e0 34     134.247  READ DMA
+  c8 00 08 af 00 34 e0 34     134.215  READ DMA
+  c8 00 28 6f 3e 28 e0 28     134.213  READ DMA
+  c8 00 08 67 3e 28 e0 28     134.201  READ DMA
+
+Error 25 occurred at disk power-on lifetime: 18619 hours
+  When the command that caused the error occurred, the device was in an unknown state.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 59 07 89 67 10 e3  Error: UNC
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  c8 03 08 88 67 10 e3 10      54.493  READ DMA
+  c8 03 08 88 69 08 e3 08      54.483  READ DMA
+  c8 03 08 88 67 08 e3 08      54.471  READ DMA
+  c8 02 08 88 69 ec e2 ec      54.464  READ DMA
+  c8 02 08 88 67 ec e2 ec      54.439  READ DMA
+
+Error 24 occurred at disk power-on lifetime: 18619 hours
+  When the command that caused the error occurred, the device was in an unknown state.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 59 06 8a 67 0c e2  Error: UNC
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  c8 02 08 88 67 0c e2 0c      49.281  READ DMA
+  c8 02 08 88 69 08 e2 08      49.270  READ DMA
+  c8 02 08 88 69 04 e2 04      49.259  READ DMA
+  c8 02 08 88 69 00 e2 00      49.257  READ DMA
+  c8 02 08 50 5c 00 e2 00      49.254  READ DMA
+
+SMART Self-test log structure revision number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended offline    Completed: read failure       80%     18841         0x001f807f
+# 2  Extended offline    Completed: read failure       80%     18673         0x020c678a
+# 3  Extended offline    Completed: read failure       80%     18505         0x020c678a
+# 4  Extended offline    Completed: read failure       80%     18338         0x020c678a
+# 5  Extended offline    Completed: read failure       90%     18229         0x00408f96
+# 6  Extended offline    Completed: read failure       80%     18171         0x02386789
+# 7  Extended offline    Completed without error       00%     18051         -
+# 8  Short offline       Completed without error       00%     18051         -
+# 9  Extended offline    Completed without error       00%     18003         -
+#10  Extended offline    Completed without error       00%     17836         -
+#11  Extended offline    Completed without error       00%     17668         -
+#12  Extended offline    Completed without error       00%     17501         -
+#13  Extended offline    Completed without error       00%     17334         -
+#14  Extended offline    Completed without error       00%     17166         -
+#15  Extended offline    Completed without error       00%     16999         -
+#16  Extended offline    Completed without error       00%     16831         -
+#17  Extended offline    Completed without error       00%     16664         -
+#18  Extended offline    Completed without error       00%     16603         -
+#19  Extended offline    Completed without error       00%     16497         -
+#20  Extended offline    Completed without error       00%     16329         -
+#21  Extended offline    Completed without error       00%     16163         -
+
diff --git a/test/smart/MAXTOR-2.txt b/test/smart/MAXTOR-2.txt
new file mode 100644 (file)
index 0000000..9ff60ff
--- /dev/null
@@ -0,0 +1,79 @@
+smartctl version 5.0-24 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     MAXTOR 4K080H4                          
+Serial Number:    674119113862        
+Firmware Version: A08.1500
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+See vendor-specific Attribute list for marginal Attributes.
+
+General SMART Values:
+Off-line data collection status: (0x05)        Offline data collection activity was 
+                                       aborted by an interrupting command from host.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                (  44) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  50) minutes.
+
+SMART Attributes Data Structure revision number: 11
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x0029   100   253   020    Pre-fail     -       0
+  3 Spin_Up_Time            0x0027   075   075   020    Pre-fail     -       3249
+  4 Start_Stop_Count        0x0032   100   100   008    Old_age      -       31
+  5 Reallocated_Sector_Ct   0x0033   100   100   020    Pre-fail     -       0
+  7 Seek_Error_Rate         0x000b   100   001   023    Pre-fail In_the_past 0
+  9 Power_On_Hours          0x0012   086   086   001    Old_age      -       9754
+ 10 Spin_Retry_Count        0x0026   100   100   000    Old_age      -       0
+ 11 Calibration_Retry_Count 0x0013   100   100   020    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   008    Old_age      -       31
+ 13 Read_Soft_Error_Rate    0x000b   100   100   023    Pre-fail     -       0
+194 Temperature_Centigrade  0x0022   035   032   042    Old_age  FAILING_NOW 168
+195 Hardware_ECC_Recovered  0x001a   100   002   000    Old_age      -       880099716
+196 Reallocated_Event_Count 0x0010   100   100   020    Old_age      -       0
+197 Current_Pending_Sector  0x0032   100   100   020    Old_age      -       0
+198 Offline_Uncorrectable   0x0010   100   253   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x001a   200   200   000    Old_age      -       0
+
+SMART Error Log Version: 1
+No Errors Logged
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Short off-line      Completed                     00%      9691         
+# 2  Short captive       Completed                     00%      9691         
+# 3  Extended captive    Completed                     00%      9618         
+# 4  Extended captive    Interrupted (host reset)      90%      9563         
+# 5  Short captive       Completed                     00%      9563         
+# 6  Short off-line      Completed                     00%      9563         
+# 7  Short captive       Completed                     00%      9545         
+# 8  Extended off-line   Completed                     00%      9541         
+# 9  Short captive       Completed                     00%      9541         
+#10  Extended off-line   Completed                     00%      9537         
+#11  Extended off-line   Completed                     00%      9536         
+#12  Extended off-line   Interrupted (host reset)      90%      9534         
+#13  Extended off-line   Completed                     00%      9517         
+#14  Extended off-line   Completed                     00%      9484         
diff --git a/test/smart/MAXTOR-3.txt b/test/smart/MAXTOR-3.txt
new file mode 100644 (file)
index 0000000..26df69e
--- /dev/null
@@ -0,0 +1,67 @@
+smartctl version 5.0-24 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     MAXTOR 6L080J4                          
+Serial Number:    664201100034        
+Firmware Version: A93.0500
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+General SMART Values:
+Off-line data collection status: (0x00)        Offline data collection activity was
+                                       never started.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                (  35) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  40) minutes.
+
+SMART Attributes Data Structure revision number: 11
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x0029   100   253   020    Pre-fail     -       0
+  3 Spin_Up_Time            0x0027   069   066   020    Pre-fail     -       3984
+  4 Start_Stop_Count        0x0032   100   100   008    Old_age      -       110
+  5 Reallocated_Sector_Ct   0x0033   100   100   020    Pre-fail     -       0
+  7 Seek_Error_Rate         0x000b   100   100   023    Pre-fail     -       0
+  9 Power_On_Hours          0x0012   099   099   001    Old_age      -       1294
+ 10 Spin_Retry_Count        0x0026   100   100   000    Old_age      -       0
+ 11 Calibration_Retry_Count 0x0013   100   100   020    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   008    Old_age      -       110
+ 13 Read_Soft_Error_Rate    0x000b   100   100   023    Pre-fail     -       0
+194 Temperature_Centigrade  0x0022   092   087   042    Old_age      -       22
+195 Hardware_ECC_Recovered  0x001a   100   100   000    Old_age      -       1163
+196 Reallocated_Event_Count 0x0010   100   100   020    Old_age      -       0
+197 Current_Pending_Sector  0x0032   100   100   020    Old_age      -       0
+198 Offline_Uncorrectable   0x0010   100   253   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x001a   200   200   000    Old_age      -       0
+
+SMART Error Log Version: 1
+No Errors Logged
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended off-line   Completed                     00%      1038         
+# 2  Extended off-line   Aborted by host               00%       786         
+# 3  Extended off-line   Aborted by host               00%       786         
diff --git a/test/smart/MAXTOR-4.txt b/test/smart/MAXTOR-4.txt
new file mode 100644 (file)
index 0000000..65ae285
--- /dev/null
@@ -0,0 +1,65 @@
+smartctl version 5.0-24 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     MAXTOR 6L080J4                          
+Serial Number:    664205757172        
+Firmware Version: A93.0500
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+General SMART Values:
+Off-line data collection status: (0x04)        Offline data collection activity was 
+                                       suspended by an interrupting command from host.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                (  35) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  40) minutes.
+
+SMART Attributes Data Structure revision number: 11
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x0029   100   253   020    Pre-fail     -       0
+  3 Spin_Up_Time            0x0027   065   064   020    Pre-fail     -       4481
+  4 Start_Stop_Count        0x0032   100   100   008    Old_age      -       81
+  5 Reallocated_Sector_Ct   0x0033   100   100   020    Pre-fail     -       0
+  7 Seek_Error_Rate         0x000b   100   100   023    Pre-fail     -       0
+  9 Power_On_Hours          0x0012   098   098   001    Old_age      -       1767
+ 10 Spin_Retry_Count        0x0026   100   100   000    Old_age      -       0
+ 11 Calibration_Retry_Count 0x0013   100   100   020    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   008    Old_age      -       81
+ 13 Read_Soft_Error_Rate    0x000b   100   100   023    Pre-fail     -       0
+194 Temperature_Centigrade  0x0022   091   084   042    Old_age      -       24
+195 Hardware_ECC_Recovered  0x001a   100   100   000    Old_age      -       52795
+196 Reallocated_Event_Count 0x0010   100   100   020    Old_age      -       0
+197 Current_Pending_Sector  0x0032   100   100   020    Old_age      -       0
+198 Offline_Uncorrectable   0x0010   100   253   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x001a   200   200   000    Old_age      -       0
+
+SMART Error Log Version: 1
+No Errors Logged
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended off-line   Completed                     00%      1283         
diff --git a/test/smart/MAXTOR-6.txt b/test/smart/MAXTOR-6.txt
new file mode 100644 (file)
index 0000000..fe37f65
--- /dev/null
@@ -0,0 +1,156 @@
+# /usr/sbin/smartctl -a -m /dev/hda
+smartctl version 5.0-49 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     Maxtor 4R080J0                          
+Serial Number:    R20BZ3LE            
+Firmware Version: RAMB1TU0
+ATA Version is:   7
+ATA Standard is:  Unrecognized. Minor revision code: 0x1e
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+General SMART Values:
+Off-line data collection status: (0x82)        Offline data collection activity 
+                                       completed without error.
+Self-test execution status:      (  33)        The self-test routine was interrupted
+                                       by the host with a hard or soft reset.
+Total time to complete off-line 
+data collection:                ( 241) seconds.
+Offline data collection
+capabilities:                   (0x5b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  41) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  3 Spin_Up_Time            0x0027   252   252   063    Pre-fail     -       1621
+  4 Start_Stop_Count        0x0032   253   253   000    Old_age      -       18
+  5 Reallocated_Sector_Ct   0x0033   253   253   063    Pre-fail     -       0
+  6 Read_Channel_Margin     0x0001   253   253   100    Pre-fail     -       0
+  7 Seek_Error_Rate         0x000a   253   252   000    Old_age      -       0
+  8 Seek_Time_Performance   0x0027   252   244   187    Pre-fail     -       41642
+  9 Power_On_Hours          0x0032   253   253   000    Old_age      -       27 h + 13 m
+ 10 Spin_Retry_Count        0x002b   252   252   157    Pre-fail     -       0
+ 11 Calibration_Retry_Count 0x002b   253   252   223    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   253   253   000    Old_age      -       24
+192 Power-Off_Retract_Count 0x0032   253   253   000    Old_age      -       0
+193 Load_Cycle_Count        0x0032   253   253   000    Old_age      -       0
+194 Temperature_Celsius     0x0032   253   253   000    Old_age      -       29
+195 Hardware_ECC_Recovered  0x000a   253   252   000    Old_age      -       31004
+196 Reallocated_Event_Count 0x0008   253   253   000    Old_age      -       0
+197 Current_Pending_Sector  0x0008   253   253   000    Old_age      -       0
+198 Offline_Uncorrectable   0x0008   253   253   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x0008   199   199   000    Old_age      -       0
+200 Multi_Zone_Error_Rate   0x000a   253   252   000    Old_age      -       0
+201 Unknown_Attribute       0x000a   253   252   000    Old_age      -       3
+202 Unknown_Attribute       0x000a   253   252   000    Old_age      -       0
+203 Unknown_Attribute       0x000b   253   252   180    Pre-fail     -       2
+204 Unknown_Attribute       0x000a   253   252   000    Old_age      -       0
+205 Unknown_Attribute       0x000a   253   252   000    Old_age      -       0
+207 Unknown_Attribute       0x002a   252   252   000    Old_age      -       0
+208 Unknown_Attribute       0x002a   252   252   000    Old_age      -       0
+209 Unknown_Attribute       0x0024   079   063   000    Old_age      -       0
+ 99 Unknown_Attribute       0x0004   253   253   000    Old_age      -       0
+100 Unknown_Attribute       0x0004   253   253   000    Old_age      -       0
+101 Unknown_Attribute       0x0004   253   253   000    Old_age      -       0
+
+SMART Error Log Version: 1
+ATA Error Count: 5
+       DCR = Device Control Register
+       FR  = Features Register
+       SC  = Sector Count Register
+       SN  = Sector Number Register
+       CL  = Cylinder Low Register
+       CH  = Cylinder High Register
+       D/H = Device/Head Register
+       CR  = Content written to Command Register
+       ER  = Error register
+       STA = Status register
+Timestamp is seconds since the previous disk power-on.
+Note: timestamp "wraps" after 2^32 msec = 49.710 days.
+
+Error 5 occurred at disk power-on lifetime: 4 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:04 SC:00 SN:00 CL:f4 CH:2c D/H:00 ST:01
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 0e   d4   00   82   4f   c2    f0   b0     8907.296
+ 08   d4   00   82   4f   c2    f0   b0     6260.832
+ 08   d1   01   01   4f   c2    f0   b0     6260.800
+ 08   d0   01   00   4f   c2    f0   b0     6260.768
+ 08   da   00   00   4f   c2    10   b0     6260.736
+
+Error 4 occurred at disk power-on lifetime: 1 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:04 SC:00 SN:00 CL:f4 CH:2c D/H:00 ST:01
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 0e   d4   00   82   4f   c2    f0   b0     1944.192
+ 08   d4   00   82   4f   c2    f0   b0     1824.240
+ 08   d1   01   01   4f   c2    f0   b0     1824.224
+ 08   d0   01   00   4f   c2    f0   b0     1824.160
+ 08   00   08   3f   00   00    f0   ca     1810.400
+
+Error 3 occurred at disk power-on lifetime: 1 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:04 SC:00 SN:00 CL:f4 CH:2c D/H:00 ST:01
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 0e   d4   00   82   4f   c2    f0   b0     1456.432
+ 08   d4   00   82   4f   c2    f0   b0     1379.456
+ 08   d1   01   01   4f   c2    f0   b0     1379.440
+ 08   d0   01   00   4f   c2    f0   b0     1379.376
+ 08   00   08   f7   01   54    f0   ca     1378.544
+
+Error 2 occurred at disk power-on lifetime: 0 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:04 SC:00 SN:00 CL:f4 CH:2c D/H:00 ST:51
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 08   d4   00   82   4f   c2    f0   b0     908.320
+ 08   d1   01   01   4f   c2    f0   b0     908.320
+ 08   d0   01   00   4f   c2    f0   b0     908.272
+ 08   d4   00   7f   4f   c2    f0   b0     905.696
+ 08   d1   01   01   4f   c2    f0   b0     905.664
+
+Error 1 occurred at disk power-on lifetime: 0 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:04 SC:50 SN:40 CL:97 CH:03 D/H:10 ST:51
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 00   fe   00   00   00   00    10   ef     137.184
+ 00   3d   00   00   00   00    10   c3     137.136
+ 00   e4   00   00   00   00    10   c3     137.088
+ 00   3d   00   00   00   00    10   c3     137.088
+ 00   00   00   00   5e   20    10   70     137.040
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended captive    Interrupted (host reset)      10%         4         
+# 2  Short off-line      Completed                     00%         2         
+# 3  Short captive       Completed                     00%         2         
+# 4  Extended captive    Interrupted (host reset)      40%         1         
+# 5  Extended captive    Interrupted (host reset)      70%         1         
+# 6  Extended captive    Interrupted (host reset)      40%         0         
diff --git a/test/smart/MAXTOR-7.txt b/test/smart/MAXTOR-7.txt
new file mode 100644 (file)
index 0000000..1d3fa00
--- /dev/null
@@ -0,0 +1,157 @@
+smartctl version 5.1-4 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     MAXTOR 4K080H4                          
+Serial Number:    674119114160        
+Firmware Version: A08.1500
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+Local Time is:    Tue May 13 08:59:49 2003 CDT
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: FAILED!
+Drive failure expected in less than 24 hours. SAVE ALL DATA.
+See vendor-specific Attribute list for failed Attributes.
+
+General SMART Values:
+Off-line data collection status: (0x82) Offline data collection activity 
+                                        completed without error.
+Self-test execution status:      ( 112) The previous self-test completed having
+                                        the read element of the test failed.
+Total time to complete off-line 
+data collection:                 (  44) seconds.
+Offline data collection
+capabilities:                    (0x1b) SMART execute Offline immediate.
+                                        Automatic timer ON/OFF support.
+                                        Suspend Offline collection upon new
+                                        command.
+                                        Offline surface scan supported.
+                                        Self-test supported.
+SMART capabilities:            (0x0003) Saves SMART data before entering
+                                        power-saving mode.
+                                        Supports SMART auto save timer.
+Error logging capability:        (0x01) Error logging supported.
+Short self-test routine 
+recommended polling time:        (   2) minutes.
+Extended self-test routine 
+recommended polling time:        (  50) minutes.
+
+SMART Attributes Data Structure revision number: 11
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x0029   100   253   020    Pre-fail     -       0
+  3 Spin_Up_Time            0x0027   075   075   020    Pre-fail     -       3214
+  4 Start_Stop_Count        0x0032   100   100   008    Old_age      -       58
+  5 Reallocated_Sector_Ct   0x0033   098   098   020    Pre-fail     -       12
+  7 Seek_Error_Rate         0x000b   001   001   023    Pre-fail FAILING_NOW 13
+  9 Power_On_Hours          0x0012   078   078   001    Old_age      -       14851
+ 10 Spin_Retry_Count        0x0026   100   100   000    Old_age      -       0
+ 11 Calibration_Retry_Count 0x0013   100   090   020    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   008    Old_age      -       58
+ 13 Read_Soft_Error_Rate    0x000b   100   085   023    Pre-fail     -       0
+194 Temperature_Celsius     0x0022   091   087   042    Old_age      -       24
+195 Hardware_ECC_Recovered  0x001a   004   003   000    Old_age      -       513691822
+196 Reallocated_Event_Count 0x0010   099   099   020    Old_age      -       1
+197 Current_Pending_Sector  0x0032   098   098   020    Old_age      -       12
+198 Offline_Uncorrectable   0x0010   100   100   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x001a   200   200   000    Old_age      -       0
+
+SMART Error Log Version: 1
+ATA Error Count: 25 (device log contains only the most recent five errors)
+        DCR = Device Control Register
+        FR  = Features Register
+        SC  = Sector Count Register
+        SN  = Sector Number Register
+        CL  = Cylinder Low Register
+        CH  = Cylinder High Register
+        D/H = Device/Head Register
+        CR  = Content written to Command Register
+        ER  = Error register
+        STA = Status register
+Timestamp is seconds since the previous disk power-on.
+Note: timestamp "wraps" after 2^32 msec = 49.710 days.
+
+Error 25 occurred at disk power-on lifetime: 14799 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:40 SC:04 SN:53 CL:1d CH:0c D/H:e0 ST:59
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 0c   00   08   4f   1d   0c    e0   c8     0.523
+ 0c   00   08   47   1d   0c    e0   c8     510.677
+ 04   00   08   6f   04   04    e0   ca     510.675
+ 04   00   08   4f   1c   04    e0   ca     510.674
+ 04   00   08   6f   04   04    e0   ca     510.674
+
+Error 24 occurred at disk power-on lifetime: 14799 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:40 SC:03 SN:44 CL:1d CH:0c D/H:e0 ST:59
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 0c   00   08   3f   1d   0c    e0   c8     495.294
+ 0c   00   08   37   1d   0c    e0   c8     491.239
+ 0c   00   08   2f   1d   0c    e0   c8     488.433
+ 14   00   08   17   04   14    e0   ca     488.432
+ 0c   00   08   b7   00   0c    e0   ca     488.432
+
+Error 23 occurred at disk power-on lifetime: 14799 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:40 SC:06 SN:21 CL:18 CH:0c D/H:e0 ST:59
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 0c   00   08   1f   18   0c    e0   c8     392.659
+ 00   00   08   17   18   0c    e0   c8     392.654
+ 0c   00   08   0f   18   0c    e0   c8     392.624
+ 00   00   08   07   18   0c    e0   c8     392.620
+ 00   00   08   ff   17   0c    e0   c8     392.615
+
+Error 22 occurred at disk power-on lifetime: 14799 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:40 SC:05 SN:b2 CL:16 CH:0c D/H:e0 ST:59
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 0c   00   08   af   16   0c    e0   c8     385.889
+ 04   00   08   6f   04   04    e0   ca     385.886
+ 04   00   08   4f   1c   04    e0   ca     385.886
+ 04   00   08   6f   04   04    e0   ca     385.886
+ 04   00   08   4f   1c   04    e0   ca     385.885
+
+Error 21 occurred at disk power-on lifetime: 14799 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:40 SC:06 SN:a9 CL:16 CH:0c D/H:e0 ST:59
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 0c   00   08   a7   16   0c    e0   c8     381.795
+ 04   00   08   6f   04   04    e0   ca     381.793
+ 04   00   08   4f   1c   04    e0   ca     381.793
+ 04   00   08   6f   04   04    e0   ca     381.792
+ 04   00   08   4f   1c   04    e0   ca     381.792
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended off-line   Completed: read failure       90%     14757         0x000409bb
+# 2  Extended off-line   Completed: read failure       90%     14755         0x000bf956
+# 3  Extended off-line   Completed                     00%     14305         -
+# 4  Extended off-line   Completed                     00%     14100         -
+# 5  Extended off-line   Completed                     00%     13721         -
+# 6  Extended off-line   Completed                     00%     13636         -
+# 7  Extended off-line   Completed                     00%     13233         -
+# 8  Extended off-line   Completed                     00%     13078         -
+# 9  Extended off-line   Completed                     00%     12093         -
+#10  Extended off-line   Completed                     00%     11926         -
+#11  Extended off-line   Completed                     00%     11428         -
+#12  Extended off-line   Completed                     00%     11030         -
+#13  Extended off-line   Completed                     00%     10888         -
+#14  Extended off-line   Completed                     00%     10728         -
+#15  Extended off-line   Completed                     00%     10435         -
+#16  Extended off-line   Completed                     00%     10267         -
+#17  Extended off-line   Completed                     00%     10098         -
+#18  Extended off-line   Completed                     00%      9930         -
+#19  Extended off-line   Completed                     00%      9599         -
diff --git a/test/smart/MAXTOR-8.txt b/test/smart/MAXTOR-8.txt
new file mode 100644 (file)
index 0000000..3ae4d87
--- /dev/null
@@ -0,0 +1,82 @@
+smartctl version 5.1-14 Copyright (C) 2002-3 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     MAXTOR 4K080H4
+Serial Number:    674119116076
+Firmware Version: A08.1500
+Device is:        In smartctl database [for details use: -P show]
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+Local Time is:    Tue Jun 17 14:46:37 2003 CDT
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: FAILED!
+Drive failure expected in less than 24 hours. SAVE ALL DATA.
+See vendor-specific Attribute list for failed Attributes.
+
+General SMART Values:
+Off-line data collection status: (0x82)        Offline data collection activity was
+                                       completed without error.
+                                       Auto Off-line Data Collection: Enabled.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                (  44) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+                                       No Conveyance Self-test supported.
+                                       No Selective Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+                                       No General Purpose Logging support.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  50) minutes.
+
+SMART Attributes Data Structure revision number: 11
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x0029   100   253   020    Pre-fail  Offline      -       0
+  3 Spin_Up_Time            0x0027   075   075   020    Pre-fail  Always       -       3249
+  4 Start_Stop_Count        0x0032   100   100   008    Old_age   Always       -       45
+  5 Reallocated_Sector_Ct   0x0033   100   100   020    Pre-fail  Always       -       0
+  7 Seek_Error_Rate         0x000b   100   001   023    Pre-fail  Always   In_the_past 0
+  9 Power_On_Hours          0x0012   082   082   001    Old_age   Always       -       12223
+ 10 Spin_Retry_Count        0x0026   100   100   000    Old_age   Always       -       0
+ 11 Calibration_Retry_Count 0x0013   020   020   020    Pre-fail  Always   FAILING_NOW 8
+ 12 Power_Cycle_Count       0x0032   100   100   008    Old_age   Always       -       45
+ 13 Read_Soft_Error_Rate    0x000b   100   100   023    Pre-fail  Always       -       0
+194 Temperature_Celsius     0x0022   094   088   042    Old_age   Always       -       17
+195 Hardware_ECC_Recovered  0x001a   100   007   000    Old_age   Always       -       494134044
+196 Reallocated_Event_Count 0x0010   100   100   020    Old_age   Offline      -       0
+197 Current_Pending_Sector  0x0032   100   100   020    Old_age   Always       -       0
+198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
+199 UDMA_CRC_Error_Count    0x001a   200   200   000    Old_age   Always       -       0
+
+SMART Error Log Version: 1
+No Errors Logged
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended off-line   Completed                     00%     11610         -
+# 2  Extended off-line   Completed                     00%     11213         -
+# 3  Extended off-line   Completed                     00%     11072         -
+# 4  Extended off-line   Completed                     00%     10911         -
+# 5  Extended off-line   Completed                     00%     10618         -
+# 6  Extended off-line   Completed                     00%     10450         -
+# 7  Extended off-line   Completed                     00%     10282         -
+# 8  Extended off-line   Completed                     00%     10114         -
+# 9  Extended off-line   Completed                     00%      9783         -
+
diff --git a/test/smart/MAXTOR-9.txt b/test/smart/MAXTOR-9.txt
new file mode 100644 (file)
index 0000000..6a69242
--- /dev/null
@@ -0,0 +1,94 @@
+smartctl version 5.1-14 Copyright (C) 2002-3 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     MAXTOR 4K080H4
+Serial Number:    674119123112
+Firmware Version: A08.1500
+Device is:        In smartctl database [for details use: -P show]
+ATA Version is:   5
+ATA Standard is:  ATA/ATAPI-5 T13 1321D revision 1
+Local Time is:    Tue Aug 19 02:06:11 2003 CDT
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: FAILED!
+Drive failure expected in less than 24 hours. SAVE ALL DATA.
+See vendor-specific Attribute list for failed Attributes.
+
+General SMART Values:
+Off-line data collection status: (0x80)        Offline data collection activity was
+                                       never started.
+                                       Auto Off-line Data Collection: Enabled.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                (  44) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+                                       No Conveyance Self-test supported.
+                                       No Selective Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+                                       No General Purpose Logging support.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  50) minutes.
+
+SMART Attributes Data Structure revision number: 11
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x0029   100   253   020    Pre-fail  Offline      -       0
+  3 Spin_Up_Time            0x0027   075   074   020    Pre-fail  Always       -       3186
+  4 Start_Stop_Count        0x0032   100   100   008    Old_age   Always       -       68
+  5 Reallocated_Sector_Ct   0x0033   100   100   020    Pre-fail  Always       -       0
+  7 Seek_Error_Rate         0x000b   100   100   023    Pre-fail  Always       -       0
+  9 Power_On_Hours          0x0012   074   074   001    Old_age   Always       -       17202
+ 10 Spin_Retry_Count        0x0026   100   100   000    Old_age   Always       -       0
+ 11 Calibration_Retry_Count 0x0013   010   010   020    Pre-fail  Always   FAILING_NOW 9
+ 12 Power_Cycle_Count       0x0032   100   100   008    Old_age   Always       -       68
+ 13 Read_Soft_Error_Rate    0x000b   100   100   023    Pre-fail  Always       -       0
+194 Temperature_Celsius     0x0022   092   087   042    Old_age   Always       -       22
+195 Hardware_ECC_Recovered  0x001a   018   003   000    Old_age   Always       -       1082933060
+196 Reallocated_Event_Count 0x0010   100   100   020    Old_age   Offline      -       0
+197 Current_Pending_Sector  0x0032   100   100   020    Old_age   Always       -       0
+198 Offline_Uncorrectable   0x0010   100   253   000    Old_age   Offline      -       0
+199 UDMA_CRC_Error_Count    0x001a   200   200   000    Old_age   Always       -       0
+
+SMART Error Log Version: 1
+No Errors Logged
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended off-line   Completed                     00%     17157         -
+# 2  Extended off-line   Completed                     00%     16990         -
+# 3  Extended off-line   Completed                     00%     16823         -
+# 4  Extended off-line   Completed                     00%     16657         -
+# 5  Extended off-line   Completed                     00%     16598         -
+# 6  Extended off-line   Completed                     00%     16490         -
+# 7  Extended off-line   Completed                     00%     16323         -
+# 8  Extended off-line   Completed                     00%     16157         -
+# 9  Extended off-line   Completed                     00%     15991         -
+#10  Extended off-line   Completed                     00%     15696         -
+#11  Extended off-line   Completed                     00%     15614         -
+#12  Extended off-line   Completed                     00%     15241         -
+#13  Extended off-line   Completed                     00%     15026         -
+#14  Extended off-line   Completed                     00%     14785         -
+#15  Extended off-line   Completed                     00%     14334         -
+#16  Extended off-line   Completed                     00%     14129         -
+#17  Extended off-line   Completed                     00%     13750         -
+#18  Extended off-line   Completed                     00%     13665         -
+#19  Extended off-line   Completed                     00%     13262         -
+#20  Extended off-line   Completed                     00%     13108         -
+#21  Extended off-line   Completed                     00%     12125         -
+
diff --git a/test/smart/Maxtor-5.txt b/test/smart/Maxtor-5.txt
new file mode 100644 (file)
index 0000000..3bb171e
--- /dev/null
@@ -0,0 +1,127 @@
+smartctl version 5.0-36 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     Maxtor 98196H8                          
+Serial Number:    V80HV6NC            
+Firmware Version: ZAH814Y0
+ATA Version is:   6
+ATA Standard is:  ATA/ATAPI-6 T13 1410D revision 0
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+General SMART Values:
+Off-line data collection status: (0x00)        Offline data collection activity was
+                                       never started.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                (  30) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  60) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000a   253   252   000    Old_age      -       26
+  3 Spin_Up_Time            0x0027   208   206   063    Pre-fail     -       11285
+  4 Start_Stop_Count        0x0032   253   253   000    Old_age      -       62
+  5 Reallocated_Sector_Ct   0x0033   253   253   063    Pre-fail     -       0
+  6 Read_Channel_Margin     0x0001   253   253   100    Pre-fail     -       0
+  7 Seek_Error_Rate         0x000a   253   252   000    Old_age      -       0
+  8 Seek_Time_Performance   0x0027   249   244   187    Pre-fail     -       50271
+  9 Power_On_Hours          0x0032   236   236   000    Old_age      -       32671
+ 10 Spin_Retry_Count        0x002b   253   252   223    Pre-fail     -       0
+ 11 Calibration_Retry_Count 0x002b   253   252   223    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   253   253   000    Old_age      -       67
+196 Reallocated_Event_Count 0x0008   253   253   000    Old_age      -       0
+197 Current_Pending_Sector  0x0008   253   253   000    Old_age      -       0
+198 Offline_Uncorrectable   0x0008   253   253   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x0008   199   199   000    Old_age      -       0
+200 Unknown_Attribute       0x000a   253   252   000    Old_age      -       0
+201 Unknown_Attribute       0x000a   253   252   000    Old_age      -       1
+202 Unknown_Attribute       0x000a   253   252   000    Old_age      -       0
+203 Unknown_Attribute       0x000b   253   252   180    Pre-fail     -       2
+204 Unknown_Attribute       0x000a   253   252   000    Old_age      -       0
+205 Unknown_Attribute       0x000a   253   252   000    Old_age      -       0
+207 Unknown_Attribute       0x002a   253   252   000    Old_age      -       0
+208 Unknown_Attribute       0x002a   253   252   000    Old_age      -       0
+209 Unknown_Attribute       0x0024   253   253   000    Old_age      -       0
+ 96 Unknown_Attribute       0x0004   253   253   000    Old_age      -       0
+ 97 Unknown_Attribute       0x0004   253   253   000    Old_age      -       0
+ 98 Unknown_Attribute       0x0004   253   253   000    Old_age      -       0
+ 99 Unknown_Attribute       0x0004   253   253   000    Old_age      -       0
+100 Unknown_Attribute       0x0004   253   253   000    Old_age      -       0
+101 Unknown_Attribute       0x0004   253   253   000    Old_age      -       0
+
+SMART Error Log Version: 1
+ATA Error Count: 3
+       DCR = Device Control Register
+       FR  = Features Register
+       SC  = Sector Count Register
+       SN  = Sector Number Register
+       CL  = Cylinder Low Register
+       CH  = Cylinder High Register
+       D/H = Device/Head Register
+       CR  = Content written to Command Register
+       ER  = Error register
+       STA = Status register
+Timestamp is seconds since the previous disk power-on.
+Note: timestamp "wraps" after 2^32 msec = 49.710 days.
+
+Error 1 occurred at disk power-on lifetime: 0 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:04 SC:40 SN:42 CL:97 CH:23 D/H:00 ST:51
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 00   fe   00   00   00   00    00   ef     137.440
+ 00   d9   00   00   4f   c2    00   b0     137.328
+ 00   da   00   00   4f   c2    00   b0     137.232
+ 00   d8   00   00   4f   c2    00   b0     137.152
+ 00   db   00   00   4f   c2    00   b0     136.976
+
+Error 2 occurred at disk power-on lifetime: 0 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:04 SC:40 SN:40 CL:97 CH:23 D/H:00 ST:51
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 00   fe   00   00   00   00    00   ef     342.432
+ 00   e4   00   00   00   00    00   c3     342.368
+ 00   d0   00   00   0a   00    00   c3     342.368
+ 00   fe   00   00   00   00    00   ef     342.304
+ 00   3d   00   00   00   00    00   c3     342.256
+
+Error 3 occurred at disk power-on lifetime: 0 hours
+When the command that caused the error occurred, the device was in an unknown state.
+After command completion occurred, registers were:
+ER:04 SC:40 SN:40 CL:97 CH:03 D/H:00 ST:51
+Sequence of commands leading to the command that caused the error were:
+DCR   FR   SC   SN   CL   CH   D/H   CR   Timestamp
+ 00   fe   00   00   00   00    00   ef     342.304
+ 00   3d   00   00   00   00    00   c3     342.256
+ 00   e4   00   00   00   00    00   c3     342.192
+ 00   3d   00   00   00   00    00   c3     342.192
+ 00   00   01   01   00   00    00   ec     342.144
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Short off-line      Completed                     00%      5255         
diff --git a/test/smart/README b/test/smart/README
new file mode 100644 (file)
index 0000000..90676a4
--- /dev/null
@@ -0,0 +1,8 @@
+
+The files in this directory are from the smartmontools project, see
+
+ http://smartmontools.sourceforge.net/help.html
+
+To feed data into the DeviceKit-disks daemon, use a command like this
+
+ $ sudo dbus-send --print-reply --system --dest=org.freedesktop.DeviceKit.Disks /devices/sda org.freedesktop.DeviceKit.Disks.Device.DriveSmartRefreshData array:string:simulate=/home/davidz/Hacking/DeviceKit-disks/test/smart/WD800JD.txt
diff --git a/test/smart/ST910021AS.txt b/test/smart/ST910021AS.txt
new file mode 100644 (file)
index 0000000..98816ba
--- /dev/null
@@ -0,0 +1,205 @@
+smartctl version 5.39 [i386-apple-darwin8.11.1] Copyright (C) 2002-8 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Model Family:     Seagate Momentus 7200.1 series
+Device Model:     ST910021AS
+Serial Number:    3MH05H05
+Firmware Version: 3.07
+User Capacity:    100,030,242,816 bytes
+Device is:        In smartctl database [for details use: -P show]
+ATA Version is:   7
+ATA Standard is:  Exact ATA specification draft version not indicated
+Local Time is:    Sun Mar 23 09:06:15 2008 CDT
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: FAILED!
+Drive failure expected in less than 24 hours. SAVE ALL DATA.
+See vendor-specific Attribute list for failed Attributes.
+
+General SMART Values:
+Offline data collection status:  (0x82)        Offline data collection activity
+                                       was completed without error.
+                                       Auto Offline Data Collection: Enabled.
+Self-test execution status:      (  73)        The previous self-test completed having
+                                       a test element that failed and the test
+                                       element that failed is not known.
+Total time to complete Offline 
+data collection:                (  60) seconds.
+Offline data collection
+capabilities:                   (0x5b) SMART execute Offline immediate.
+                                       Auto Offline data collection on/off support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+                                       No Conveyance Self-test supported.
+                                       Selective Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+                                       No General Purpose Logging support.
+Short self-test routine 
+recommended polling time:       (   1) minutes.
+Extended self-test routine
+recommended polling time:       ( 111) minutes.
+SCT capabilities:             (0x0001) SCT Status supported.
+
+SMART Attributes Data Structure revision number: 10
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000e   100   253   006    Old_age   Always       -       0
+  3 Spin_Up_Time            0x0003   092   092   000    Pre-fail  Always       -       0
+  4 Start_Stop_Count        0x0032   099   099   020    Old_age   Always       -       1987
+  5 Reallocated_Sector_Ct   0x0033   001   001   036    Pre-fail  Always   FAILING_NOW 16642
+  7 Seek_Error_Rate         0x000f   070   060   030    Pre-fail  Always       -       21531636184
+  9 Power_On_Hours          0x0032   095   095   000    Old_age   Always       -       4957
+ 10 Spin_Retry_Count        0x0013   100   096   034    Pre-fail  Always       -       0
+ 12 Power_Cycle_Count       0x0032   099   099   020    Old_age   Always       -       1577
+187 Reported_Uncorrect      0x0032   001   001   000    Old_age   Always       -       65535
+189 High_Fly_Writes         0x003a   001   001   000    Old_age   Always       -       1050
+190 Airflow_Temperature_Cel 0x0022   056   044   045    Old_age   Always   In_the_past 44 (0 56 56 12)
+192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       1155
+193 Load_Cycle_Count        0x0032   001   001   000    Old_age   Always       -       943182
+194 Temperature_Celsius     0x0022   044   056   000    Old_age   Always       -       44 (0 12 0 0)
+195 Hardware_ECC_Recovered  0x001a   048   048   000    Old_age   Always       -       80662606
+197 Current_Pending_Sector  0x0012   070   069   000    Old_age   Always       -       614
+198 Offline_Uncorrectable   0x0010   070   069   000    Old_age   Offline      -       614
+199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
+200 Multi_Zone_Error_Rate   0x0000   100   253   000    Old_age   Offline      -       0
+202 TA_Increase_Count       0x0032   100   253   000    Old_age   Always       -       0
+
+SMART Error Log Version: 1
+ATA Error Count: 7731 (device log contains only the most recent five errors)
+       CR = Command Register [HEX]
+       FR = Features Register [HEX]
+       SC = Sector Count Register [HEX]
+       SN = Sector Number Register [HEX]
+       CL = Cylinder Low Register [HEX]
+       CH = Cylinder High Register [HEX]
+       DH = Device/Head Register [HEX]
+       DC = Device Command Register [HEX]
+       ER = Error register [HEX]
+       ST = Status register [HEX]
+Powered_Up_Time is measured from power on, and printed as
+DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
+SS=sec, and sss=millisec. It "wraps" after 49.710 days.
+
+Error 7731 occurred at disk power-on lifetime: 4955 hours (206 days + 11 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 00 c2 b5 23 40  Error: UNC at LBA = 0x0023b5c2 = 2340290
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 08 c0 b5 23 40 00      02:34:35.017  READ DMA EXT
+  25 00 08 c0 b5 23 40 00      02:34:35.010  READ DMA EXT
+  25 00 08 c0 b5 23 40 00      02:34:32.754  READ DMA EXT
+  35 00 80 38 b8 d1 40 00      02:34:32.736  WRITE DMA EXT
+  25 00 08 b8 e4 09 40 00      02:34:32.714  READ DMA EXT
+
+Error 7730 occurred at disk power-on lifetime: 4955 hours (206 days + 11 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 00 c2 b5 23 40  Error: UNC at LBA = 0x0023b5c2 = 2340290
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 08 c0 b5 23 40 00      02:34:35.017  READ DMA EXT
+  25 00 08 c0 b5 23 40 00      02:34:35.010  READ DMA EXT
+  35 00 80 38 b8 d1 40 00      02:34:32.754  WRITE DMA EXT
+  25 00 08 b8 e4 09 40 00      02:34:32.736  READ DMA EXT
+  25 00 10 00 3b 07 40 00      02:34:32.714  READ DMA EXT
+
+Error 7729 occurred at disk power-on lifetime: 4955 hours (206 days + 11 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 00 c2 b5 23 40  Error: UNC at LBA = 0x0023b5c2 = 2340290
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 08 c0 b5 23 40 00      02:34:35.017  READ DMA EXT
+  35 00 80 38 b8 d1 40 00      02:34:35.010  WRITE DMA EXT
+  25 00 08 b8 e4 09 40 00      02:34:32.754  READ DMA EXT
+  25 00 10 00 3b 07 40 00      02:34:32.736  READ DMA EXT
+  25 00 08 c0 b5 23 40 00      02:34:32.714  READ DMA EXT
+
+Error 7728 occurred at disk power-on lifetime: 4955 hours (206 days + 11 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 00 c2 b5 23 40  Error: UNC at LBA = 0x0023b5c2 = 2340290
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 08 c0 b5 23 40 00      02:34:30.804  READ DMA EXT
+  25 00 08 a0 3c d2 40 00      02:34:30.804  READ DMA EXT
+  25 00 e8 30 eb 75 40 00      02:34:32.754  READ DMA EXT
+  2f 00 01 10 00 00 00 00      02:34:32.736  READ LOG EXT
+  61 80 80 00 00 00 00 00      02:34:32.714  WRITE FPDMA QUEUED
+
+Error 7727 occurred at disk power-on lifetime: 4955 hours (206 days + 11 hours)
+  When the command that caused the error occurred, the device was active or idle.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 00 c2 b5 23 40  Error: UNC at LBA = 0x0023b5c2 = 2340290
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
+  -- -- -- -- -- -- -- --  ----------------  --------------------
+  25 00 08 c0 b5 23 40 00      02:34:19.202  READ DMA EXT
+  25 00 08 c0 b5 23 40 00      02:34:19.195  READ DMA EXT
+  25 00 08 c0 b5 23 40 00      02:34:19.181  READ DMA EXT
+  25 00 10 10 3b 07 40 00      02:34:28.554  READ DMA EXT
+  25 00 08 50 0a 67 40 00      02:34:26.304  READ DMA EXT
+
+SMART Self-test log structure revision number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Short offline       Completed: unknown failure    90%      4957         22979632
+# 2  Short offline       Interrupted (host reset)      90%      4505         -
+# 3  Short offline       Completed: read failure       90%      4499         18504955
+# 4  Short offline       Completed: read failure       90%      4499         18504955
+# 5  Short offline       Completed: read failure       90%      4499         18497155
+# 6  Extended offline    Completed: read failure       10%      3952         8449825
+# 7  Short offline       Completed: read failure       90%      3730         15926729
+# 8  Extended offline    Completed: read failure       10%      2545         15992712
+# 9  Short offline       Completed: read failure       90%      2545         15992712
+#10  Short offline       Completed: read failure       90%      2545         15992712
+#11  Short offline       Completed: read failure       90%      1339         8449825
+#12  Extended offline    Completed: read failure       10%       907         15715785
+#13  Short offline       Completed: read failure       90%       859         4042953
+#14  Extended offline    Completed: read failure       10%       854         4042953
+#15  Extended offline    Completed: read failure       10%       854         4042953
+#16  Short offline       Completed without error       00%       300         -
+
+SMART Selective self-test log data structure revision number 1
+ SPAN   MIN_LBA   MAX_LBA  CURRENT_TEST_STATUS
+    1  15926000  15993000  Not_testing
+    2         0         0  Not_testing
+    3         0         0  Not_testing
+    4         0         0  Not_testing
+    5         0         0  Not_testing
+Selective self-test flags (0x0):
+  After scanning selected spans, do NOT read-scan remainder of disk.
+If Selective self-test is pending on power-up, resume after 0 minute delay.
+
diff --git a/test/smart/TOSHIBA-0.txt b/test/smart/TOSHIBA-0.txt
new file mode 100644 (file)
index 0000000..965e55d
--- /dev/null
@@ -0,0 +1,73 @@
+smartctl version 5.0-31 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     TOSHIBA MK2018GAS                       
+Serial Number:    X22F7553T           
+Firmware Version: Q2.03 D 
+ATA Version is:   5
+ATA Standard is:  Unrecognized. Minor revision code: 0x00
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+General SMART Values:
+Off-line data collection status: (0x00)        Offline data collection activity was
+                                       never started.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                ( 212) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  23) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000b   100   100   050    Pre-fail     -       0
+  2 Throughput_Performance  0x0005   100   100   050    Pre-fail     -       0
+  3 Spin_Up_Time            0x0027   100   100   001    Pre-fail     -       910
+  4 Start_Stop_Count        0x0032   100   100   000    Old_age      -       18
+  5 Reallocated_Sector_Ct   0x0033   100   100   050    Pre-fail     -       0
+  7 Seek_Error_Rate         0x000b   100   100   050    Pre-fail     -       0
+  8 Seek_Time_Performance   0x0005   100   100   050    Pre-fail     -       0
+  9 Power_On_Hours          0x0032   100   100   000    Old_age      -       9
+ 10 Spin_Retry_Count        0x0033   100   100   030    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   000    Old_age      -       18
+192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age      -       6
+193 Load_Cycle_Count        0x0032   100   100   000    Old_age      -       437
+196 Reallocated_Event_Count 0x0032   100   100   000    Old_age      -       0
+197 Current_Pending_Sector  0x0032   100   100   000    Old_age      -       0
+198 Offline_Uncorrectable   0x0030   100   100   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age      -       0
+220 Disk_Shift              0x0002   100   100   000    Old_age      -       4250
+222 Loaded_Hours            0x0032   100   100   000    Old_age      -       4
+223 Load_Retry_Count        0x0032   100   100   000    Old_age      -       0
+224 Load_Friction           0x0022   100   100   000    Old_age      -       0
+226 Load-in_Time            0x0026   100   100   000    Old_age      -       590
+240 Unknown_Attribute       0x0001   100   100   001    Pre-fail     -       0
+
+SMART Error Log Version: 1
+No Errors Logged
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended off-line   Completed                     00%         4         
+# 2  Short captive       Completed                     00%         0         
+# 3  Short off-line      Completed                     00%         0         
diff --git a/test/smart/TOSHIBA-MK6021GAS.txt b/test/smart/TOSHIBA-MK6021GAS.txt
new file mode 100644 (file)
index 0000000..776cb3d
--- /dev/null
@@ -0,0 +1,74 @@
+smartctl version 5.1-7 Copyright (C) 2002 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     TOSHIBA MK6021GAS                       
+Serial Number:    Y2MJ1530T           
+Firmware Version: GA023A  
+ATA Version is:   5
+ATA Standard is:  Unrecognized. Minor revision code: 0x00
+Local Time is:    Mon Feb 17 09:37:27 2003 CST
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: PASSED
+
+General SMART Values:
+Off-line data collection status: (0x00)        Offline data collection activity was
+                                       never started.
+Self-test execution status:      (   0)        The previous self-test routine completed
+                                       without error or no self-test has ever 
+                                       been run.
+Total time to complete off-line 
+data collection:                ( 587) seconds.
+Offline data collection
+capabilities:                   (0x1b) SMART execute Offline immediate.
+                                       Automatic timer ON/OFF support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine 
+recommended polling time:       (  65) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE     WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000b   100   100   050    Pre-fail     -       0
+  2 Throughput_Performance  0x0005   100   100   050    Pre-fail     -       0
+  3 Spin_Up_Time            0x0027   100   100   001    Pre-fail     -       1267
+  4 Start_Stop_Count        0x0032   100   100   000    Old_age      -       18
+  5 Reallocated_Sector_Ct   0x0033   100   100   050    Pre-fail     -       0
+  7 Seek_Error_Rate         0x000b   100   100   050    Pre-fail     -       0
+  8 Seek_Time_Performance   0x0005   100   100   050    Pre-fail     -       0
+  9 Power_On_Hours          0x0032   100   100   000    Old_age      -       39
+ 10 Spin_Retry_Count        0x0033   100   100   030    Pre-fail     -       0
+ 12 Power_Cycle_Count       0x0032   100   100   000    Old_age      -       16
+192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age      -       1
+193 Load_Cycle_Count        0x0032   100   100   000    Old_age      -       460
+194 Temperature_Celsius     0x0022   100   100   000    Old_age      -       40 (Lifetime Min/Max 17/51)
+196 Reallocated_Event_Count 0x0032   100   100   000    Old_age      -       0
+197 Current_Pending_Sector  0x0032   100   100   000    Old_age      -       0
+198 Offline_Uncorrectable   0x0030   100   100   000    Old_age      -       0
+199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age      -       0
+220 Disk_Shift              0x0002   100   100   000    Old_age      -       8332
+222 Loaded_Hours            0x0032   100   100   000    Old_age      -       30
+223 Load_Retry_Count        0x0032   100   100   000    Old_age      -       0
+224 Load_Friction           0x0022   100   100   000    Old_age      -       0
+226 Load-in_Time            0x0026   100   100   000    Old_age      -       159
+240 Head flying hours       0x0001   100   100   001    Pre-fail     -       0
+
+SMART Error Log Version: 1
+No Errors Logged
+
+SMART Self-test log, version number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Extended off-line   Completed                     00%         4         -
+
diff --git a/test/smart/WD2500JB.txt b/test/smart/WD2500JB.txt
new file mode 100644 (file)
index 0000000..04e963a
--- /dev/null
@@ -0,0 +1,192 @@
+smartctl version 5.30 Copyright (C) 2002-4 Bruce Allen
+Home page is http://smartmontools.sourceforge.net/
+
+=== START OF INFORMATION SECTION ===
+Device Model:     WDC WD2500JB-32EVA0
+Serial Number:    WD-WMAEH1156826
+Firmware Version: 15.05R15
+Device is:        In smartctl database [for details use: -P show]
+ATA Version is:   6
+ATA Standard is:  Exact ATA specification draft version not indicated
+Local Time is:    Fri Jun 25 08:14:16 2004 CDT
+SMART support is: Available - device has SMART capability.
+SMART support is: Enabled
+
+=== START OF READ SMART DATA SECTION ===
+SMART overall-health self-assessment test result: FAILED!
+Drive failure expected in less than 24 hours. SAVE ALL DATA.
+See vendor-specific Attribute list for failed Attributes.
+
+General SMART Values:
+Offline data collection status:  (0x84)        Offline data collection activity was
+                                       suspended by an interrupting command from host.
+                                       Auto Offline Data Collection: Enabled.
+Self-test execution status:      (  73)        The previous self-test completed having
+                                       a test element that failed and the test
+                                       element that failed is not known.
+Total time to complete Offline 
+data collection:                (7608) seconds.
+Offline data collection
+capabilities:                   (0x7b) SMART execute Offline immediate.
+                                       Auto Offline data collection on/off support.
+                                       Suspend Offline collection upon new
+                                       command.
+                                       Offline surface scan supported.
+                                       Self-test supported.
+                                       Conveyance Self-test supported.
+                                       Selective Self-test supported.
+SMART capabilities:            (0x0003)        Saves SMART data before entering
+                                       power-saving mode.
+                                       Supports SMART auto save timer.
+Error logging capability:        (0x01)        Error logging supported.
+                                       No General Purpose Logging support.
+Short self-test routine 
+recommended polling time:       (   2) minutes.
+Extended self-test routine
+recommended polling time:       (  95) minutes.
+Conveyance self-test routine
+recommended polling time:       (   5) minutes.
+
+SMART Attributes Data Structure revision number: 16
+Vendor Specific SMART Attributes with Thresholds:
+ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
+  1 Raw_Read_Error_Rate     0x000b   001   001   051    Pre-fail  Always   FAILING_NOW 2777
+  3 Spin_Up_Time            0x0007   125   120   021    Pre-fail  Always       -       4283
+  4 Start_Stop_Count        0x0032   100   100   040    Old_age   Always       -       133
+  5 Reallocated_Sector_Ct   0x0033   199   199   140    Pre-fail  Always       -       1
+  7 Seek_Error_Rate         0x000b   200   200   051    Pre-fail  Always       -       0
+  9 Power_On_Hours          0x0032   092   092   000    Old_age   Always       -       6545
+ 10 Spin_Retry_Count        0x0013   100   100   051    Pre-fail  Always       -       0
+ 11 Calibration_Retry_Count 0x0013   100   100   051    Pre-fail  Always       -       0
+ 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       133
+194 Temperature_Celsius     0x0022   128   253   000    Old_age   Always       -       22
+196 Reallocated_Event_Count 0x0032   199   199   000    Old_age   Always       -       1
+197 Current_Pending_Sector  0x0012   200   200   000    Old_age   Always       -       13
+198 Offline_Uncorrectable   0x0012   200   200   000    Old_age   Always       -       0
+199 UDMA_CRC_Error_Count    0x000a   200   253   000    Old_age   Always       -       1
+200 Multi_Zone_Error_Rate   0x0009   200   155   051    Pre-fail  Offline      -       0
+
+SMART Error Log Version: 1
+ATA Error Count: 50 (device log contains only the most recent five errors)
+       CR = Command Register [HEX]
+       FR = Features Register [HEX]
+       SC = Sector Count Register [HEX]
+       SN = Sector Number Register [HEX]
+       CL = Cylinder Low Register [HEX]
+       CH = Cylinder High Register [HEX]
+       DH = Device/Head Register [HEX]
+       DC = Device Command Register [HEX]
+       ER = Error register [HEX]
+       ST = Status register [HEX]
+Timestamp = decimal seconds since the previous disk power-on.
+Note: timestamp "wraps" after 2^32 msec = 49.710 days.
+
+Error 50 occurred at disk power-on lifetime: 1082 hours
+  When the command that caused the error occurred, the device was doing SMART Offline or Self-test.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 07 82 a9 ee e0  Error: 
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  00 00 25 00 00 07 00 00 2825901.100  NOP [Abort queued commands]
+  03 00 82 00 00 5f 67 00 2825901.100  CFA REQUEST EXTENDED ERROR CODE
+  00 00 25 00 00 01 00 00 2825901.100  NOP [Abort queued commands]
+  00 00 25 00 00 08 00 00 2825901.100  NOP [Abort queued commands]
+  12 00 ee 00 00 5f a9 00 2825901.100  RECALIBRATE [RET-4]
+
+Error 49 occurred at disk power-on lifetime: 1082 hours
+  When the command that caused the error occurred, the device was doing SMART Offline or Self-test.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 07 82 a9 ee e0  Error: 
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  00 00 25 00 00 07 00 00 2825899.350  NOP [Abort queued commands]
+  12 00 ee 00 00 7f a9 00 2825899.350  RECALIBRATE [RET-4]
+  00 00 25 00 00 08 00 00 2825899.350  NOP [Abort queued commands]
+  00 00 25 00 00 08 00 00 2825899.350  NOP [Abort queued commands]
+  12 00 ee 00 00 5f a9 00 2825899.350  RECALIBRATE [RET-4]
+
+Error 48 occurred at disk power-on lifetime: 1082 hours
+  When the command that caused the error occurred, the device was doing SMART Offline or Self-test.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 08 17 a9 ee e0  Error: 
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  00 00 25 00 00 08 00 00 2825880.900  NOP [Abort queued commands]
+  00 00 d6 00 00 77 ad 00 2825880.900  NOP [Abort queued commands]
+  00 00 25 00 00 08 00 00 2825880.900  NOP [Abort queued commands]
+  00 00 d0 00 00 5f 5c 00 2825880.900  NOP [Abort queued commands]
+  00 00 35 00 00 08 00 00 2825880.900  NOP [Abort queued commands]
+
+Error 47 occurred at disk power-on lifetime: 1082 hours
+  When the command that caused the error occurred, the device was doing SMART Offline or Self-test.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 08 17 a9 ee e0  Error: 
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  00 00 25 00 00 08 00 00 2825879.000  NOP [Abort queued commands]
+  00 00 d6 00 00 77 ad 00 2825879.000  NOP [Abort queued commands]
+  00 00 35 00 00 08 00 00 2825879.000  NOP [Abort queued commands]
+  00 00 35 00 00 08 00 00 2825879.000  NOP [Abort queued commands]
+  06 00 8a 00 00 4f 3b 00 2825879.000  [RESERVED]
+
+Error 46 occurred at disk power-on lifetime: 1082 hours
+  When the command that caused the error occurred, the device was doing SMART Offline or Self-test.
+
+  After command completion occurred, registers were:
+  ER ST SC SN CL CH DH
+  -- -- -- -- -- -- --
+  40 51 08 c5 a8 ee e0  Error: 
+
+  Commands leading to the command that caused the error were:
+  CR FR SC SN CL CH DH DC   Timestamp  Command/Feature_Name
+  -- -- -- -- -- -- -- --   ---------  --------------------
+  00 00 25 00 00 08 00 00 2825875.250  NOP [Abort queued commands]
+  00 00 25 00 00 08 00 00 2825875.250  NOP [Abort queued commands]
+  06 00 ba 00 00 f7 66 00 2825875.250  [RESERVED]
+  00 00 35 00 00 10 00 00 2825875.250  NOP [Abort queued commands]
+  06 00 ba 00 00 1f 66 00 2825875.250  [RESERVED]
+
+SMART Self-test log structure revision number 1
+Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
+# 1  Short offline       Completed: unknown failure    90%      1077         0xfff00000
+# 2  Short offline       Completed without error       00%      1053         -
+# 3  Short offline       Completed without error       00%      1030         -
+# 4  Short offline       Completed without error       00%      1007         -
+# 5  Short offline       Completed without error       00%       983         -
+# 6  Extended offline    Completed without error       00%       961         -
+# 7  Short offline       Completed without error       00%       938         -
+# 8  Short offline       Completed without error       00%       914         -
+# 9  Short offline       Completed without error       00%       891         -
+#10  Short offline       Completed without error       00%       868         -
+#11  Short offline       Completed without error       00%       844         -
+#12  Short offline       Completed without error       00%       821         -
+#13  Extended offline    Completed without error       00%       799         -
+#14  Short offline       Completed without error       00%       775         -
+#15  Short offline       Completed without error       00%       752         -
+#16  Short offline       Completed without error       00%       728         -
+#17  Short offline       Completed without error       00%       705         -
+#18  Short offline       Completed without error       00%       682         -
+#19  Short offline       Completed without error       00%       659         -
+#20  Extended offline    Completed without error       00%       637         -
+#21  Short offline       Completed without error       00%       613         -
+
index adfc9e0..2d94f0e 100644 (file)
@@ -369,6 +369,16 @@ device_removed_signal_handler (DBusGProxy *proxy, const char *object_path, gpoin
  * TODO: keep in sync with code in tools/devkit-disks in DeviceKit-disks.
  */
 
+typedef struct {
+        int id;
+        char *desc;
+        int flags;
+        int value;
+        int worst;
+        int threshold;
+        char *raw;
+} DeviceSmartAttribute;
+
 typedef struct
 {
         char *native_path;
@@ -432,6 +442,16 @@ typedef struct
         char   **drive_media_compatibility;
         char    *drive_media;
 
+        gboolean               drive_smart_is_capable;
+        gboolean               drive_smart_is_enabled;
+        guint64                drive_smart_time_collected;
+        gboolean               drive_smart_is_failing;
+        double                 drive_smart_temperature;
+        guint64                drive_smart_time_powered_on;
+        char                  *drive_smart_last_self_test_result;
+        int                    num_drive_smart_attributes;
+        DeviceSmartAttribute  *drive_smart_attributes;
+
         char    *linux_md_component_level;
         int      linux_md_component_num_raid_devices;
         char    *linux_md_component_uuid;
@@ -451,6 +471,16 @@ typedef struct
         guint64  linux_md_sync_speed;
 } DeviceProperties;
 
+#define SMART_DATA_STRUCT_TYPE (dbus_g_type_get_struct ("GValueArray",   \
+                                                        G_TYPE_INT,      \
+                                                        G_TYPE_STRING,   \
+                                                        G_TYPE_INT,      \
+                                                        G_TYPE_INT,      \
+                                                        G_TYPE_INT,      \
+                                                        G_TYPE_INT,      \
+                                                        G_TYPE_STRING,   \
+                                                        G_TYPE_INVALID))
+
 static void
 collect_props (const char *key, const GValue *value, DeviceProperties *props)
 {
@@ -577,6 +607,42 @@ collect_props (const char *key, const GValue *value, DeviceProperties *props)
         else if (strcmp (key, "drive-media") == 0)
                 props->drive_media = g_strdup (g_value_get_string (value));
 
+        else if (strcmp (key, "drive-smart-is-capable") == 0)
+                props->drive_smart_is_capable = g_value_get_boolean (value);
+        else if (strcmp (key, "drive-smart-is-enabled") == 0)
+                props->drive_smart_is_enabled = g_value_get_boolean (value);
+        else if (strcmp (key, "drive-smart-time-collected") == 0)
+                props->drive_smart_time_collected = g_value_get_uint64 (value);
+        else if (strcmp (key, "drive-smart-is-failing") == 0)
+                props->drive_smart_is_failing = g_value_get_boolean (value);
+        else if (strcmp (key, "drive-smart-temperature") == 0)
+                props->drive_smart_temperature = g_value_get_double (value);
+        else if (strcmp (key, "drive-smart-time-powered-on") == 0)
+                props->drive_smart_time_powered_on = g_value_get_uint64 (value);
+        else if (strcmp (key, "drive-smart-last-self-test-result") == 0)
+                props->drive_smart_last_self_test_result = g_strdup (g_value_get_string (value));
+        else if (strcmp (key, "drive-smart-attributes") == 0) {
+                GPtrArray *p = g_value_get_boxed (value);
+                int n;
+                props->num_drive_smart_attributes = (int) p->len;
+                props->drive_smart_attributes = g_new0 (DeviceSmartAttribute, props->num_drive_smart_attributes);
+                for (n = 0; n < (int) p->len; n++) {
+                        DeviceSmartAttribute *a = props->drive_smart_attributes + n;
+                        GValue elem = {0};
+                        g_value_init (&elem, SMART_DATA_STRUCT_TYPE);
+                        g_value_set_static_boxed (&elem, p->pdata[n]);
+                        dbus_g_type_struct_get (&elem,
+                                                0, &(a->id),
+                                                1, &(a->desc),
+                                                2, &(a->flags),
+                                                3, &(a->value),
+                                                4, &(a->worst),
+                                                5, &(a->threshold),
+                                                6, &(a->raw),
+                                                G_MAXUINT);
+                }
+        }
+
         else if (strcmp (key, "linux-md-component-level") == 0)
                 props->linux_md_component_level = g_strdup (g_value_get_string (value));
         else if (strcmp (key, "linux-md-component-num-raid-devices") == 0)
@@ -670,6 +736,8 @@ out:
 static void
 device_properties_free (DeviceProperties *props)
 {
+        int n;
+
         g_free (props->native_path);
         g_free (props->device_file);
         g_strfreev (props->device_file_by_id);
@@ -698,6 +766,12 @@ device_properties_free (DeviceProperties *props)
         g_free (props->drive_connection_interface);
         g_strfreev (props->drive_media_compatibility);
         g_free (props->drive_media);
+        g_free (props->drive_smart_last_self_test_result);
+        for (n = 0; n < props->num_drive_smart_attributes; n++) {
+                g_free (props->drive_smart_attributes[n].desc);
+                g_free (props->drive_smart_attributes[n].raw);
+        }
+        g_free (props->drive_smart_attributes);
         g_free (props->linux_md_component_level);
         g_free (props->linux_md_component_uuid);
         g_free (props->linux_md_component_name);
@@ -847,6 +921,47 @@ do_show_info (const char *object_path)
                         g_print ("    if speed:    (unknown)\n");
                 else
                         g_print ("    if speed:    %" G_GINT64_FORMAT " bits/s\n", props->drive_connection_speed);
+
+                g_print ("    media:       %s\n", props->drive_media);
+                if (!props->drive_smart_is_capable) {
+                        g_print ("    S.M.A.R.T.:  not capable\n");
+                } else if (props->drive_smart_time_collected == 0) {
+                        g_print ("    S.M.A.R.T.:  not collected\n");
+                } else {
+                        struct tm *time_tm;
+                        time_t time;
+                        char time_buf[256];
+
+                        time = (time_t) props->drive_smart_time_collected;
+                        time_tm = localtime (&time);
+                        strftime (time_buf, sizeof time_buf, "%c", time_tm);
+
+                        g_print ("    S.M.A.R.T.:     Information collected at %s\n", time_buf);
+                        if (!props->drive_smart_is_capable) {
+                                g_print ("      not capable\n");
+                        } else if (!props->drive_smart_is_enabled) {
+                                g_print ("      not enabled\n");
+                        } else {
+                                int m;
+
+                                g_print ("      assessment:   %s\n",
+                                         props->drive_smart_is_failing ? "FAILING" : "Passed");
+                                g_print ("      temperature:  %g° C / %g° F\n",
+                                         props->drive_smart_temperature,
+                                         9 * props->drive_smart_temperature / 5 + 32);
+                                g_print ("      powered on:   %" G_GUINT64_FORMAT " hours\n", props->drive_smart_time_powered_on / 3600);
+                                //g_print ("      196  Reallocated_Event_Count      0x0032 100   100           0 443023360\n",
+                                g_print ("      =========================================================================\n");
+                                g_print ("      Id   Description                   Flags Value Worst Threshold       Raw\n");
+                                g_print ("      =========================================================================\n");
+                                for (m = 0; m < props->num_drive_smart_attributes; m++) {
+                                        DeviceSmartAttribute *a = props->drive_smart_attributes + m;
+                                        g_print ("      %3d  %-28s 0x%04x %5d %5d %9d %s\n",
+                                                 a->id, a->desc, a->flags, a->value, a->worst, a->threshold, a->raw);
+                                }
+                        }
+                }
+
         }
         device_properties_free (props);
 }