cosmic-utils / examine

A system information viewer for the COSMIC™ Desktop
GNU General Public License v3.0
8 stars 3 forks source link

Adding Mainboard page #14

Open ahoneybun opened 1 month ago

ahoneybun commented 1 month ago

This is just WIP as it does currently error out on the page.

ahoneybun commented 1 month ago

I think we may want to use this crate like how osrelease is pulled:

https://docs.rs/smbios-lib/0.9.2/smbioslib/

ahoneybun commented 4 weeks ago

It looks like hostnamectl does not need root and it provides board information.

ahoneybun commented 4 weeks ago

@sungsphinx I need to get it to build on 24.10 for testing on my end.

ahoneybun commented 4 weeks ago

Yea it certainly has more info then we may want.

screenshot-2024-11-04-13-31-03

ahoneybun commented 3 weeks ago

I don't know how to trim out more content @sungsphinx but this at least gets a nice starting point.

edfloreshz commented 3 weeks ago

I don’t believe it has more info than what’s needed, is just the right amount imo

sungsphinx commented 3 weeks ago

@edfloreshz I don't think it should show stuff like Operating System, Icon Name and Static Hostname, etc. Just motherboard related info.

@ahoneybun Maybe we could parse a json output from hostnamectl:

hostnamectl --json={pretty or short}
ahoneybun commented 3 weeks ago

@edfloreshz I don't think it should show stuff like Operating System, Icon Name and Static Hostname, etc. Just motherboard related info.

@ahoneybun Maybe we could parse a json output from hostnamectl:

hostnamectl --json={pretty or short}
aaronh@pop-os:~$ hostnamectl --json=pretty
{
    "Hostname" : "pop-os",
    "StaticHostname" : "pop-os",
    "PrettyHostname" : null,
    "DefaultHostname" : "localhost",
    "HostnameSource" : "static",
    "IconName" : "computer-desktop",
    "Chassis" : "desktop",
    "Deployment" : null,
    "Location" : null,
    "KernelName" : "Linux",
    "KernelRelease" : "6.9.3-76060903-generic",
    "KernelVersion" : "#202405300957~1728589823~24.04~3d61696 SMP PREEMPT_DYNAMIC Thu O",
    "OperatingSystemPrettyName" : "Pop!_OS 24.04 LTS",
    "OperatingSystemCPEName" : null,
    "OperatingSystemHomeURL" : "https://pop.system76.com",
    "HardwareVendor" : "System76",
    "HardwareModel" : "Thelio",
    "HardwareSerial" : null,
    "FirmwareVersion" : "F15a Z5",
    "FirmwareVendor" : "System76",
    "FirmwareDate" : 1582156800000000,
    "MachineID" : "dfcbb39e233116762e17fd0666578a76",
    "BootID" : "7b5f89cae03a4b63aa7cf84a74e2c982",
    "ProductUUID" : null
}
aaronh@pop-os:~$ hostnamectl --json=short
{"Hostname":"pop-os","StaticHostname":"pop-os","PrettyHostname":null,"DefaultHostname":"localhost","HostnameSource":"static","IconName":"computer-desktop","Chassis":"desktop","Deployment":null,"Location":null,"KernelName":"Linux","KernelRelease":"6.9.3-76060903-generic","KernelVersion":"#202405300957~1728589823~24.04~3d61696 SMP PREEMPT_DYNAMIC Thu O","OperatingSystemPrettyName":"Pop!_OS 24.04 LTS","OperatingSystemCPEName":null,"OperatingSystemHomeURL":"https://pop.system76.com","HardwareVendor":"System76","HardwareModel":"Thelio","HardwareSerial":null,"FirmwareVersion":"F15a Z5","FirmwareVendor":"System76","FirmwareDate":1582156800000000,"MachineID":"dfcbb39e233116762e17fd0666578a76","BootID":"7b5f89cae03a4b63aa7cf84a74e2c982","ProductUUID":null}
sungsphinx commented 3 weeks ago

Should have mentioned certain only lines/blocks/whatever it is in JSON files that relate to the motherboard lol.

ahoneybun commented 3 weeks ago

It looks like inxi --machine might be better?

I can't seem to build the project though:

[2024-11-05T18:52:12Z WARN  sctk_adwaita::buttons] Ignoring unknown button type:
thread 'main' panicked at src/app.rs:386:77:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[2024-11-05T18:52:12Z ERROR iced_winit::platform_specific::wayland::event_loop] SCTK failed to send Control::AboutToWait. TrySendError { kind: Disconnected }
sungsphinx commented 3 weeks ago

I had the same when I was attempting the Hardware Security page (#6), I think the command has a bit of a delay, and rust decides: nah I'm good thanks 1 second is too long

edfloreshz commented 3 weeks ago

How about getting the JSON a de-serializing it to a struct that only contains the fields we need?

ahoneybun commented 3 weeks ago

How about getting the JSON a de-serializing it to a struct that only contains the fields we need?

That's fine I just don't know how to do that, I can certainly change the output to JSON though!

edfloreshz commented 3 weeks ago

Refer to this, you can read a JSON and access specific untyped values by key.