mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-20 12:42:24 +00:00
hddtemp: try to fix by Gentoo patches
This commit is contained in:
parent
bd4c0e7cd1
commit
fc82aa049b
28
pkgs/tools/misc/hddtemp/byteswap.patch
Normal file
28
pkgs/tools/misc/hddtemp/byteswap.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
diff -Nuar --exclude '*~' hddtemp-0.3-beta15.orig/src/sata.c hddtemp-0.3-beta15/src/sata.c
|
||||
--- hddtemp-0.3-beta15.orig/src/sata.c 2006-05-14 02:09:55.579437498 -0700
|
||||
+++ hddtemp-0.3-beta15/src/sata.c 2006-05-14 02:06:08.495948437 -0700
|
||||
@@ -88,7 +88,9 @@
|
||||
return strdup(_("unknown"));
|
||||
else
|
||||
{
|
||||
+ //fprintf(stderr,"sata_model1=%s\n",identify + 54);
|
||||
sata_fixstring(identify + 54, 24);
|
||||
+ //fprintf(stderr,"sata_model2=%s\n",identify + 54);
|
||||
return strdup(identify + 54);
|
||||
}
|
||||
}
|
||||
diff -Nuar --exclude '*~' hddtemp-0.3-beta15.orig/src/satacmds.c hddtemp-0.3-beta15/src/satacmds.c
|
||||
--- hddtemp-0.3-beta15.orig/src/satacmds.c 2006-05-14 02:09:40.983470339 -0700
|
||||
+++ hddtemp-0.3-beta15/src/satacmds.c 2006-05-14 02:09:02.319557333 -0700
|
||||
@@ -98,7 +98,10 @@
|
||||
/* convert from big-endian to host byte order */
|
||||
for (p = end ; p != s;) {
|
||||
unsigned short *pp = (unsigned short *) (p -= 2);
|
||||
- *pp = ntohs(*pp);
|
||||
+ char tmp = p[0];
|
||||
+ p[0] = p[1];
|
||||
+ p[1] = tmp;
|
||||
+ //*pp = ntohs(*pp);
|
||||
}
|
||||
|
||||
/* strip leading blanks */
|
|
@ -7,20 +7,23 @@ stdenv.mkDerivation {
|
|||
url = http://download.savannah.nongnu.org/releases/hddtemp/hddtemp.db;
|
||||
sha256 = "1fr6qgns6qv7cr40lic5yqwkkc7yjmmgx8j0z6d93csg3smzhhya";
|
||||
};
|
||||
|
||||
|
||||
src = fetchurl {
|
||||
url = http://download.savannah.nongnu.org/releases/hddtemp/hddtemp-0.3-beta15.tar.bz2;
|
||||
sha256 = "0nzgg4nl8zm9023wp4dg007z6x3ir60rwbcapr9ks2al81c431b1";
|
||||
};
|
||||
|
||||
# from Gentoo
|
||||
patches = [ ./byteswap.patch ./dontwake.patch ./execinfo.patch ./satacmds.patch ];
|
||||
|
||||
configurePhase =
|
||||
''
|
||||
mkdir -p $out/nix-support
|
||||
cp $db $out/nix-support/hddtemp.db
|
||||
./configure --prefix=$out --with-db-path=$out/nix-support/hddtemp.db
|
||||
'';
|
||||
'';
|
||||
|
||||
meta = {
|
||||
meta = {
|
||||
description = "Tool for displaying hard disk temperature";
|
||||
homepage = https://savannah.nongnu.org/projects/hddtemp/;
|
||||
license = "GPL2";
|
||||
|
|
20
pkgs/tools/misc/hddtemp/dontwake.patch
Normal file
20
pkgs/tools/misc/hddtemp/dontwake.patch
Normal file
|
@ -0,0 +1,20 @@
|
|||
--- hddtemp-0.3-beta15/src/sata.c 2012-07-01 16:35:01.681708074 +0200
|
||||
+++ hddtemp-0.3-beta15/src/sata.c 2012-07-01 16:33:58.172109699 +0200
|
||||
@@ -125,6 +125,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) {
|
21
pkgs/tools/misc/hddtemp/execinfo.patch
Normal file
21
pkgs/tools/misc/hddtemp/execinfo.patch
Normal file
|
@ -0,0 +1,21 @@
|
|||
--- hddtemp-0.3-beta15/configure.in~ 2005-10-17 19:14:19 +0000
|
||||
+++ hddtemp-0.3-beta15/configure.in 2006-12-11 18:23:22 +0000
|
||||
@@ -18,6 +18,7 @@
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h)
|
||||
AC_CHECK_HEADERS(netinet/in.h)
|
||||
+AC_CHECK_HEADERS(execinfo.h)
|
||||
AC_CHECK_TYPE(in_addr_t, ,[AC_DEFINE_UNQUOTED([in_addr_t], [uint32_t], [Define to 'uint32_t' if <netinet/in.h> does not define.])], [#include <netinet/in.h>])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
--- hddtemp-0.3-beta15/src/backtrace.c-orig 2006-12-11 18:20:41 +0000
|
||||
+++ hddtemp-0.3-beta15/src/backtrace.c 2006-12-11 18:23:28 +0000
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <features.h>
|
||||
|
||||
-#if defined(__i386__) && defined(__GLIBC__)
|
||||
+#ifdef HAS_EXECINFO_H
|
||||
|
||||
#include <execinfo.h>
|
||||
|
26
pkgs/tools/misc/hddtemp/satacmds.patch
Normal file
26
pkgs/tools/misc/hddtemp/satacmds.patch
Normal file
|
@ -0,0 +1,26 @@
|
|||
diff -Naurp hddtemp-0.3-beta15-orig/src/satacmds.c hddtemp-0.3-beta15/src/satacmds.c
|
||||
--- hddtemp-0.3-beta15-orig/src/satacmds.c 2007-02-10 14:25:15.000000000 +0100
|
||||
+++ hddtemp-0.3-beta15/src/satacmds.c 2007-02-10 14:26:53.000000000 +0100
|
||||
@@ -54,7 +54,6 @@ int sata_pass_thru(int device, unsigned
|
||||
unsigned char cdb[16];
|
||||
unsigned char sense[32];
|
||||
int dxfer_direction;
|
||||
- int ret;
|
||||
|
||||
memset(cdb, 0, sizeof(cdb));
|
||||
cdb[0] = ATA_16;
|
||||
@@ -78,13 +77,7 @@ int sata_pass_thru(int device, unsigned
|
||||
cdb[6] = cmd[1];
|
||||
cdb[14] = cmd[0];
|
||||
|
||||
- ret = scsi_SG_IO(device, cdb, sizeof(cdb), buffer, cmd[3] * 512, sense, sizeof(sense), dxfer_direction);
|
||||
-
|
||||
- /* Verify SATA magics */
|
||||
- if (sense[0] != 0x72 || sense[7] != 0x0e || sense[9] != 0x0e || sense[10] != 0x00)
|
||||
- return 1;
|
||||
- else
|
||||
- return ret;
|
||||
+ return scsi_SG_IO(device, cdb, sizeof(cdb), buffer, cmd[3] * 512, sense, sizeof(sense), dxfer_direction);
|
||||
}
|
||||
|
||||
void sata_fixstring(unsigned char *s, int bytecount)
|
Loading…
Reference in a new issue