Skip to content

Commit

Permalink
ATA JSON parser improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashaduri committed Apr 24, 2024
1 parent 1b72647 commit 61fe92e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/applib/smartctl_json_ata_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,8 @@ hz::ExpectedVoid<SmartctlParserError> SmartctlJsonAtaParser::parse_section_direc

// Entries
if (table_node.has_value() && table_node->is_array()) {
lines.emplace_back();

for (const auto& table_entry : table_node.value()) {
const uint64_t address = get_node_data<uint64_t>(table_entry, "address").value_or(0);
const std::string name = get_node_data<std::string>(table_entry, "name").value_or(std::string());
Expand Down Expand Up @@ -1018,7 +1020,7 @@ hz::ExpectedVoid<SmartctlParserError> SmartctlJsonAtaParser::parse_section_selec
const std::string status_str = get_node_data<std::string>(table_entry, "status/string").value_or(std::string());

lines.emplace_back(std::format(
"{:2} Min/Max LBA: {:20}{:20} Status: {}",
"Span: {:2} Min LBA: {:020} Max LBA: {:020} Status: {}",
entry_num,
lba_min,
lba_max,
Expand Down Expand Up @@ -1119,7 +1121,7 @@ hz::ExpectedVoid<SmartctlParserError> SmartctlJsonAtaParser::parse_section_sctte
// The whole section
if (!lines.empty()) {
AtaStorageProperty p;
p.set_name("Temperature log", "ata_sct_status/_merged");
p.set_name("Temperature log", "ata_sct_status/_and/ata_sct_temperature_history/_merged");
p.section = AtaStorageProperty::Section::TemperatureLog;
p.reported_value = hz::string_join(lines, "\n");
p.value = p.reported_value; // string-type value
Expand Down Expand Up @@ -1261,7 +1263,7 @@ hz::ExpectedVoid<SmartctlParserError> SmartctlJsonAtaParser::parse_section_satap
// const bool overflow = get_node_data<bool>(table_entry, "overflow").value_or(false);

lines.emplace_back(std::format(
"ID: 0x{:02X} Size: {:8} Value: {:20} Description: {}",
"ID: 0x{:04X} Size: {:8} Value: {:20} Description: {}",
id,
size,
value,
Expand Down
2 changes: 1 addition & 1 deletion src/applib/smartctl_text_ata_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2052,7 +2052,7 @@ SCT Error Recovery Control:
// the whole subsection
{
AtaStorageProperty p(pt);
p.set_name("SCT ERC log", "ata_sct_erc");
p.set_name("SCT ERC log", "ata_sct_erc/_merged");
p.reported_value = sub;
p.value = p.reported_value; // string-type value

Expand Down
2 changes: 1 addition & 1 deletion src/gsc_info_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ WarningLevel GscInfoWindow::fill_ui_error_recovery(const std::vector<AtaStorageP
continue;

// Note: Don't use property description as a tooltip here. It won't be available if there's no property.
if (p.generic_name == "ata_sct_erc") {
if (p.generic_name == "ata_sct_erc/_merged") {
Glib::RefPtr<Gtk::TextBuffer> buffer = textview->get_buffer();
buffer->set_text("\n" + Glib::ustring::compose(_("Complete SCT Error Recovery Control settings: %1"), "\n\n" + p.get_value<std::string>()));

Expand Down

0 comments on commit 61fe92e

Please sign in to comment.