mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-24 16:57:02 +00:00
Add support read psu serial number for as7312_54xs
This commit is contained in:
23
packages/platforms/accton/x86-64/x86-64-accton-as7312-54xs/onlp/builds/src/module/src/platform_lib.c
Normal file → Executable file
23
packages/platforms/accton/x86-64/x86-64-accton-as7312-54xs/onlp/builds/src/module/src/platform_lib.c
Normal file → Executable file
@@ -173,3 +173,26 @@ 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;
|
||||
}
|
||||
|
||||
1
packages/platforms/accton/x86-64/x86-64-accton-as7312-54xs/onlp/builds/src/module/src/platform_lib.h
Normal file → Executable file
1
packages/platforms/accton/x86-64/x86-64-accton-as7312-54xs/onlp/builds/src/module/src/platform_lib.h
Normal file → Executable file
@@ -72,6 +72,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);
|
||||
|
||||
//#define DEBUG_MODE 1
|
||||
|
||||
|
||||
2
packages/platforms/accton/x86-64/x86-64-accton-as7312-54xs/onlp/builds/src/module/src/psui.c
Normal file → Executable file
2
packages/platforms/accton/x86-64/x86-64-accton-as7312-54xs/onlp/builds/src/module/src/psui.c
Normal file → Executable file
@@ -104,6 +104,8 @@ psu_ym2651y_info_get(onlp_psu_info_t* info)
|
||||
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