Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't duplicate coretemp sensor readings #1822

Merged
merged 1 commit into from
Dec 17, 2020
Merged

Don't duplicate coretemp sensor readings #1822

merged 1 commit into from
Dec 17, 2020

Conversation

modelrockettier
Copy link
Contributor

Fixes #1708

@karabijavad I don't have a system that is affected by #1648 so I can't test that, but in theory this should handle both cases (duplicated coretemp hwmon directory entries and individual hwmon directory entries).

I chose to just to implement this as a simple string replacement / comparison since it's quicker and easier than doing a full stat() call on every temperature file to find duplicates.

On my Linux 5.7 system /sys/class/hwmon/hwmon2 is a symlink to /sys/devices/platform/coretemp.0/hwmon/hwmon2 meaning if you replace the leading /sys/devices/platform/coretemp.*/hwmon/ with /sys/class/hwmon/, you can quickly and easily check for duplicates.

@amanusk
Copy link
Collaborator

amanusk commented Sep 26, 2020

Can confirm the issue and fix. Following a recent kernel version, s-tui began displaying some temperature information twice.
Example for sensors_temperatures() without fix:

{
  "acpitz": [
    shwtemp((label = ""), (current = 48.0), (high = 128.0), (critical = 128.0))
  ],
  "pch_skylake": [
    shwtemp((label = ""), (current = 43.0), (high = None), (critical = None))
  ],
  "coretemp": [
    shwtemp(
      (label = "Package id 0"),
      (current = 51.0),
      (high = 100.0),
      (critical = 100.0)
    ),
    shwtemp(
      (label = "Core 0"),
      (current = 50.0),
      (high = 100.0),
      (critical = 100.0)
    ),
    shwtemp(
      (label = "Core 1"),
      (current = 47.0),
      (high = 100.0),
      (critical = 100.0)
    ),
    shwtemp(
      (label = "Package id 0"),
      (current = 51.0),
      (high = 100.0),
      (critical = 100.0)
    ),
    shwtemp(
      (label = "Core 0"),
      (current = 50.0),
      (high = 100.0),
      (critical = 100.0)
    ),
    shwtemp(
      (label = "Core 1"),
      (current = 47.0),
      (high = 100.0),
      (critical = 100.0)
    )
  ]
}

Package id0, core0, core2 are reported twice, with the same values
With fix:

{
  "acpitz": [
    shwtemp((label = ""), (current = 45.0), (high = 128.0), (critical = 128.0))
  ],
  "pch_skylake": [
    shwtemp((label = ""), (current = 39.0), (high = None), (critical = None))
  ],
  "iwlwifi_1": [
    shwtemp((label = ""), (current = 51.0), (high = None), (critical = None))
  ],
  "coretemp": [
    shwtemp(
      (label = "Package id 0"),
      (current = 45.0),
      (high = 100.0),
      (critical = 100.0)
    ),
    shwtemp(
      (label = "Core 0"),
      (current = 44.0),
      (high = 100.0),
      (critical = 100.0)
    ),
    shwtemp(
      (label = "Core 1"),
      (current = 45.0),
      (high = 100.0),
      (critical = 100.0)
    )
  ]
}

Sensors report for reference:

iwlwifi_1-virtual-0
Adapter: Virtual device
temp1:        +51.0°C

pch_skylake-virtual-0
Adapter: Virtual device
temp1:        +38.5°C


coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +45.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0:        +45.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1:        +44.0°C  (high = +100.0°C, crit = +100.0°C)

@giampaolo giampaolo merged commit 9e7fd6a into giampaolo:master Dec 17, 2020
giampaolo added a commit that referenced this pull request Dec 17, 2020
Signed-off-by: Giampaolo Rodola <[email protected]>
@modelrockettier
Copy link
Contributor Author

Thanks @giampaolo !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Linux 5.5.4] sensors_temperature() duplicates coretemp readings
3 participants