WIP: Adding Mainboard page #14

Draft
ahoneybun wants to merge 4 commits from add-mainboard-info into main
ahoneybun commented 2024-10-08 15:13:15 +00:00 (Migrated from github.com)

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

This is just WIP as it does currently error out on the page.
sungsphinx (Migrated from github.com) reviewed 2024-10-08 15:13:15 +00:00
edfloreshz (Migrated from github.com) requested changes 2024-10-08 16:51:07 +00:00
edfloreshz (Migrated from github.com) left a comment

Found some small details

Found some small details
@ -88,11 +95,20 @@ impl Application for AppModel {
Err((_errors, config)) => config,
})
edfloreshz (Migrated from github.com) commented 2024-10-08 16:50:54 +00:00

You probably need to run this as sudo for it to work.

You probably need to run this as sudo for it to work.
edfloreshz (Migrated from github.com) commented 2024-10-08 16:49:48 +00:00

This wont work for this string, we need to exclude lines without : first.

This wont work for this string, we need to exclude lines without `:` first.
ahoneybun (Migrated from github.com) reviewed 2024-10-08 17:08:24 +00:00
ahoneybun (Migrated from github.com) commented 2024-10-08 17:08:24 +00:00

Mm I'm not sure how to do that personally lol. I just copied the other lines.

Mm I'm not sure how to do that personally lol. I just copied the other lines.
ahoneybun (Migrated from github.com) reviewed 2024-10-08 17:09:10 +00:00
@ -88,11 +95,20 @@ impl Application for AppModel {
Err((_errors, config)) => config,
})
ahoneybun (Migrated from github.com) commented 2024-10-08 17:09:10 +00:00

The issue with that is that there will not be a prompt to ask the user for that currently. It looks like this gives some info without sudo:

cat /sys/devices/virtual/dmi/id/board_{vendor,name,version}

The issue with that is that there will not be a prompt to ask the user for that currently. It looks like this gives some info without sudo: cat /sys/devices/virtual/dmi/id/board_{vendor,name,version}
edfloreshz (Migrated from github.com) reviewed 2024-10-08 17:09:58 +00:00
edfloreshz (Migrated from github.com) commented 2024-10-08 17:09:58 +00:00

Yeah me neither, but maybe there's a way to prompt the user for authorization and elevate the process.

Yeah me neither, but maybe there's a way to prompt the user for authorization and elevate the process.
ahoneybun (Migrated from github.com) reviewed 2024-10-08 17:18:22 +00:00
ahoneybun (Migrated from github.com) commented 2024-10-08 17:18:22 +00:00

I'm sure there is/will be but perhaps we'll want to do this a different way.

I'm sure there is/will be but perhaps we'll want to do this a different way.
edfloreshz (Migrated from github.com) reviewed 2024-10-08 17:20:44 +00:00
edfloreshz (Migrated from github.com) commented 2024-10-08 17:20:44 +00:00

Sorry I confused the conversations, you can use filter for that.

Sorry I confused the conversations, you can use `filter` for that.
ahoneybun commented 2024-10-08 19:44:04 +00:00 (Migrated from github.com)

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

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

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 2024-11-03 02:24:08 +00:00 (Migrated from github.com)

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

It looks like `hostnamectl` does not need root and it provides board information.
sungsphinx (Migrated from github.com) requested changes 2024-11-03 14:56:59 +00:00
sungsphinx (Migrated from github.com) left a comment

The page displays info that should probably not be on the motherboard page:

image

The page displays info that should probably not be on the motherboard page: ![image](https://github.com/user-attachments/assets/e765c366-c78d-4ea5-98dc-b1161ed4de11)
@ -355,6 +371,33 @@ impl Application for AppModel {
.height(Length::Fill)
sungsphinx (Migrated from github.com) commented 2024-11-03 14:50:18 +00:00
                                settings::item(prefix.trim(), widget::text::body(suffix)).into()

We should trim all whitespaces out of the prefix, otherwise it looks strange.

```suggestion settings::item(prefix.trim(), widget::text::body(suffix)).into() ``` We should trim all whitespaces out of the prefix, otherwise it looks strange.
ahoneybun commented 2024-11-03 18:04:03 +00:00 (Migrated from github.com)

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

@sungsphinx I need to get it to build on 24.10 for testing on my end.
edfloreshz (Migrated from github.com) approved these changes 2024-11-03 19:28:54 +00:00
edfloreshz (Migrated from github.com) left a comment

LGTM

LGTM
ahoneybun commented 2024-11-04 13:31:30 +00:00 (Migrated from github.com)

Yea it certainly has more info then we may want.

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

Yea it certainly has more info then we may want. ![screenshot-2024-11-04-13-31-03](https://github.com/user-attachments/assets/136e87b9-8ac0-408c-a1e9-9d844c339984)
ahoneybun commented 2024-11-05 17:26:46 +00:00 (Migrated from github.com)

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

I don't know how to trim out more content @sungsphinx but this at least gets a nice starting point.
edfloreshz commented 2024-11-05 17:48:49 +00:00 (Migrated from github.com)

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

I don’t believe it has more info than what’s needed, is just the right amount imo
sungsphinx commented 2024-11-05 18:32:19 +00:00 (Migrated from github.com)

@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}
@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`: ```bash hostnamectl --json={pretty or short} ```
ahoneybun commented 2024-11-05 18:35:34 +00:00 (Migrated from github.com)

@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}
> @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`: > > ```shell > 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 2024-11-05 18:37:49 +00:00 (Migrated from github.com)

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

Should have mentioned certain only lines/blocks/whatever it is in JSON files that relate to the motherboard lol.
ahoneybun commented 2024-11-05 18:53:02 +00:00 (Migrated from github.com)

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 }
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 2024-11-05 19:02:57 +00:00 (Migrated from github.com)

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

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 2024-11-06 13:00:34 +00:00 (Migrated from github.com)

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

How about getting the JSON a de-serializing it to a struct that only contains the fields we need?
ahoneybun commented 2024-11-06 16:29:46 +00:00 (Migrated from github.com)

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!

> 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 2024-11-06 17:06:13 +00:00 (Migrated from github.com)

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

Refer to [this](https://docs.rs/serde_json/latest/serde_json/#operating-on-untyped-json-values), you can read a JSON and access specific untyped values by key.
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin add-mainboard-info:add-mainboard-info
git switch add-mainboard-info

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff add-mainboard-info
git switch add-mainboard-info
git rebase main
git switch main
git merge --ff-only add-mainboard-info
git switch add-mainboard-info
git rebase main
git switch main
git merge --no-ff add-mainboard-info
git switch main
git merge --squash add-mainboard-info
git switch main
git merge --ff-only add-mainboard-info
git switch main
git merge add-mainboard-info
git push origin main
Sign in to join this conversation.
No description provided.