vmatare / thinkfan

The minimalist fan control program
GNU General Public License v3.0
534 stars 61 forks source link

Add hwmon model option #211

Closed bhundven closed 1 year ago

bhundven commented 1 year ago

On NVME devices a file is available to differentiate them by model.

My thinkpad has one internal NVME slot, but I also use external USB-C and Thunderbolt NVME enclosures.

The internal slot shows up as hwmon3: /sys/class/hwmon/hwmon3/device/model

Which contains: WD_BLACK SN770 1TB and some trailing white-space characters.

This change adds an option to allow you to specify the model with or without the hwmon-name.

I have tested both configurations successfully:

  - hwmon: /sys/class/hwmon
    name: nvme
    model: WD_BLACK SN770 1TB
    indices: [1]

and

  - hwmon: /sys/class/hwmon
    model: WD_BLACK SN770 1TB
    indices: [1]

Signed-off-by: Bryan Hundven bryanhundven@gmail.com

vmatare commented 1 year ago

At first glance, this looks very tidy and thorough, so :+1:, but nonetheless I'll have to dedicate some more time to actually read it and think it through. I'll get back on that later... just so you know I'm not ignoring this^^

bhundven commented 1 year ago

I was thinking about adding just a new sensordevice that uses hwmon so you could just have a tag:

sensors:
  - nvme: <model>
    indices: [1]

but this is easier, and may apply to other device types that also provide a model name.

bhundven commented 1 year ago

Updated the branch against latest origin/master.

vmatare commented 1 year ago

but this is easier, and may apply to other device types that also provide a model name.

Yeah, I think I like it better with the model keyword. It should work with non-nvme devices... At least HDD have it, too.