Macchina-CLI / libmacchina

A library providing access to all sorts of system information.
https://crates.io/crates/libmacchina
MIT License
68 stars 20 forks source link

Machine/Product fetching gives useless information #84

Closed CuriouslyCurious closed 3 years ago

CuriouslyCurious commented 3 years ago

Hey!

On my custom-built machine the Machine-field in macchina gives me no useful information at all, since it reads fields the product_* from /sys that are not filled in by anyone. It works well on my laptop on the other hand.

image

Maybe it should read from for example /sys/class/dmi/id/board_name when the info received from the product_* is useless. Could also possibly change the Machine category name to "Motherboard" or something similar to better indicate what's being described in that case.

grtcdr commented 3 years ago

/sys/class/dmi/id/board_name could be misleading because it's not exactly the product name, but the motherboard's.

We should automatically fail the readout if your manufacturer just didn't set an appropriate value. I've seen a couple images where the machine spits out this same string, so we can treat this as an Err(ReadoutError::MetricNotAvailable)

CuriouslyCurious commented 3 years ago

Yeah, that'd work. I can make a PR for this if you want.

Is there a desire to have the motherboard name as a separate field?

grtcdr commented 3 years ago

Yeah, that'd work. I can make a PR for this if you want.

Great, have fun :)

Is there a desire to have the motherboard name as a separate field?

I'm not against it, I can see some situations where it might be relevant.

We can complement this readout with the boot method that was used (BIOS or UEFI), I don't know where Linux stores this, but FreeBSD has a convenient sysctl value called machdep.bootmethod which serves this exact purpose.

CuriouslyCurious commented 3 years ago

Excuse me for the uncleanliness of the commits. Late night pushing of code leads to silliness. :sweat_smile: