Package: ksensors
Version: 0.7.3-6
Severity: wishlist
Tags: patch


Hi,

I'm including a patch for ksensors that will allow it to read temperatures for SCSI hard disks. To do this ksensors has to look in /sys/block for the device name instead of /proc/ide. If it fails to open /sys/block it will fall back to the old behaviour.

Thanks,

James
diff -Naur ksensors/src/hdsensorslist.cpp ksensors-patch/src/hdsensorslist.cpp
--- ksensors/src/hdsensorslist.cpp      2004-08-21 00:26:51.000000000 +0000
+++ ksensors-patch/src/hdsensorslist.cpp        2005-10-18 01:53:44.761840000 
+0000
@@ -200,12 +200,17 @@
 
 bool HDSensorsList::getDisks(QStringList &disks )
 {
-  DIR *dir= opendir("/proc/ide");
-  if(!dir) return false;
+  DIR *dir;
+  
+  /* Get a listing of the hard drives looking under sysfs first then falling 
back to /proc/ide */
+  if((dir = opendir ("/sys/block")) == NULL)
+       if ((dir == opendir ("/proc/ide")) == NULL)
+               return false;
+
   QString str;
   struct dirent *ptr;
   while((ptr= readdir(dir))) {
-    if(ptr->d_name[0]=='h' && ptr->d_name[1]=='d') {
-       str.sprintf("/dev/hd%c",ptr->d_name[2]);
+    if((ptr->d_name[0]=='h' || ptr->d_name[0]=='s') && ptr->d_name[1]=='d') {
+       str.sprintf("/dev/%s",ptr->d_name);
        disks << str;
     }

Reply via email to