diff --git a/inc/switchtec/mrpc.h b/inc/switchtec/mrpc.h index 0441c5ba..b5b7882a 100644 --- a/inc/switchtec/mrpc.h +++ b/inc/switchtec/mrpc.h @@ -180,6 +180,7 @@ enum mrpc_sub_cmd { MRPC_DIETEMP_GET = 2, MRPC_DIETEMP_STOP = 3, MRPC_DIETEMP_GET_GEN4 = 2, + MRPC_DIETEMP_GET_GEN5 = 4, MRPC_MULTI_CFG_SUPPORTED = 0, MRPC_MULTI_CFG_COUNT = 1, diff --git a/lib/switchtec.c b/lib/switchtec.c index acdcc600..ed8dc7af 100644 --- a/lib/switchtec.c +++ b/lib/switchtec.c @@ -1806,12 +1806,20 @@ float switchtec_die_temp(struct switchtec_dev *dev) sizeof(sub_cmd_id), &temp, sizeof(temp)); if (ret) return -100.0; - } else { + } else if (switchtec_is_gen4(dev)) { sub_cmd_id = MRPC_DIETEMP_GET_GEN4; ret = switchtec_cmd(dev, MRPC_DIETEMP, &sub_cmd_id, sizeof(sub_cmd_id), &temp, sizeof(temp)); if (ret) return -100.0; + } else { + sub_cmd_id = MRPC_DIETEMP_GET_GEN5; + uint32_t temps[4]; + ret = switchtec_cmd(dev, MRPC_DIETEMP, &sub_cmd_id, + sizeof(sub_cmd_id), temps, sizeof(temps)); + if (ret) + return -100.0; + temp = (temps[0] + temps[1] + temps[2] + temps[3]) / 4; } return le32toh(temp) / 100.;