Package: hddtemp
Version: 0.3-beta15-42
Severity: normal
Tags: patch upstream

Hello,

I came across a problem with current hddtemp and a SATA drive and
collectd. It kept awaking the drive when polling the temperature levels.
I could not observe the same behaviour with ATA disks therefore I
checked the code and found that there is no similar check for being in
stand-by mode like for ATA drives. A slight modification (copy&paste
from ata.c to sata.c) solved the problem. Patch attached.

Regards,
Eduard.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24 (PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages hddtemp depends on:
ii  debconf [debconf-2.0]         1.5.20     Debian configuration management sy
ii  libc6                         2.7-9      GNU C Library: Shared libraries
ii  lsb-base                      3.2-4      Linux Standard Base 3.2 init scrip

hddtemp recommends no packages.

-- debconf information:
* hddtemp/SUID_bit: true
* hddtemp/interface: 127.0.0.1
* hddtemp/syslog: 0
* hddtemp/daemon: true
* hddtemp/port: 7634

-- 
<Tolimar> Statler: Durchsuch mal die fortunes nach Aqua ;)
<Aqua> Tolimar, ich find nichts von den Sachen lustig
<Aqua> ihr habt ja sogar das reingegeben als ich gefragt wurde welche Xfree
        version ich habe
--- /tmp/hddtemp-0.3-beta15/src/sata.c	2008-05-06 22:45:19.000000000 +0200
+++ ./src/sata.c	2008-05-06 22:40:47.000000000 +0200
@@ -123,6 +123,17 @@
     dsk->fd = -1;
     return GETTEMP_NOSENSOR;
   }
+
+  switch(ata_get_powermode(dsk->fd)) {
+  case PWM_STANDBY:
+  case PWM_SLEEPING:
+    if (!wakeup)
+      return GETTEMP_DRIVE_SLEEP;
+  case PWM_UNKNOWN:
+  case PWM_ACTIVE: /* active or idle */
+  default:
+    break;
+  }
   
   /* get SMART values */
   if(sata_enable_smart(dsk->fd) != 0) {

Reply via email to