Added --get=all information to General section.

Made General section scrollable
Changed all smartctl invocation parameters to full versions (very old smartctl
versions didn't support these, but we can drop their support from now on).
This commit is contained in:
Alexander Shaduri committed 2017-08-27 20:00:43 +00:00
1 parent 40e08796d1
commit fdcd190592
6 files changed
+138 -104

No files matched your search

+4 -4
View File
@@ -108,7 +108,7 @@ std::string SelfTest::start(hz::intrusive_ptr<CmdexSync> 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<CmdexSync> 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<CmdexSync> 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;
+28 -1
View File
@@ -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 {
+7 -10
View File
@@ -162,8 +162,7 @@ std::string StorageDevice::fetch_basic_data_and_parse(hz::intrusive_ptr<CmdexSyn
// We don't use "--all" - it may cause really screwed up the output (tests, etc...).
// This looks just like "--info" only on non-smart devices.
// --info --health --capabilities
std::string error_msg = execute_device_smartctl("-i -H -c", smartctl_ex, this->info_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<CmdexSync> 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;
+47 -53
View File
@@ -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<std::string>(value_capability);
} else if (value_type == StorageProperty::value_type_attribute) {
return hz::stream_cast<std::string>(value_attribute);
} else if (value_type == StorageProperty::value_type_error_block) {
return hz::stream_cast<std::string>(value_error_block);
} else if (value_type == StorageProperty::value_type_error_block) {
return hz::stream_cast<std::string>(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<std::string>(value_capability);
case StorageProperty::value_type_attribute:
return hz::stream_cast<std::string>(value_attribute);
case StorageProperty::value_type_error_block:
return hz::stream_cast<std::string>(value_error_block);
case StorageProperty::value_type_selftest_entry:
return hz::stream_cast<std::string>(value_selftest_entry);
}
return "[error]";
@@ -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) {
+49 -35
View File
@@ -78,46 +78,59 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkGrid" id="identity_table">
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="border_width">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkGrid" id="identity_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="border_width">12</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -738,6 +751,7 @@ Selective self-test log is also presented here.</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="min_content_height">120</property>
<child>
<object class="GtkTextView" id="test_description_textview">
<property name="visible">True</property>
@@ -924,8 +938,8 @@ Selective self-test log is also presented here.</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Re-read all the information</property>
<property name="use_stock">True</property>
<accelerator key="F5" signal="clicked"/>
<accelerator key="R" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
<accelerator key="F5" signal="clicked"/>
</object>
<packing>
<property name="expand">True</property>