Changeset 2398

Show
Ignore:
Timestamp:
03/28/04 15:01:34 (9 years ago)
Author:
khali
Message:

Change pcf8591 magnitude (libsensors only) so as to display

values in pseudo-volts, much like what the 2.6 driver handles.

Location:
lm-sensors/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/lib/chips.c

    r2396 r2398  
    40844084                      RW, PCF8591_SYSCTL_AIN_CONF, VALUE(1), 0 }, 
    40854085    { SENSORS_PCF8591_CH0, "ch0", NOMAP, NOMAP, 
    4086                       R, PCF8591_SYSCTL_CH0, VALUE(1), 0, "in0_input", 3 }, 
     4086                      R, PCF8591_SYSCTL_CH0, VALUE(1), 2, "in0_input", 3 }, 
    40874087    { SENSORS_PCF8591_CH1, "ch1", NOMAP, NOMAP, 
    4088                       R, PCF8591_SYSCTL_CH1, VALUE(1), 0, "in1_input", 3 }, 
     4088                      R, PCF8591_SYSCTL_CH1, VALUE(1), 2, "in1_input", 3 }, 
    40894089    { SENSORS_PCF8591_CH2, "ch2", NOMAP, NOMAP, 
    4090                       R, PCF8591_SYSCTL_CH2, VALUE(1), 0, "in2_input", 3 }, 
     4090                      R, PCF8591_SYSCTL_CH2, VALUE(1), 2, "in2_input", 3 }, 
    40914091    { SENSORS_PCF8591_CH3, "ch3", NOMAP, NOMAP, 
    4092                       R, PCF8591_SYSCTL_CH3, VALUE(1), 0, "in3_input", 3 }, 
     4092                      R, PCF8591_SYSCTL_CH3, VALUE(1), 2, "in3_input", 3 }, 
    40934093    { SENSORS_PCF8591_AOUT_ENABLE, "aout_enable", NOMAP, NOMAP, 
    40944094                      RW, PCF8591_SYSCTL_AOUT_ENABLE, VALUE(1), 0, "out0_enable", 0 }, 
    40954095    { SENSORS_PCF8591_AOUT, "aout", NOMAP, NOMAP, 
    4096                       RW, PCF8591_SYSCTL_AOUT, VALUE(1), 0, "out0_output", 3 }, 
     4096                      RW, PCF8591_SYSCTL_AOUT, VALUE(1), 2, "out0_output", 3 }, 
    40974097    { 0 } 
    40984098  }; 
  • lm-sensors/trunk/prog/sensors/chips.c

    r2357 r2398  
    36673667{ 
    36683668  char *label; 
    3669   double ain_conf, ch0, ch1, ch2, ch3; 
     3669  int ain_conf = -1; 
     3670  double ain; 
    36703671  double aout_enable, aout; 
    36713672  int valid; 
    36723673 
    36733674  if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_AIN_CONF,&label,&valid) && 
    3674       !sensors_get_feature(*name,SENSORS_PCF8591_AIN_CONF,&ain_conf)) { 
     3675      !sensors_get_feature(*name, SENSORS_PCF8591_AIN_CONF, &ain)) { 
     3676        ain_conf = (int)ain; 
    36753677        if (valid) { 
    36763678          print_label(label,10); 
    3677           switch ((int)ain_conf) 
     3679          switch (ain_conf) 
    36783680          { 
    36793681            case 0: printf("four single ended inputs\n"); 
     
    36883690        } 
    36893691      } 
    3690   else printf("ERROR: Can't read analog inputs configuration!\n"); 
     3692  /* display no error, 2.6 driver doesn't have that file */ 
    36913693  free_the_label(&label); 
    36923694 
    36933695  if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH0,&label,&valid) && 
    3694       !sensors_get_feature(*name,SENSORS_PCF8591_CH0,&ch0)) { 
     3696      !sensors_get_feature(*name, SENSORS_PCF8591_CH0, &ain)) { 
    36953697        if (valid) { 
    36963698          print_label(label,10); 
    3697           printf("%0.0f\n", ch0); 
     3699          printf("%6.2fV\n", ain); 
    36983700        } 
    36993701      } 
     
    37023704 
    37033705  if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH1,&label,&valid) && 
    3704       !sensors_get_feature(*name,SENSORS_PCF8591_CH1,&ch1)) { 
     3706      !sensors_get_feature(*name, SENSORS_PCF8591_CH1, &ain)) { 
    37053707        if (valid) { 
    37063708          print_label(label,10); 
    3707           printf("%0.0f\n", ch1); 
     3709          printf("%6.2fV\n", ain); 
    37083710        } 
    37093711      } 
     
    37133715  if (ain_conf != 3) { 
    37143716    if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH2,&label,&valid) && 
    3715         !sensors_get_feature(*name,SENSORS_PCF8591_CH2,&ch2)) { 
     3717        !sensors_get_feature(*name, SENSORS_PCF8591_CH2, &ain)) { 
    37163718          if (valid) { 
    37173719            print_label(label,10); 
    3718             printf("%0.0f\n", ch2); 
     3720            printf("%6.2fV\n", ain); 
    37193721          } 
    37203722        } 
    3721     else printf("ERROR: Can't read ch2!\n"); 
     3723    else if (ain_conf >= 0) /* hide error for 2.6 kernel driver */ 
     3724      printf("ERROR: Can't read ch2!\n"); 
    37223725    free_the_label(&label); 
    37233726  } 
    37243727 
    3725   if (ain_conf == 0) { 
     3728  if (ain_conf <= 0) { 
    37263729    if (!sensors_get_label_and_valid(*name,SENSORS_PCF8591_CH3,&label,&valid) && 
    3727         !sensors_get_feature(*name,SENSORS_PCF8591_CH3,&ch3)) { 
     3730        !sensors_get_feature(*name, SENSORS_PCF8591_CH3, &ain)) { 
    37283731          if (valid) { 
    37293732            print_label(label,10); 
    3730             printf("%0.0f\n", ch3); 
     3733            printf("%6.2fV\n", ain); 
    37313734          } 
    37323735        } 
    3733     else printf("ERROR: Can't read ch3!\n"); 
     3736    else if (ain_conf >= 0) /* hide error for 2.6 kernel driver */ 
     3737      printf("ERROR: Can't read ch3!\n"); 
    37343738    free_the_label(&label); 
    37353739  } 
     
    37403744        if (valid) { 
    37413745          print_label(label,10); 
    3742           printf("%0.0f (%s)\n", aout, aout_enable?"enabled":"disabled"); 
     3746          printf("%6.2fV (%s)\n", aout, aout_enable?"enabled":"disabled"); 
    37433747        } 
    37443748      }