X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fhdd_atasmart.c;h=b34564e8ff23527258062afe795cdca55c32a4a1;hb=d2fde10e73ef93a8084a4cc69fea35819ee19f74;hp=3943fa32addbabee5f912a618c1f26304558010b;hpb=409bcdc9957e312f4c049225e04deb2209c7fb7d;p=psensor.git diff --git a/src/lib/hdd_atasmart.c b/src/lib/hdd_atasmart.c index 3943fa3..b34564e 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) @@ -32,9 +35,9 @@ #include #include -#include "pio.h" -#include "hdd.h" -#include "log.h" +#include +#include +#include static int filter_sd(const char *p) { @@ -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(_("Disk")), + t, values_max_length); s->disk = disk; @@ -125,8 +133,8 @@ struct psensor **hdd_psensor_list_add(struct psensor **sensors, log_debug("hdd_psensor_list_add(hdd_atasmart) open %s", *tmp); if (!sk_disk_open(*tmp, &disk)) { - id = malloc(strlen("hdd at") + strlen(*tmp) + 1); - strcpy(id, "hdd at"); + id = malloc(strlen("atasmart ") + strlen(*tmp) + 1); + strcpy(id, "atasmart "); strcat(id, *tmp); sensor = create_sensor(id, @@ -164,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) {