From 5ffc87ad9b651d3c749fd94fcc5fd8078e1cfed2 Mon Sep 17 00:00:00 2001 From: Alexander Shaduri Date: Sun, 1 May 2011 13:03:36 +0000 Subject: [PATCH] Set tooltips wherever we have "No description available". --- gsmartcontrol/TODO | 7 ---- gsmartcontrol/src/applib/smartctl_parser.cpp | 37 +++++++++++++++---- gsmartcontrol/src/applib/storage_device.cpp | 2 +- .../src/applib/storage_property_descr.cpp | 22 ++++++++--- 4 files changed, 47 insertions(+), 21 deletions(-) diff --git a/gsmartcontrol/TODO b/gsmartcontrol/TODO index 70305a4..74b11a3 100644 --- a/gsmartcontrol/TODO +++ b/gsmartcontrol/TODO @@ -36,13 +36,6 @@ Bugs / patches: TODO: -Set tooltips wherever we have "No description available". - -When running smartctl on drives, run them on the driveptr-s directly, - (use -i -H -c options, maybe even drive->fetch...()), so that the drive - remembers it. -If the detection executes "smartctl -i", don't execute it again afterwards. - Windows: If smartctl --scan-open returns no "sd*,port"-style devices, check if 3dm2 is installed and execute "tw_cli show" to get the controllers, then use the tw_cli variant of smartctl. diff --git a/gsmartcontrol/src/applib/smartctl_parser.cpp b/gsmartcontrol/src/applib/smartctl_parser.cpp index c25f232..7bb4acd 100644 --- a/gsmartcontrol/src/applib/smartctl_parser.cpp +++ b/gsmartcontrol/src/applib/smartctl_parser.cpp @@ -401,16 +401,36 @@ bool SmartctlParser::parse_section_info_property(StorageProperty& p) } - if (app_pcre_match("/Model Family/mi", p.reported_name) - || app_pcre_match("/Device Model/mi", p.reported_name) - || app_pcre_match("/Serial Number/mi", p.reported_name) - || app_pcre_match("/Firmware Version/mi", p.reported_name) - || app_pcre_match("/Sector Sizes/mi", p.reported_name) // prints 2 values (phys/logical, if they're different) - || app_pcre_match("/Sector Size/mi", p.reported_name) // prints a single value (if it's not 512) - ) { + if (app_pcre_match("/Model Family/mi", p.reported_name)) { + p.set_name(p.reported_name, "model_family", "Model Family"); p.value_type = StorageProperty::value_type_string; p.value_string = p.reported_value; + } else if (app_pcre_match("/Device Model/mi", p.reported_name)) { + p.set_name(p.reported_name, "device_model", "Device Model"); + p.value_type = StorageProperty::value_type_string; + p.value_string = p.reported_value; + + } else if (app_pcre_match("/Serial Number/mi", p.reported_name)) { + p.set_name(p.reported_name, "serial_number", "Serial Number"); + p.value_type = StorageProperty::value_type_string; + p.value_string = p.reported_value; + + } else if (app_pcre_match("/Firmware Version/mi", p.reported_name)) { + p.set_name(p.reported_name, "firmware_version", "Firmware Version"); + p.value_type = StorageProperty::value_type_string; + p.value_string = p.reported_value; + + } else if (app_pcre_match("/Sector Sizes/mi", p.reported_name)) { + p.set_name(p.reported_name, "sector_sizes", "Sector Sizes"); + p.value_type = StorageProperty::value_type_string; // prints 2 values (phys/logical, if they're different) + p.value_string = p.reported_value; + + } else if (app_pcre_match("/Sector Size/mi", p.reported_name)) { + p.set_name(p.reported_name, "sector_size", "Sector Size"); + p.value_type = StorageProperty::value_type_string; // prints a single value (if it's not 512) + p.value_string = p.reported_value; + } else if (app_pcre_match("/LU WWN Device Id/mi", p.reported_name)) { p.set_name(p.reported_name, "wwn_id", "World Wide Name"); p.value_type = StorageProperty::value_type_string; @@ -427,6 +447,7 @@ bool SmartctlParser::parse_section_info_property(StorageProperty& p) p.value_string = p.reported_value; } else if (app_pcre_match("/User Capacity/mi", p.reported_name)) { + p.set_name(p.reported_name, "capacity", "Capacity"); p.value_type = StorageProperty::value_type_integer; uint64_t v = 0; if ((p.readable_value = parse_byte_size(p.reported_value, v, true)).empty()) { @@ -1082,7 +1103,7 @@ bool SmartctlParser::parse_section_data_subsection_attributes(const std::string& hz::string_is_numeric(value, value_num, false); StorageProperty p(pt); - p.set_name(name); + p.set_name(name, "data_structure_version"); p.reported_value = value; p.value_type = StorageProperty::value_type_integer; p.value_integer = value_num; diff --git a/gsmartcontrol/src/applib/storage_device.cpp b/gsmartcontrol/src/applib/storage_device.cpp index 9c3eab3..b51051d 100644 --- a/gsmartcontrol/src/applib/storage_device.cpp +++ b/gsmartcontrol/src/applib/storage_device.cpp @@ -234,7 +234,7 @@ std::string StorageDevice::parse_basic_data(bool do_set_properties, bool emit_si } - std::string family; // this is from smartctl's database I think + std::string family; // this is from smartctl's database if (app_pcre_match("/^Model Family:[ \\t]*(.*)$/mi", info_output_, &family)) { family_name_ = hz::string_remove_adjacent_duplicates_copy(hz::string_trim_copy(family), ' '); } diff --git a/gsmartcontrol/src/applib/storage_property_descr.cpp b/gsmartcontrol/src/applib/storage_property_descr.cpp index 5e45eb8..8c1d4a0 100644 --- a/gsmartcontrol/src/applib/storage_property_descr.cpp +++ b/gsmartcontrol/src/applib/storage_property_descr.cpp @@ -740,12 +740,20 @@ bool storage_property_autoset_description(StorageProperty& p) // Section Info } else if (p.section == StorageProperty::section_info) { - found = auto_set(p, "Serial Number", "Serial number, unique to each physical drive.") - || auto_set(p, "User Capacity", "User-serviceable drive capacity as reported to an operating system.") + found = auto_set(p, "model_family", "Model family (from smartctl database)") + || auto_set(p, "device_model", "Device model") + || auto_set(p, "serial_number", "Serial number, unique to each physical drive") + || auto_set(p, "capacity", "User-serviceable drive capacity as reported to an operating system") || auto_set(p, "in_smartctl_db", "Whether the device is in smartctl database or not. If it is, additional information may be provided; otherwise, Raw values of some attributes may be incorrectly formatted.") || auto_set(p, "smart_supported", "Whether the device supports SMART. If not, then only very limited information will be available.") || auto_set(p, "smart_enabled", "Whether the device has SMART enabled. If not, most of the reported values will be incorrect."); + // set just its name as a tooltip + if (!found) { + p.set_description(p.readable_name); + found = true; + } + } else if (p.section == StorageProperty::section_data && p.subsection == StorageProperty::subsection_health) { found = auto_set(p, "overall_health", "Overall health self-assessment test result. Note: If the drive passes this test, it doesn't mean it's OK. " "However, if the drive doesn't pass it, then it's either already dead, or it's predicting its own failure within the next 24 hours. In this case do a backup immediately!"); @@ -765,17 +773,21 @@ bool storage_property_autoset_description(StorageProperty& p) || auto_set(p, "sct_cap_group", "Drive properties related to temperature information."); } else if (p.section == StorageProperty::section_data && p.subsection == StorageProperty::subsection_attributes) { - auto_set_attr(p); - found = true; // true, because auto_set_attr() may set "Unknown attribute", which is still "found". - + found = auto_set(p, "data_structure_version", p.readable_name.c_str()); + if (!found) { + auto_set_attr(p); + found = true; // true, because auto_set_attr() may set "Unknown attribute", which is still "found". + } } else if (p.section == StorageProperty::section_data && p.subsection == StorageProperty::subsection_error_log) { + found = auto_set(p, "error_log_version", p.readable_name.c_str()); found = auto_set(p, "error_count", "Number of errors in error log. Note: Some manufacturers may list completely harmless errors in this log " "(e.g., command invalid, not implemented, etc...)."); // || auto_set(p, "error_log_unsupported", "This device does not support error logging."); // the property text already says that } else if (p.section == StorageProperty::section_data && p.subsection == StorageProperty::subsection_selftest_log) { + found = auto_set(p, "selftest_log_version", p.readable_name.c_str()); found = auto_set(p, "selftest_num_entries", "Number of tests in selftest log. Note: This log usually contains only the last 20 or so manual tests. "); // || auto_set(p, "selftest_log_unsupported", "This device does not support self-test logging."); // the property text already says that