openbmc / dbus-sensors

D-Bus configurable sensor scanning applications
Apache License 2.0
27 stars 44 forks source link

hwmontempsensor crashes when given (mis) configuration for NCT7802 Sensor #24

Open pointbazaar opened 1 year ago

pointbazaar commented 1 year ago
{
      "Address": "0x28",
      "Bus": 5,
      "Name": "GARBO_SENSOR",
      "Name1": "SYS_Air_Inlet",
      "Name2": "MB_Air_Inlet",
      "Name3": "MB_Air_Outlet",
      "Thresholds": [
        {
          "Direction": "greater than",
          "Label": "temp1",
          "Name": "upper critical",
          "Severity": 1,
          "Value": 40
        },
        {
          "Direction": "greater than",
          "Label": "temp2",
          "Name": "upper critical",
          "Severity": 1,
          "Value": 50
        },
        {
          "Direction": "greater than",
          "Label": "temp3",
          "Name": "upper critical",
          "Severity": 1,
          "Value": 70
        }
      ],
      "Type": "NCT7802"
    },

one solution is to remove the code for reading the thresholds from hwmontempsensor. Then ofc no thresholds but atleast the sensors show up.

the reason for crash is dbus related, it tries to create an interface which already exists. the interface in question is related to the thresholds.

pointbazaar commented 1 year ago

When providing an empty Thresholds Array, it also works.

pointbazaar commented 1 year ago

hwmontempsensor works when using Index based configuration instead of "Label" like in the above example.

Still not good that configuration can crash hwmontempsensor so i leave this open.

    {
      "Address": "0x28",
      "Bus": 5,
      "Name": "GARBO_SENSOR",
      "Name1": "SYS_Air_Inlet",
      "Name2": "MB_Air_Inlet",
      "Name3": "MB_Air_Outlet",
      "Thresholds": [
         {
           "Direction": "less than",
           "Name": "lower critical",
           "Index": 2,
           "Severity": 1,
           "Value": 0
         },
         {
           "Direction": "less than",
           "Name": "lower critical",
           "Index": 3,
           "Severity": 1,
           "Value": 0
         },
         {
           "Direction": "less than",
           "Name": "lower critical",
           "Index": 4,
           "Severity": 1,
           "Value": 0
         },
         {
           "Direction": "greater than",
           "Name": "upper critical",
           "Index": 2,
           "Severity": 1,
           "Value": 40
         },
         {
           "Direction": "greater than",
           "Name": "upper critical",
           "Index": 3,
           "Severity": 1,
           "Value": 40
         },
         {
           "Direction": "greater than",
           "Name": "upper critical",
           "Index": 4,
           "Severity": 1,
           "Value": 60
         }
      ],
      "Type": "NCT7802"
    },