Add missing onlp_sysi_onie_data_get() implementation.

This commit is contained in:
Jeffrey Townsend
2016-09-04 17:23:14 +00:00
parent c3afa569c0
commit 3f30495d98
2 changed files with 21 additions and 2 deletions

View File

@@ -46,6 +46,8 @@
#define PSU1_AC_HWMON_NODE(node) PSU1_AC_HWMON_PREFIX#node
#define PSU2_AC_HWMON_NODE(node) PSU2_AC_HWMON_PREFIX#node
#define IDPROM_PATH "/sys/class/i2c-adapter/i2c-1/1-0057/eeprom"
int deviceNodeWriteInt(char *filename, int value, int data_len);
int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len);
int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_len);
@@ -63,7 +65,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len);
#if (DEBUG_MODE == 1)
#define DEBUG_PRINT(format, ...) printf(format, __VA_ARGS__)
#else
#define DEBUG_PRINT(format, ...)
#define DEBUG_PRINT(format, ...)
#endif
#endif /* __PLATFORM_LIB_H__ */

View File

@@ -34,6 +34,8 @@
#include "x86_64_accton_as7512_32x_int.h"
#include "x86_64_accton_as7512_32x_log.h"
#include "platform_lib.h"
#include <onlplib/file.h>
#define NUM_OF_THERMAL_ON_MAIN_BROAD 5
#define NUM_OF_FAN_ON_MAIN_BROAD 6
@@ -46,13 +48,28 @@ onlp_sysi_platform_get(void)
return "x86-64-accton-as7512-32x-r0";
}
int
onlp_sysi_onie_data_get(uint8_t** data, int* size)
{
uint8_t* rdata = aim_zmalloc(256);
if(onlp_file_read(rdata, 256, size, IDPROM_PATH) == ONLP_STATUS_OK) {
if(*size == 256) {
*data = rdata;
return ONLP_STATUS_OK;
}
}
aim_free(rdata);
*size = 0;
return ONLP_STATUS_E_INTERNAL;
}
int
onlp_sysi_oids_get(onlp_oid_t* table, int max)
{
int i;
onlp_oid_t* e = table;
memset(table, 0, max*sizeof(onlp_oid_t));
/* 4 Thermal sensors on the chassis */
for (i = 1; i <= NUM_OF_THERMAL_ON_MAIN_BROAD; i++)
{