mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 17:27:01 +00:00
[as5912-54x] Support PSU serial number
This commit is contained in:
@@ -200,3 +200,27 @@ int psu_ym2651y_pmbus_info_set(int id, char *node, int value)
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
#define PSU_SERIAL_NUMBER_LEN 18
|
||||
|
||||
int psu_serial_number_get(int id, char *serial, int serial_len)
|
||||
{
|
||||
int size = 0;
|
||||
int ret = ONLP_STATUS_OK;
|
||||
char *prefix = NULL;
|
||||
|
||||
if (serial == NULL || serial_len < PSU_SERIAL_NUMBER_LEN) {
|
||||
return ONLP_STATUS_E_PARAM;
|
||||
}
|
||||
|
||||
prefix = (id == PSU1_ID) ? PSU1_AC_PMBUS_PREFIX : PSU2_AC_PMBUS_PREFIX;
|
||||
|
||||
ret = onlp_file_read((uint8_t*)serial, PSU_SERIAL_NUMBER_LEN, &size, "%s%s", prefix, "psu_mfr_serial");
|
||||
if (ret != ONLP_STATUS_OK || size != PSU_SERIAL_NUMBER_LEN) {
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
|
||||
}
|
||||
|
||||
serial[PSU_SERIAL_NUMBER_LEN] = '\0';
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ typedef enum psu_type {
|
||||
} psu_type_t;
|
||||
|
||||
psu_type_t get_psu_type(int id, char* modelname, int modelname_len);
|
||||
int psu_serial_number_get(int id, char *serial, int serial_len);
|
||||
|
||||
enum onlp_thermal_id
|
||||
{
|
||||
|
||||
@@ -101,7 +101,9 @@ psu_ym2651y_info_get(onlp_psu_info_t* info)
|
||||
if (psu_ym2651y_pmbus_info_get(index, "psu_p_out", &val) == 0) {
|
||||
info->mpout = val;
|
||||
info->caps |= ONLP_PSU_CAPS_POUT;
|
||||
}
|
||||
}
|
||||
|
||||
psu_serial_number_get(index, info->serial, sizeof(info->serial));
|
||||
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user