Projects
Eulaceura:Factory
hddtemp
_service:obs_scm:0001-Try-attribute-190-if-194-...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0001-Try-attribute-190-if-194-doesn-t-exist.patch of Package hddtemp
From d3c162af0ca0110ce715c1e364194475f2eee3ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi> Date: Sat, 18 Jan 2014 13:59:27 +0200 Subject: [PATCH] Try attribute 190 if 194 doesn't exist --- src/ata.c | 2 ++ src/db.c | 1 + src/db.h | 1 + src/hddtemp.c | 1 + src/hddtemp.h | 1 + src/sata.c | 2 ++ src/scsi.c | 1 + 7 files changed, 9 insertions(+) diff --git a/src/ata.c b/src/ata.c index 1d908ac..742129a 100644 --- a/src/ata.c +++ b/src/ata.c @@ -141,6 +141,8 @@ static enum e_gettemp ata_get_temperature(struct disk *dsk) { /* temperature */ field = ata_search_temperature(values, dsk->db_entry->attribute_id); + if(!field && dsk->db_entry->attribute_id2 != 0) + field = ata_search_temperature(values, dsk->db_entry->attribute_id2); if(field) dsk->value = *(field+3); diff --git a/src/db.c b/src/db.c index 5aed8e8..f8a1822 100644 --- a/src/db.c +++ b/src/db.c @@ -196,6 +196,7 @@ static int parse_db_line(char *line) { new_entry->regexp = strdup(regexp); new_entry->description = strdup(description); new_entry->attribute_id = value; + new_entry->attribute_id2 = 0; new_entry->unit = unit; new_entry->next = NULL; *last_entry = new_entry; diff --git a/src/db.h b/src/db.h index 6c08e87..dccb21c 100644 --- a/src/db.h +++ b/src/db.h @@ -26,6 +26,7 @@ struct harddrive_entry { char *regexp; short int attribute_id; + short int attribute_id2; char *description; unsigned char unit; struct harddrive_entry *next; diff --git a/src/hddtemp.c b/src/hddtemp.c index 300cb0e..bce5e91 100644 --- a/src/hddtemp.c +++ b/src/hddtemp.c @@ -528,6 +528,7 @@ int main(int argc, char* argv[]) { dsk->db_entry->regexp = ""; dsk->db_entry->description = ""; dsk->db_entry->attribute_id = DEFAULT_ATTRIBUTE_ID; + dsk->db_entry->attribute_id2 = DEFAULT_ATTRIBUTE_ID2; dsk->db_entry->unit = 'C'; dsk->db_entry->next = NULL; } diff --git a/src/hddtemp.h b/src/hddtemp.h index ed4ed5d..2460639 100644 --- a/src/hddtemp.h +++ b/src/hddtemp.h @@ -30,6 +30,7 @@ typedef __u16 u16; #define MAX_ERRORMSG_SIZE 128 #define DEFAULT_ATTRIBUTE_ID 194 +#define DEFAULT_ATTRIBUTE_ID2 190 #define F_to_C(val) (int)(((double)(val)-32.0)/1.8) #define C_to_F(val) (int)(((double)(val)*(double)1.8) + (double)32.0) diff --git a/src/sata.c b/src/sata.c index d67621f..0afe13c 100644 --- a/src/sata.c +++ b/src/sata.c @@ -166,6 +166,8 @@ static enum e_gettemp sata_get_temperature(struct disk *dsk) { /* temperature */ field = sata_search_temperature(values, dsk->db_entry->attribute_id); + if(!field && dsk->db_entry->attribute_id2 != 0) + field = sata_search_temperature(values, dsk->db_entry->attribute_id2); if(field) dsk->value = *(field+3); diff --git a/src/scsi.c b/src/scsi.c index 71c9b82..b92b235 100644 --- a/src/scsi.c +++ b/src/scsi.c @@ -84,6 +84,7 @@ static enum e_gettemp scsi_get_temperature(struct disk *dsk) { dsk->db_entry->regexp = ""; dsk->db_entry->description = ""; dsk->db_entry->attribute_id = 0; + dsk->db_entry->attribute_id2 = 0; dsk->db_entry->unit = 'C'; dsk->db_entry->next = NULL; -- 1.8.3.1
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2