mirror of
https://github.com/ashaduri/gsmartcontrol.git
synced 2026-09-25 05:15:33 +00:00
Hide self-test tab if NVMe does not support self-tests.
This commit is contained in:
@@ -169,7 +169,7 @@ bool SelfTest::is_supported() const
|
||||
case TestType::LongTest:
|
||||
{
|
||||
// Both short and long should be supported if the drive has a self-test log
|
||||
const StorageProperty p = drive_->get_property_repository().lookup_property("nvme_self_test_log/_tests_supported");
|
||||
const StorageProperty p = drive_->get_property_repository().lookup_property("nvme_self_test_log/_exists");
|
||||
return (!p.empty() && p.get_value<bool>());
|
||||
}
|
||||
}
|
||||
@@ -504,7 +504,7 @@ hz::ExpectedVoid<SelfTestExecutionError> SelfTest::update(const std::shared_ptr<
|
||||
// seconds per 10%. use double, because e.g. 60sec test gives silly values with int.
|
||||
const double gran = (double(total.count()) / 9.);
|
||||
|
||||
// Add 1/10 for disk load delays, etc. . Limit to 15sec, in case of very quick tests.
|
||||
// Add 1/10 for disk load delays, etc. Limit to 15sec, in case of very quick tests.
|
||||
poll_in_seconds_ = std::chrono::seconds(std::max(int64_t(15), int64_t(gran / 3. + (gran / 10.))));
|
||||
|
||||
// for long tests we don't want to make the user wait too much, so
|
||||
|
||||
@@ -384,17 +384,16 @@ hz::ExpectedVoid<SmartctlParserError> SmartctlJsonNvmeParser::parse_section_self
|
||||
|
||||
bool section_properties_found = false;
|
||||
|
||||
// If nvme_self_test_log is present, the drive supports tests
|
||||
{
|
||||
// If nvme_self_test_log is present, the drive supports tests.
|
||||
// Create this property only if supported, so that the UI can hide the tab if not needed.
|
||||
if (get_node_exists(json_root_node, "nvme_self_test_log").value_or(false)) {
|
||||
StorageProperty p;
|
||||
p.set_name("nvme_self_test_log/_tests_supported", "nvme_self_test_log/_tests_supported", _("Self-tests supported"));
|
||||
p.set_name("nvme_self_test_log/_exists", "nvme_self_test_log/_exists", _("Self-tests supported"));
|
||||
p.section = StoragePropertySection::SelftestLog;
|
||||
// p.show_in_ui = false;
|
||||
p.value = get_node_exists(json_root_node, "nvme_self_test_log").value_or(false);
|
||||
p.value = true;
|
||||
add_property(p);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
StorageProperty p;
|
||||
p.set_name("nvme_self_test_log/current_self_test_operation/value/_decoded",
|
||||
|
||||
@@ -405,8 +405,6 @@ void GscInfoWindow::fill_ui_with_info(bool scan, bool clear_ui, bool clear_tests
|
||||
}
|
||||
|
||||
bool has_selftest = prop_repo.has_properties_for_section(StoragePropertySection::SelftestLog);
|
||||
// NVMe spec supports self-tests by default.
|
||||
has_selftest = has_selftest || drive_->get_detected_type() == StorageDeviceDetectedType::Nvme;
|
||||
if (note_page_box = lookup_widget("test_tab_vbox"); note_page_box != nullptr) {
|
||||
// Some USB flash drives erroneously report SMART as enabled.
|
||||
// note_page_box->set_visible(drive->get_smart_status() == StorageDevice::Status::Enabled);
|
||||
|
||||
Reference in New Issue
Block a user