]> git.ipfire.org Git - thirdparty/libatasmart.git/commitdiff
deal with ATA/USB truncation
authorLennart Poettering <lennart@poettering.net>
Thu, 9 Apr 2009 01:35:03 +0000 (03:35 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 9 Apr 2009 01:35:03 +0000 (03:35 +0200)
atasmart.c

index 8e4d522b8dafab0bdad99c3972fe21fbe19fae11..0a2e1bc58242742c9b193a00650505b51c0f3d33 100644 (file)
@@ -660,10 +660,12 @@ int sk_disk_smart_status(SkDisk *d, SkBool *good) {
         if ((ret = disk_command(d, SK_ATA_COMMAND_SMART, SK_DIRECTION_NONE, cmd, NULL, 0)) < 0)
                 return ret;
 
-        if (cmd[3] == htons(0x00C2U) &&
+        /* SAT/USB bridges truncate packets, so we only check for 4F,
+         * not for 2C on those */
+        if ((d->type == SK_DISK_TYPE_ATA_PASSTHROUGH_12 || cmd[3] == htons(0x00C2U)) &&
             cmd[4] == htons(0x4F00U))
                 *good = TRUE;
-        else if (cmd[3] == htons(0x002CU) &&
+        else if ((d->type == SK_DISK_TYPE_ATA_PASSTHROUGH_12 || cmd[3] == htons(0x002CU)) &&
                  cmd[4] == htons(0xF400U))
                 *good = FALSE;
         else {