diff --git a/gsmartcontrol/src/applib/selftest.cpp b/gsmartcontrol/src/applib/selftest.cpp index 7f7b134..f6348ba 100644 --- a/gsmartcontrol/src/applib/selftest.cpp +++ b/gsmartcontrol/src/applib/selftest.cpp @@ -108,7 +108,7 @@ std::string SelfTest::start(hz::intrusive_ptr smartctl_ex) return "Invalid test specified"; std::string output; - std::string error_msg = drive_->execute_device_smartctl("-t " + test_param, smartctl_ex, output); // --test= + std::string error_msg = drive_->execute_device_smartctl("--test=" + test_param, smartctl_ex, output); if (!error_msg.empty()) // checks for empty output too return error_msg; @@ -168,7 +168,7 @@ std::string SelfTest::force_stop(hz::intrusive_ptr smartctl_ex) // To abort non-captive short, long and conveyance tests, use "--abort". std::string output; - std::string error_msg = drive_->execute_device_smartctl("-X", smartctl_ex, output); // --abort + std::string error_msg = drive_->execute_device_smartctl("--abort", smartctl_ex, output); if (!error_msg.empty()) // checks for empty output too return error_msg; @@ -207,8 +207,8 @@ std::string SelfTest::update(hz::intrusive_ptr smartctl_ex) return "Invalid drive given."; std::string output; -// std::string error_msg = drive_->execute_device_smartctl("-l selftest", smartctl_ex, output); // --log= - std::string error_msg = drive_->execute_device_smartctl("-c", smartctl_ex, output); // --capabilities +// std::string error_msg = drive_->execute_device_smartctl("--log=selftest", smartctl_ex, output); + std::string error_msg = drive_->execute_device_smartctl("--capabilities", smartctl_ex, output); if (!error_msg.empty()) // checks for empty output too return error_msg; diff --git a/gsmartcontrol/src/applib/smartctl_parser.cpp b/gsmartcontrol/src/applib/smartctl_parser.cpp index 46bf899..c068f27 100644 --- a/gsmartcontrol/src/applib/smartctl_parser.cpp +++ b/gsmartcontrol/src/applib/smartctl_parser.cpp @@ -545,7 +545,34 @@ bool SmartctlParser::parse_section_info_property(StorageProperty& p) p.value_bool = true; // let's be optimistic - just hope that it doesn't hurt. } - } else if (app_pcre_match("/^scsiMode/mi", p.reported_name)) { // these are some debug warnings from smartctl on usb flash drives + // "-g all" stuff + } else if (app_pcre_match("/^AAM feature is$/mi", p.reported_name)) { + p.set_name(p.reported_name, "aam_feature", "AAM Feature"); + p.value_type = StorageProperty::value_type_string; + p.value_string = p.reported_value; + + } else if (app_pcre_match("/^APM level is$/mi", p.reported_name)) { + p.set_name(p.reported_name, "apm_level", "APM Level"); + p.value_type = StorageProperty::value_type_string; + p.value_string = p.reported_value; + + } else if (app_pcre_match("/^Rd look-ahead is$/mi", p.reported_name)) { + p.set_name(p.reported_name, "read_lookahead", "Read Look-Ahead"); + p.value_type = StorageProperty::value_type_string; + p.value_string = p.reported_value; + + } else if (app_pcre_match("/^Write cache is$/mi", p.reported_name)) { + p.set_name(p.reported_name, "write_cache", "Write Cache"); + p.value_type = StorageProperty::value_type_string; + p.value_string = p.reported_value; + + } else if (app_pcre_match("/^ATA Security is$/mi", p.reported_name)) { + p.set_name(p.reported_name, "ata_security", "ATA Security"); + p.value_type = StorageProperty::value_type_string; + p.value_string = p.reported_value; + + // These are some debug warnings from smartctl on usb flash drives + } else if (app_pcre_match("/^scsiMode/mi", p.reported_name)) { p.show_in_ui = false; } else { diff --git a/gsmartcontrol/src/applib/storage_device.cpp b/gsmartcontrol/src/applib/storage_device.cpp index f1c64f0..3674eba 100644 --- a/gsmartcontrol/src/applib/storage_device.cpp +++ b/gsmartcontrol/src/applib/storage_device.cpp @@ -162,8 +162,7 @@ std::string StorageDevice::fetch_basic_data_and_parse(hz::intrusive_ptrinfo_output_, true); // set type to invalid if needed + std::string error_msg = execute_device_smartctl("--info --health --capabilities", smartctl_ex, this->info_output_, true); // set type to invalid if needed // Smartctl 5.39 cvs/svn version defaults to usb type on at least linux and windows. // This means that the old SCSI identify command isn't executed by default, @@ -324,11 +323,11 @@ std::string StorageDevice::fetch_data_and_parse(hz::intrusive_ptr sma // an addition to default -a output won't affect us. if (this->get_type_argument() == "scsi") { // not sure about correctness... FIXME probably fails with RAID/scsi // This doesn't do much yet, but just in case... - // SCSI equivalent of -a: - error_msg = execute_device_smartctl("-H -i -A -l error -l selftest", smartctl_ex, output); + // SCSI equivalent of -a --get=all: + error_msg = execute_device_smartctl("--health --info --get=all --attributes --log=error --log=selftest", smartctl_ex, output); } else { - // ATA equivalent of -a: - error_msg = execute_device_smartctl("-H -i -c -A -l error -l selftest -l selective", + // ATA equivalent of -a --get=all: + error_msg = execute_device_smartctl("--health --info --get=all --capabilities --attributes --log=error --log=selftest --log=selective", smartctl_ex, output, true); // set type to invalid if needed } // See notes above (in fetch_basic_data_and_parse()). @@ -423,8 +422,7 @@ A mandatory SMART command failed: exiting. To continue, add one or more '-T perm */ std::string output; - // --smart=on --saveauto=on, --smart=off - std::string error_msg = execute_device_smartctl((b ? "-s on -S on" : "-s off"), smartctl_ex, output); + std::string error_msg = execute_device_smartctl((b ? "--smart=on --saveauto=on" : "--smart=off"), smartctl_ex, output); if (!error_msg.empty()) return error_msg; @@ -458,8 +456,7 @@ SMART Automatic Offline Testing Disabled. A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options. */ std::string output; - // --offlineauto=on, --offlineauto=off - std::string error_msg = execute_device_smartctl((b ? "-o on" : "-o off"), smartctl_ex, output); + std::string error_msg = execute_device_smartctl((b ? "--offlineauto=on" : "--offlineauto=off"), smartctl_ex, output); if (!error_msg.empty()) return error_msg; diff --git a/gsmartcontrol/src/applib/storage_property.cpp b/gsmartcontrol/src/applib/storage_property.cpp index 5406be3..3fa080b 100644 --- a/gsmartcontrol/src/applib/storage_property.cpp +++ b/gsmartcontrol/src/applib/storage_property.cpp @@ -152,34 +152,35 @@ void StorageProperty::dump(std::ostream& os, int internal_offset) const // if (!readable_value.empty()) // os << readable_value; - if (value_type == StorageProperty::value_type_unknown) { - os << "[empty]"; - - } else if (value_type == StorageProperty::value_type_string) { - os << "\"" << value_string << "\""; - - } else if (value_type == StorageProperty::value_type_integer) { - os << value_integer << " [" << reported_value << "]"; - - } else if (value_type == StorageProperty::value_type_bool) { - os << value_bool << " [" << reported_value << "]"; - - } else if (value_type == StorageProperty::value_type_time_length) { - os << value_time_length << " [" << reported_value << "]"; - - } else if (value_type == StorageProperty::value_type_capability) { - os << value_capability; - - } else if (value_type == StorageProperty::value_type_attribute) { - os << value_attribute; - - } else if (value_type == StorageProperty::value_type_error_block) { - os << value_error_block; - - } else if (value_type == StorageProperty::value_type_selftest_entry) { - os << value_selftest_entry; + switch(value_type) { + case StorageProperty::value_type_unknown: + os << "[empty]"; + break; + case StorageProperty::value_type_string: + os << "\"" << value_string << "\""; + break; + case StorageProperty::value_type_integer: + os << value_integer << " [" << reported_value << "]"; + break; + case StorageProperty::value_type_bool: + os << value_bool << " [" << reported_value << "]"; + break; + case StorageProperty::value_type_time_length: + os << value_time_length << " [" << reported_value << "]"; + break; + case StorageProperty::value_type_capability: + os << value_capability; + break; + case StorageProperty::value_type_attribute: + os << value_attribute; + break; + case StorageProperty::value_type_error_block: + os << value_error_block; + break; + case StorageProperty::value_type_selftest_entry: + os << value_selftest_entry; + break; } - } @@ -189,32 +190,25 @@ std::string StorageProperty::format_value(bool add_reported_too) const if (!readable_value.empty()) return readable_value; - if (value_type == StorageProperty::value_type_unknown) { - return "[unknown]"; - - } else if (value_type == StorageProperty::value_type_string) { - return value_string; - - } else if (value_type == StorageProperty::value_type_integer) { - return hz::number_to_string(value_integer) + (add_reported_too ? (" [" + reported_value + "]") : ""); - - } else if (value_type == StorageProperty::value_type_bool) { - return std::string(value_bool ? "Yes" : "No") + (add_reported_too ? (" [" + reported_value + "]") : ""); - - } else if (value_type == StorageProperty::value_type_time_length) { - return hz::format_time_length(value_time_length) + (add_reported_too ? (" [" + reported_value + "]") : ""); - - } else if (value_type == StorageProperty::value_type_capability) { - return hz::stream_cast(value_capability); - - } else if (value_type == StorageProperty::value_type_attribute) { - return hz::stream_cast(value_attribute); - - } else if (value_type == StorageProperty::value_type_error_block) { - return hz::stream_cast(value_error_block); - - } else if (value_type == StorageProperty::value_type_error_block) { - return hz::stream_cast(value_selftest_entry); + switch(value_type) { + case StorageProperty::value_type_unknown: + return "[unknown]"; + case StorageProperty::value_type_string: + return value_string; + case StorageProperty::value_type_integer: + return hz::number_to_string(value_integer) + (add_reported_too ? (" [" + reported_value + "]") : ""); + case StorageProperty::value_type_bool: + return std::string(value_bool ? "Yes" : "No") + (add_reported_too ? (" [" + reported_value + "]") : ""); + case StorageProperty::value_type_time_length: + return hz::format_time_length(value_time_length) + (add_reported_too ? (" [" + reported_value + "]") : ""); + case StorageProperty::value_type_capability: + return hz::stream_cast(value_capability); + case StorageProperty::value_type_attribute: + return hz::stream_cast(value_attribute); + case StorageProperty::value_type_error_block: + return hz::stream_cast(value_error_block); + case StorageProperty::value_type_selftest_entry: + return hz::stream_cast(value_selftest_entry); } return "[error]"; diff --git a/gsmartcontrol/src/applib/storage_property_descr.cpp b/gsmartcontrol/src/applib/storage_property_descr.cpp index 0ca45cf..f3dc46d 100644 --- a/gsmartcontrol/src/applib/storage_property_descr.cpp +++ b/gsmartcontrol/src/applib/storage_property_descr.cpp @@ -1293,7 +1293,9 @@ bool storage_property_autoset_description(StorageProperty& p, StorageAttribute:: || 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."); + || auto_set(p, "smart_enabled", "Whether the device has SMART enabled. If not, most of the reported values will be incorrect.") + || auto_set(p, "aam_feature", "Automatic Acoustic Management (AAM) feature") + || auto_set(p, "apm_level", "Advanced Power Management (APM) level"); // set just its name as a tooltip if (!found) { diff --git a/gsmartcontrol/src/res/gsc_info_window.ui b/gsmartcontrol/src/res/gsc_info_window.ui index 1af9882..7cd2df0 100644 --- a/gsmartcontrol/src/res/gsc_info_window.ui +++ b/gsmartcontrol/src/res/gsc_info_window.ui @@ -78,46 +78,59 @@ False vertical - + True - False - center - center - True - 12 - 6 - 12 + True + in - - - - - - - - - - - - - - - - - - - - - - - - - + + True + False + + + True + False + center + center + True + 12 + 6 + 12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True - False + True 0 @@ -738,6 +751,7 @@ Selective self-test log is also presented here. True True in + 120 True @@ -924,8 +938,8 @@ Selective self-test log is also presented here. True Re-read all the information True - + True