Skip to contentSkip to conversation

sensors: add humidity data to output of sensors command

PATCH In review Iain Paton 3 participants 4 messages Jun 19, 2012 – Sep 11, 2012

lore
Share & tools
lore

Iain Paton

author
#0 lore raw

PATCH 1/1 sensors: add humidity data to output of sensors command

Testing out a humidity sensor recently and was thinking the driver wasn't working somehow. Discovered instead that the driver works fine, but the sensors command was ignoring the humidity data.
This adds output of humidity data for sensors that support it.

Please consider applying it.

Thanks,
Iain

prog/sensors/chips.c +24 -0
diff -Naur lm_sensors-3.3.2-org/prog/sensors/chips.c lm_sensors-3.3.2/prog/sensors/chips.c
@@ -658,6 +658,27 @@
 	free(label);
 }
 
+static void print_chip_humidity(const sensors_chip_name *name,
+			   const sensors_feature *feature,
+			   int label_size)
+{
+	char *label;
+	const sensors_subfeature *subfeature;
+	double vid;
+
+	subfeature = sensors_get_subfeature(name, feature,
+					    SENSORS_SUBFEATURE_HUMIDITY_INPUT);
+	if (!subfeature)
+		return;
+
+	if ((label = sensors_get_label(name, feature))
+	 && !sensors_get_value(name, subfeature->number, &vid)) {
+		print_label(label, label_size);
+		printf("%6.1f \%RH\n", vid);
+	}
+	free(label);
+}
+
 static void print_chip_beep_enable(const sensors_chip_name *name,
 				   const sensors_feature *feature,
 				   int label_size)
@@ -792,6 +813,9 @@
 		case SENSORS_FEATURE_INTRUSION:
 			print_chip_intrusion(name, feature, label_size);
 			break;
+		case SENSORS_FEATURE_HUMIDITY:
+			print_chip_humidity(name, feature, label_size);
+			break;
 		default:
 			continue;
 		}

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw

Hi Jean,

Quoted 10 lines · Iain Paton

Testing out a humidity sensor recently and was thinking the driver wasn't working somehow. Discovered instead that the driver works fine, but the sensors command was ignoring the humidity data.
This adds output of humidity data for sensors that support it.

Please consider applying it.

Thanks,
Iain

mind if I apply this patch to lm-sensors ?

Thanks,
Guenter

Quoted 42 lines

diff -Naur lm_sensors-3.3.2-org/prog/sensors/chips.c lm_sensors-3.3.2/prog/sensors/chips.c

prog/sensors/chips.c +24 -0
@@ -658,6 +658,27 @@
 	free(label);
 }
 
+static void print_chip_humidity(const sensors_chip_name *name,
+			   const sensors_feature *feature,
+			   int label_size)
+{
+	char *label;
+	const sensors_subfeature *subfeature;
+	double vid;
+
+	subfeature = sensors_get_subfeature(name, feature,
+					    SENSORS_SUBFEATURE_HUMIDITY_INPUT);
+	if (!subfeature)
+		return;
+
+	if ((label = sensors_get_label(name, feature))
+	 && !sensors_get_value(name, subfeature->number, &vid)) {
+		print_label(label, label_size);
+		printf("%6.1f \%RH\n", vid);
+	}
+	free(label);
+}
+
 static void print_chip_beep_enable(const sensors_chip_name *name,
 				   const sensors_feature *feature,
 				   int label_size)
@@ -792,6 +813,9 @@
 		case SENSORS_FEATURE_INTRUSION:
 			print_chip_intrusion(name, feature, label_size);
 			break;
+		case SENSORS_FEATURE_HUMIDITY:
+			print_chip_humidity(name, feature, label_size);
+			break;
 		default:
 			continue;
 		}
Quoted 6 lines

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Iain Paton
Quoted 8 lines · Guenter Roeck

Hi Jean,

Quoted 5 lines · Iain Paton

Testing out a humidity sensor recently and was thinking the driver wasn't working somehow. Discovered instead that the driver works fine, but the sensors command was ignoring the humidity data.
This adds output of humidity data for sensors that support it.

Quoted 6 lines
Quoted 5 lines

Please consider applying it.

Thanks,
Iain

mind if I apply this patch to lm-sensors ?

Please do, I could never find the time to review or test it :(

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#3 lore raw
In reply to Iain Paton
Quoted 9 lines · Jean Delvare
Quoted 8 lines · Guenter Roeck

Hi Jean,

Quoted 5 lines · Iain Paton

Testing out a humidity sensor recently and was thinking the driver wasn't working somehow. Discovered instead that the driver works fine, but the sensors command was ignoring the humidity data.
This adds output of humidity data for sensors that support it.

Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

Please consider applying it.

Thanks,
Iain

mind if I apply this patch to lm-sensors ?

Please do, I could never find the time to review or test it :(

Cleaned up a bit, tested, and committed.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors