From 10257ca6c9182a4dcbb5403ce5ec4a27e1c9e447 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 7 Apr 2009 21:38:40 +0200 Subject: fix parsing of awake status --- atasmart.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- cgit