summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-04-07 21:38:40 +0200
committerLennart Poettering <lennart@poettering.net>2009-04-07 21:38:40 +0200
commit10257ca6c9182a4dcbb5403ce5ec4a27e1c9e447 (patch)
tree6ee4b07203cf66f8fe8082cc76e6632336a210b5
parentb6606ba1ad6f9f1fb46bfb9beeef71511006dba0 (diff)
fix parsing of awake status
-rw-r--r--atasmart.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/atasmart.c b/atasmart.c
index 7da80e0..44e095d 100644
--- a/atasmart.c
+++ b/atasmart.c
@@ -452,6 +452,7 @@ static int disk_identify_device(SkDisk *d) {
int sk_disk_check_sleep_mode(SkDisk *d, SkBool *awake) {
int ret;
uint16_t cmd[6];
+ uint8_t status;
if (!d->identify_data_valid) {
errno = ENOTSUP;
@@ -473,7 +474,8 @@ int sk_disk_check_sleep_mode(SkDisk *d, SkBool *awake) {
return -1;
}
- *awake = ntohs(cmd[1]) == 0xFF;
+ status = ntohs(cmd[1]) & 0xFF;
+ *awake = status == 0xFF || status == 0x80; /* idle and active/idle is considered awake */
return 0;
}