From fc4c4c18f7ab6c8cdcf8c2c9d071defe7698e7ae Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 27 Oct 2024 15:40:06 -0400 Subject: [PATCH 1/5] jovian-hardware-survey: Galileo is a thing --- pkgs/jovian-hardware-survey/jovian-hardware-survey.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb b/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb index e0a22cc2..d14a74c1 100755 --- a/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb +++ b/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb @@ -128,7 +128,10 @@ def dmi_info() end def is_steam_deck?() - system_information["Product Name"] == "Jupiter" + [ + "Jupiter", + "Galileo", + ].include?(system_information["Product Name"]) end FIELDS = [ From f956e45b3046407677b855328a068cc0e92b2e97 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 27 Oct 2024 16:10:41 -0400 Subject: [PATCH 2/5] jovian-hardware-survey: Fix RA4 info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And do less work ourselves... The vendor script does not provide a string for RA4, so we identify on the bootloader type, as they do. Though we still trust what the vendor tells us for D2× controllers. --- .../jovian-hardware-survey.rb | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb b/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb index d14a74c1..0ba61442 100755 --- a/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb +++ b/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb @@ -5,6 +5,13 @@ D20BOOTLOADER ||= "/usr/share/jupiter_controller_fw_updater/d20bootloader.py" +# Identifiers from: class DeviceType(IntEnum) +DeviceType = { + :D21_D21 => 0x100, + :D2x_D21 => 0x200, + :RA4 => 0x300, +} + # Handles joining/escaping a command, and raises on status != 0 # Additionally prints the command to stderr. def run(*args, stdout:, silent: false, stderr: false, ignore_fail: false) @@ -255,7 +262,7 @@ def controller_information() return @controller_information if @controller_information begin info = JSON.parse(run(D20BOOTLOADER, "getdevicesjson", silent: true, stdout: true)).first - bootloader_type = info["release_number"] >> 8 # Shift for the major release byte + bootloader_type = info["release_number"] & 0xff00 # Mask out lower byte raw = run(D20BOOTLOADER, "getinfo", silent: true, stdout: true, stderr: true) # Clean up the raw data @@ -266,27 +273,31 @@ def controller_information() .map { |line| line.split(/\s*-\s*/, 6).last } # "2023-08-09 20:35:03,265 - __main__ - INFO - ......" .join("\n") + # Seed device_type from the bootloader type + device_type = bootloader_type + # Extract the info - if bootloader_type == 3 - # RA4 - device_type = - raw - .split(/\n+/) - .grep(/Found a/) - .first - .sub("DeviceType.", "") - .split(/\s+/)[2] + if bootloader_type == DeviceType[:RA4] mcu = raw.split("**").last.strip mcus = [mcu] else # D20/D21 mcus = raw.split("\n\n") header = mcus.shift.split(/\n/) + # Let the vendor identify the device for us. device_type = header .find { |line| line.match(/^Found a/) } .split(/\s+/)[2] end + # Identify the device type from the bootloader type + if DeviceType.key(device_type.to_i) + device_type = DeviceType.key(device_type.to_i).to_s + end + + # Format the raw information (bootloader_type) with the information we got. + device_type = "%s (0x%x)" % [device_type.to_s, bootloader_type] + mcus = mcus.map do |mcu| mcu.split(/\n/) .grep(/:/) @@ -312,6 +323,7 @@ def controller_information() "Hardware Info" => mcus, "Bootloader Type" => bootloader_type, "Hardware ID" => mcus.first["Stored hardware ID"], + "Release Number" => info["release_number"], } end From 2ccd015d332f24560554bc834f5f569fdf6a56d4 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 27 Oct 2024 16:19:45 -0400 Subject: [PATCH 3/5] jovian-hardware-survey: Ingest processor flags --- pkgs/jovian-hardware-survey/jovian-hardware-survey.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb b/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb index 0ba61442..86d41edf 100755 --- a/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb +++ b/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb @@ -207,7 +207,14 @@ def board_information() end def processor_information() - dmi_info["Processor"]["data"] + dmi_info["Processor"]["data"].tap do + # Convert flags into a Hash, for converting into a JSON Object. + _1["Flags"] = _1["Flags"].split("\n").map do |line| + data = line.match(%r{^([^\s]+)\s+\((.*)\)$}) + [data[1], data[2]] + end + .to_h + end end def memory_information() From 9659735b8427c011711e30e6c536039989f54754 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 27 Oct 2024 16:20:34 -0400 Subject: [PATCH 4/5] jovian-hardware-survey: Ingest processor characteristics --- pkgs/jovian-hardware-survey/jovian-hardware-survey.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb b/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb index 86d41edf..3d3e03e1 100755 --- a/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb +++ b/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb @@ -214,6 +214,8 @@ def processor_information() [data[1], data[2]] end .to_h + # Convert characteristics into an array + _1["Characteristics"] = _1["Characteristics"].split("\n") end end From 2bc71f47f6c86d6165a42136ac5abe4d6cef4c1f Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Sun, 27 Oct 2024 16:31:01 -0400 Subject: [PATCH 5/5] jovian-hardware-survey: Expose family and product names --- pkgs/jovian-hardware-survey/jovian-hardware-survey.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb b/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb index 3d3e03e1..425ebc4a 100755 --- a/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb +++ b/pkgs/jovian-hardware-survey/jovian-hardware-survey.rb @@ -345,6 +345,8 @@ def steam_deck() ram_chip_size = memory_information["Devices"][0]["Size"].split(/\s+/, 2)[0].to_i [ + "Product Name: #{system_information["Product Name"]}", + "System Family: #{system_information["Family"]}", "Serial: #{system_information["Serial Number"]}", "Manufacturing year: #{manufacturing_information["Year"]}", "Manufacturing week: #{manufacturing_information["Week"]}",