| | 499 | |
| | 500 | /* Return the feature type based on the feature name */ |
| | 501 | sensors_feature_type sensors_feature_get_type( |
| | 502 | const sensors_feature_data *feature) |
| | 503 | { |
| | 504 | const char *name; |
| | 505 | |
| | 506 | /* this will only work when the sensors_chip_feature is obtained through |
| | 507 | sensors_get_all_features */ |
| | 508 | if (((const struct sensors_chip_feature *)feature)->sysname) |
| | 509 | name = ((const struct sensors_chip_feature *)feature)->sysname; |
| | 510 | else |
| | 511 | name = feature->name; |
| | 512 | |
| | 513 | if (strstr(name, "temp")) { |
| | 514 | if (strlen(name) == 5) |
| | 515 | return SENSORS_FEATURE_TEMP; |
| | 516 | |
| | 517 | if (strstr(name, "hyst")) |
| | 518 | return SENSORS_FEATURE_TEMP_HYST; |
| | 519 | |
| | 520 | if (strstr(name, "over")) |
| | 521 | return SENSORS_FEATURE_TEMP_OVER; |
| | 522 | |
| | 523 | if (strstr(name, "max")) |
| | 524 | return SENSORS_FEATURE_TEMP_MAX; |
| | 525 | |
| | 526 | if (strstr(name, "min")) |
| | 527 | return SENSORS_FEATURE_TEMP_MIN; |
| | 528 | |
| | 529 | if (strstr(name, "low")) |
| | 530 | return SENSORS_FEATURE_TEMP_LOW; |
| | 531 | |
| | 532 | if (strstr(name, "crit")) |
| | 533 | return SENSORS_FEATURE_TEMP_CRIT; |
| | 534 | } else if (strstr(name, "in") && name[0] != 'f') { |
| | 535 | if (strlen(name) == 3 || strstr(name, "input")) |
| | 536 | return SENSORS_FEATURE_IN; |
| | 537 | |
| | 538 | if (strstr(name, "max")) |
| | 539 | return SENSORS_FEATURE_IN_MAX; |
| | 540 | |
| | 541 | if (strstr(name, "min")) |
| | 542 | return SENSORS_FEATURE_IN_MIN; |
| | 543 | |
| | 544 | if (strstr(name, "alarm")) |
| | 545 | return SENSORS_FEATURE_IN_ALARM; |
| | 546 | } else if (strstr(name, "fan")) { |
| | 547 | if (strlen(name) == 4) |
| | 548 | return SENSORS_FEATURE_FAN; |
| | 549 | |
| | 550 | if (strstr(name, "min")) |
| | 551 | return SENSORS_FEATURE_FAN_MIN; |
| | 552 | |
| | 553 | if (strstr(name, "div")) |
| | 554 | return SENSORS_FEATURE_FAN_DIV; |
| | 555 | } else if (!strcmp(name, "vrm")) { |
| | 556 | return SENSORS_FEATURE_VRM; |
| | 557 | } else if (strstr(name, "vid")) { |
| | 558 | return SENSORS_FEATURE_VID; |
| | 559 | } |
| | 560 | |
| | 561 | return SENSORS_FEATURE_UNKNOWN; |
| | 562 | } |