X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fhdd_atasmart.c;h=8da5c850cb25bbaaa230be4e3de106388bb79883;hb=f3b05dae619a7909bd7422b3a82422c9442aa114;hp=679d8740e5ec48723a4c3e3a762f6e06e251705c;hpb=dd43a012be4c2fa0329caa1ea5707d3d68deb150;p=psensor.git diff --git a/src/lib/hdd_atasmart.c b/src/lib/hdd_atasmart.c index 679d874..8da5c85 100644 --- a/src/lib/hdd_atasmart.c +++ b/src/lib/hdd_atasmart.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2012 jeanfi@gmail.com + * Copyright (C) 2010-2014 jeanfi@gmail.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA */ +#define _LARGEFILE_SOURCE 1 +#include "config.h" + #include #include #define _(str) gettext(str) @@ -45,9 +48,14 @@ static struct psensor * create_sensor(char *id, char *name, SkDisk *disk, int values_max_length) { struct psensor *s; + int t; + + t = SENSOR_TYPE_ATASMART | SENSOR_TYPE_HDD | SENSOR_TYPE_TEMP; + s = psensor_create(id, strdup(name), - SENSOR_TYPE_HDD_TEMP_ATASMART, + strdup("HDD"), + t, values_max_length); s->disk = disk; @@ -91,12 +99,16 @@ static void analyze_disk(const char *dname) size = (uint64_t)-1; /* So, it's a block device. Let's make sure the ioctls work */ if (ioctl(f, BLKGETSIZE64, &size) < 0) { - log_debug("ioctl fails %s: %s", dname, strerror(errno)); + log_debug("analyze_disk(hdd_atasmart): ioctl fails %s: %s", + dname, + strerror(errno)); goto fail; } if (size <= 0 || size == (uint64_t) -1) { - log_debug("ioctl wrong size %s: %ld", dname, size); + log_debug("analyze_disk(hdd_atasmart): ioctl wrong size %s: %ld", + dname, + size); goto fail; } @@ -137,7 +149,8 @@ struct psensor **hdd_psensor_list_add(struct psensor **sensors, result = tmp_sensors; } else { - log_err("sk_disk_open(hdd_atasmart) %s failure", *tmp); + log_err(_("atasmart: sk_disk_open() failure: %s."), + *tmp); analyze_disk(*tmp); } @@ -159,7 +172,8 @@ void hdd_psensor_list_update(struct psensor **sensors) cur = sensors; while (*cur) { s = *cur; - if (s->type == SENSOR_TYPE_HDD_TEMP_ATASMART) { + if (!(s->type & SENSOR_TYPE_REMOTE) + && s->type & SENSOR_TYPE_ATASMART) { ret = sk_disk_smart_read_data(s->disk); if (!ret) {