Stop relying on ata_id to set ID_ATA_FEATURE_SET_SMART{,_ENABLED}
authorDavid Zeuthen <zeuthen@gmail.com>
Mon, 5 Nov 2012 18:30:18 +0000 (13:30 -0500)
committerDavid Zeuthen <zeuthen@gmail.com>
Mon, 5 Nov 2012 18:30:18 +0000 (13:30 -0500)
Get this directly from the IDENTIFY DATA itself.

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
src/udiskslinuxdriveata.c

index 2ceb9b2..6d70c3f 100644 (file)
@@ -166,9 +166,14 @@ update_smart (UDisksLinuxDriveAta *drive,
   gint num_attributes_failing = -1;
   gint num_attributes_failed_in_the_past = -1;
   gint64 num_bad_sectors = 1;
-
-  supported = g_udev_device_get_property_as_boolean (device->udev_device, "ID_ATA_FEATURE_SET_SMART");
-  enabled = g_udev_device_get_property_as_boolean (device->udev_device, "ID_ATA_FEATURE_SET_SMART_ENABLED");
+  guint16 word_82 = 0;
+  guint16 word_85 = 0;
+
+  /* ATA8: 7.16 IDENTIFY DEVICE - ECh, PIO Data-In - Table 29 IDENTIFY DEVICE data */
+  word_82 = udisks_ata_identify_get_word (device->ata_identify_device_data, 82);
+  word_85 = udisks_ata_identify_get_word (device->ata_identify_device_data, 85);
+  supported = word_82 & (1<<0);
+  enabled = word_85 & (1<<0);
 
   G_LOCK (object_lock);
   if (drive->smart_updated > 0)