X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fhdd_atasmart.c;h=7920d931bc0dd9e2594df75f626cb9bb2b6e2e36;hb=6c2baf022eaf6eef8fe3e94162e54e5a27f76d6d;hp=acd4a8f2c4625467c32b651332407fa6c566cd3d;hpb=cc35e177d57bc4ee2cc57ae25f130dfc168aa61d;p=psensor.git diff --git a/src/lib/hdd_atasmart.c b/src/lib/hdd_atasmart.c index acd4a8f..7920d93 100644 --- a/src/lib/hdd_atasmart.c +++ b/src/lib/hdd_atasmart.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2013 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,11 @@ #include #include -#include "pio.h" -#include "hdd.h" -#include "log.h" +#include +#include +#include + +static const char *PROVIDER_NAME = "atasmart"; static int filter_sd(const char *p) { @@ -51,7 +56,7 @@ create_sensor(char *id, char *name, SkDisk *disk, int values_max_length) s = psensor_create(id, strdup(name), - strdup("HDD"), + strdup(_("Disk")), t, values_max_length); @@ -130,9 +135,11 @@ 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"); - strcat(id, *tmp); + id = malloc(strlen(PROVIDER_NAME) + + 1 + + strlen(*tmp) + + 1); + sprintf(id, "%s %s", PROVIDER_NAME, *tmp); sensor = create_sensor(id, *tmp, @@ -169,7 +176,8 @@ void hdd_psensor_list_update(struct psensor **sensors) cur = sensors; while (*cur) { s = *cur; - if (s->type & SENSOR_TYPE_ATASMART) { + if (!(s->type & SENSOR_TYPE_REMOTE) + && s->type & SENSOR_TYPE_ATASMART) { ret = sk_disk_smart_read_data(s->disk); if (!ret) {