~team-iquik/lmsensors/trunk

« back to all changes in this revision

Viewing changes to prog/sensors/chips.c

  • Committer: groeck
  • Date: 2012-09-11 19:05:10 UTC
  • Revision ID: svn-v4:7894878c-1315-0410-8ee3-d5d059ff63e0:lm-sensors/trunk:6070
sensors: add humidity data to output of sensors command

Patch provided by Iain Paton.

Show diffs side-by-side

added added

removed removed

Lines of Context:
658
658
        free(label);
659
659
}
660
660
 
 
661
static void print_chip_humidity(const sensors_chip_name *name,
 
662
                                const sensors_feature *feature,
 
663
                                int label_size)
 
664
{
 
665
        char *label;
 
666
        const sensors_subfeature *subfeature;
 
667
        double humidity;
 
668
 
 
669
        subfeature = sensors_get_subfeature(name, feature,
 
670
                                            SENSORS_SUBFEATURE_HUMIDITY_INPUT);
 
671
        if (!subfeature)
 
672
                return;
 
673
 
 
674
        if ((label = sensors_get_label(name, feature))
 
675
         && !sensors_get_value(name, subfeature->number, &humidity)) {
 
676
                print_label(label, label_size);
 
677
                printf("%6.1f \%RH\n", humidity);
 
678
        }
 
679
        free(label);
 
680
}
 
681
 
661
682
static void print_chip_beep_enable(const sensors_chip_name *name,
662
683
                                   const sensors_feature *feature,
663
684
                                   int label_size)
792
813
                case SENSORS_FEATURE_INTRUSION:
793
814
                        print_chip_intrusion(name, feature, label_size);
794
815
                        break;
 
816
                case SENSORS_FEATURE_HUMIDITY:
 
817
                        print_chip_humidity(name, feature, label_size);
 
818
                        break;
795
819
                default:
796
820
                        continue;
797
821
                }