Use field type encoding for dbus message format.
diff --git a/frup.c b/frup.c
index 7979f70..7bdf35f 100644
--- a/frup.c
+++ b/frup.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2003-2014 FreeIPMI Core Team
- *
+ *
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -13,7 +13,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ *
*/
/*****************************************************************************\
* Copyright (C) 2007-2014 Lawrence Livermore National Security, LLC.
@@ -44,8 +44,8 @@
#include <string.h>
#include <time.h>
#include <systemd/sd-bus.h>
+#include <ctype.h>
-#define IPMI_FRU_PARSER_DEBUG 1
#define uint8_t unsigned char
#define uint32_t unsigned int
@@ -89,8 +89,8 @@
};
typedef struct ipmi_fru_field ipmi_fru_field_t;
-/*
- * FRU Parser
+/*
+ * FRU Parser
*/
typedef struct ipmi_fru_area_info
@@ -114,7 +114,15 @@
OPENBMC_VPD_KEY_CHASSIS_TYPE = 1, /* not a type/len */
OPENBMC_VPD_KEY_CHASSIS_PART_NUM,
OPENBMC_VPD_KEY_CHASSIS_SERIAL_NUM,
- OPENBMC_VPD_KEY_CHASSIS_MAX = OPENBMC_VPD_KEY_CHASSIS_SERIAL_NUM,
+ OPENBMC_VPD_KEY_CHASSIS_CUSTOM1,
+ OPENBMC_VPD_KEY_CHASSIS_CUSTOM2,
+ OPENBMC_VPD_KEY_CHASSIS_CUSTOM3,
+ OPENBMC_VPD_KEY_CHASSIS_CUSTOM4,
+ OPENBMC_VPD_KEY_CHASSIS_CUSTOM5,
+ OPENBMC_VPD_KEY_CHASSIS_CUSTOM6,
+ OPENBMC_VPD_KEY_CHASSIS_CUSTOM7,
+ OPENBMC_VPD_KEY_CHASSIS_CUSTOM8,
+ OPENBMC_VPD_KEY_CHASSIS_MAX = OPENBMC_VPD_KEY_CHASSIS_CUSTOM8,
/* TODO: chassis_custom_fields */
OPENBMC_VPD_KEY_BOARD_MFG_DATE, /* not a type/len */
@@ -123,7 +131,15 @@
OPENBMC_VPD_KEY_BOARD_SERIAL_NUM,
OPENBMC_VPD_KEY_BOARD_PART_NUM,
OPENBMC_VPD_KEY_BOARD_FRU_FILE_ID,
- OPENBMC_VPD_KEY_BOARD_MAX = OPENBMC_VPD_KEY_BOARD_FRU_FILE_ID,
+ OPENBMC_VPD_KEY_BOARD_CUSTOM1,
+ OPENBMC_VPD_KEY_BOARD_CUSTOM2,
+ OPENBMC_VPD_KEY_BOARD_CUSTOM3,
+ OPENBMC_VPD_KEY_BOARD_CUSTOM4,
+ OPENBMC_VPD_KEY_BOARD_CUSTOM5,
+ OPENBMC_VPD_KEY_BOARD_CUSTOM6,
+ OPENBMC_VPD_KEY_BOARD_CUSTOM7,
+ OPENBMC_VPD_KEY_BOARD_CUSTOM8,
+ OPENBMC_VPD_KEY_BOARD_MAX = OPENBMC_VPD_KEY_BOARD_CUSTOM8,
/* TODO: board_custom_fields */
OPENBMC_VPD_KEY_PRODUCT_MFR,
@@ -133,38 +149,66 @@
OPENBMC_VPD_KEY_PRODUCT_SERIAL_NUM,
OPENBMC_VPD_KEY_PRODUCT_ASSET_TAG,
OPENBMC_VPD_KEY_PRODUCT_FRU_FILE_ID,
- OPENBMC_VPD_KEY_PRODUCT_MAX = OPENBMC_VPD_KEY_PRODUCT_FRU_FILE_ID,
- /* TODO: product_custom_fields */
+ OPENBMC_VPD_KEY_PRODUCT_CUSTOM1,
+ OPENBMC_VPD_KEY_PRODUCT_CUSTOM2,
+ OPENBMC_VPD_KEY_PRODUCT_CUSTOM3,
+ OPENBMC_VPD_KEY_PRODUCT_CUSTOM4,
+ OPENBMC_VPD_KEY_PRODUCT_CUSTOM5,
+ OPENBMC_VPD_KEY_PRODUCT_CUSTOM6,
+ OPENBMC_VPD_KEY_PRODUCT_CUSTOM7,
+ OPENBMC_VPD_KEY_PRODUCT_CUSTOM8,
+ OPENBMC_VPD_KEY_PRODUCT_MAX = OPENBMC_VPD_KEY_PRODUCT_CUSTOM8,
OPENBMC_VPD_KEY_MAX,
-
+ OPENBMC_VPD_KEY_CUSTOM_FIELDS_MAX=8,
+
};
-const char* vpd_key_names [] =
+const char* vpd_key_names [] =
{
- "Key Names Table Start",
- "Chassis Type", /*OPENBMC_VPD_KEY_CHASSIS_TYPE*/
- "Chassis Part Number", /*OPENBMC_VPD_KEY_CHASSIS_PART_NUM,*/
- "Chassis Serial Number", /*OPENBMC_VPD_KEY_CHASSIS_SERIAL_NUM,*/
+ "Key Names Table Start",
+ "Type", /*OPENBMC_VPD_KEY_CHASSIS_TYPE*/
+ "Part Number", /*OPENBMC_VPD_KEY_CHASSIS_PART_NUM,*/
+ "Serial Number", /*OPENBMC_VPD_KEY_CHASSIS_SERIAL_NUM,*/
+ "Custom Field 1", /*OPENBMC_VPD_KEY_CHASSIS_CUSTOM1,*/
+ "Custom Field 2", /*OPENBMC_VPD_KEY_CHASSIS_CUSTOM2,*/
+ "Custom Field 3", /*OPENBMC_VPD_KEY_CHASSIS_CUSTOM3,*/
+ "Custom Field 4", /*OPENBMC_VPD_KEY_CHASSIS_CUSTOM4,*/
+ "Custom Field 5", /*OPENBMC_VPD_KEY_CHASSIS_CUSTOM5,*/
+ "Custom Field 6", /*OPENBMC_VPD_KEY_CHASSIS_CUSTOM6,*/
+ "Custom Field 7", /*OPENBMC_VPD_KEY_CHASSIS_CUSTOM7,*/
+ "Custom Field 8", /*OPENBMC_VPD_KEY_CHASSIS_CUSTOM8,*/
- /* TODO: chassis_custom_fields */
+ "Mfg Date", /* OPENBMC_VPD_KEY_BOARD_MFG_DATE, */ /* not a type/len */
+ "Manufacturer", /* OPENBMC_VPD_KEY_BOARD_MFR, */
+ "Name", /* OPENBMC_VPD_KEY_BOARD_NAME, */
+ "Serial Number", /* OPENBMC_VPD_KEY_BOARD_SERIAL_NUM, */
+ "Part Number", /* OPENBMC_VPD_KEY_BOARD_PART_NUM, */
+ "FRU File ID", /* OPENBMC_VPD_KEY_BOARD_FRU_FILE_ID, */
+ "Custom Field 1", /*OPENBMC_VPD_KEY_BOARD_CUSTOM1,*/
+ "Custom Field 2", /*OPENBMC_VPD_KEY_BOARD_CUSTOM2,*/
+ "Custom Field 3", /*OPENBMC_VPD_KEY_BOARD_CUSTOM3,*/
+ "Custom Field 4", /*OPENBMC_VPD_KEY_BOARD_CUSTOM4,*/
+ "Custom Field 5", /*OPENBMC_VPD_KEY_BOARD_CUSTOM5,*/
+ "Custom Field 6", /*OPENBMC_VPD_KEY_BOARD_CUSTOM6,*/
+ "Custom Field 7", /*OPENBMC_VPD_KEY_BOARD_CUSTOM7,*/
+ "Custom Field 8", /*OPENBMC_VPD_KEY_BOARD_CUSTOM8,*/
- "Board Mfg Date", /* OPENBMC_VPD_KEY_BOARD_MFG_DATE, */ /* not a type/len */
- "Board Manufacturer", /* OPENBMC_VPD_KEY_BOARD_MFR, */
- "Board Name", /* OPENBMC_VPD_KEY_BOARD_NAME, */
- "Board Serial Number", /* OPENBMC_VPD_KEY_BOARD_SERIAL_NUM, */
- "Board Part Number", /* OPENBMC_VPD_KEY_BOARD_PART_NUM, */
- "Board FRU File ID", /* OPENBMC_VPD_KEY_BOARD_FRU_FILE_ID, */
- /* TODO: board_custom_fields */
-
- "Product Manufacturer", /* OPENBMC_VPD_KEY_PRODUCT_MFR, */
- "Product Name", /* OPENBMC_VPD_KEY_PRODUCT_NAME, */
- "Product Model Number", /* OPENBMC_VPD_KEY_PRODUCT_PART_MODEL_NUM, */
- "Product Version", /* OPENBMC_VPD_KEY_PRODUCT_VER, */
- "Product Serial Number", /* OPENBMC_VPD_KEY_PRODUCT_SERIAL_NUM, */
- "Product Asset Tag", /* OPENBMC_VPD_KEY_PRODUCT_ASSET_TAG, */
- "Product FRU File ID", /* OPENBMC_VPD_KEY_PRODUCT_FRU_FILE_ID, */
- /* TODO: product_custom_fields */
+ "Manufacturer", /* OPENBMC_VPD_KEY_PRODUCT_MFR, */
+ "Name", /* OPENBMC_VPD_KEY_PRODUCT_NAME, */
+ "Model Number", /* OPENBMC_VPD_KEY_PRODUCT_PART_MODEL_NUM, */
+ "Version", /* OPENBMC_VPD_KEY_PRODUCT_VER, */
+ "Serial Number", /* OPENBMC_VPD_KEY_PRODUCT_SERIAL_NUM, */
+ "Asset Tag", /* OPENBMC_VPD_KEY_PRODUCT_ASSET_TAG, */
+ "FRU File ID", /* OPENBMC_VPD_KEY_PRODUCT_FRU_FILE_ID, */
+ "Custom Field 1", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM1,*/
+ "Custom Field 2", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM2,*/
+ "Custom Field 3", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM3,*/
+ "Custom Field 4", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM4,*/
+ "Custom Field 5", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM5,*/
+ "Custom Field 6", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM6,*/
+ "Custom Field 7", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM7,*/
+ "Custom Field 8", /*OPENBMC_VPD_KEY_PRODUCT_CUSTOM8,*/
"Key Names Table End" /*OPENBMC_VPD_KEY_MAX,*/
};
@@ -209,10 +253,10 @@
ASSERT (areabuf);
ASSERT (areabuflen);
ASSERT (number_of_data_bytes);
-
+
type_length = areabufptr[current_area_offset];
- /* ipmi workaround
+ /* ipmi workaround
*
* dell p weredge r610
*
@@ -253,10 +297,10 @@
1 + (*number_of_data_bytes));
field->type_length_field_length = 1 + (*number_of_data_bytes);
}
-
+
return (0);
}
-
+
int
ipmi_fru_chassis_info_area (const void *areabuf,
unsigned int areabuflen,
@@ -418,7 +462,7 @@
area_offset++;
mfg_date_time_tmp |= (areabufptr[area_offset] << 16);
area_offset++;
-
+
/* mfg_date_time is in minutes, so multiple by 60 to get seconds */
mfg_date_time_tmp *= 60;
@@ -688,6 +732,7 @@
&number_of_data_bytes,
product_fru_file_id) < 0)
goto cleanup;
+
area_offset += 1; /* type/length byte */
area_offset += number_of_data_bytes;
@@ -726,12 +771,42 @@
}
+int _append_to_dict (uint8_t vpd_key_id, uint8_t* vpd_key_val, sd_bus_message* vpdtbl)
+{
+ int type_length = vpd_key_val[0];
+ int type_code = (type_length & IPMI_FRU_TYPE_LENGTH_TYPE_CODE_MASK) >> IPMI_FRU_TYPE_LENGTH_TYPE_CODE_SHIFT;
+ int vpd_val_len = type_length & IPMI_FRU_TYPE_LENGTH_NUMBER_OF_DATA_BYTES_MASK;
+ int sdr=0;
+
+ switch (type_code)
+ {
+ case 0:
+ printf ("_append_to_dict: VPD Key = [%s] : Type Code = [BINARY] : Len = [%d] : Val = [%s]\n", vpd_key_names [vpd_key_id], vpd_val_len, &vpd_key_val[1]);
+ sdr = sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[vpd_key_id], "ay", vpd_val_len, &vpd_key_val[1]);
+ /*sdr = sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[vpd_key_id], "s", &vpd_key_val[1]);*/
+ break;
+ case 3:
+ printf ("_append_to_dict: VPD Key = [%s] : Type Code = [ASCII+Latin] : Len = [%d] : Val = [%s]\n", vpd_key_names [vpd_key_id], vpd_val_len, &vpd_key_val[1]);
+ sdr = sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[vpd_key_id], "s", &vpd_key_val[1]);
+ break;
+ }
+
+ if (sdr < 0)
+ {
+#if IPMI_FRU_PARSER_DEBUG
+ printf ("_append_to_dict : sd_bus_message_append Failed [ %d ] for [%s]\n", sdr, vpd_key_names[vpd_key_id]);
+#endif
+ }
+}
+
int
parse_fru (const void* msgbuf, sd_bus_message* vpdtbl)
{
int ret = 0;
int rv = -1;
int i = 0;
+ int j = 0;
+ int isprintable = 0;
ipmi_fru_area_info_t fru_area_info [ IPMI_FRU_AREA_TYPE_MAX ];
ipmi_fru_common_hdr_t* chdr = NULL;
uint8_t* hdr = NULL;
@@ -739,9 +814,7 @@
ipmi_fru_field_t vpd_info [ OPENBMC_VPD_KEY_MAX ];
- /*char ipmi_fru_field_str [ IPMI_FRU_AREA_TYPE_LENGTH_FIELD_MAX ];
- uint32_t len=0;*/
- const uint8_t* ipmi_fru_field_str;
+ uint8_t* ipmi_fru_field_str;
/* Chassis */
uint8_t chassis_type;
@@ -779,7 +852,7 @@
if (chdr->internal)
{
fru_area_info [ IPMI_FRU_AREA_INTERNAL_USE ].len = 8*(*(hdr+8*chdr->internal+1));
-
+
/* TODO: Parse internal use area */
}
@@ -791,9 +864,10 @@
&chassis_type,
&vpd_info [OPENBMC_VPD_KEY_CHASSIS_PART_NUM],
&vpd_info [OPENBMC_VPD_KEY_CHASSIS_SERIAL_NUM],
- NULL, 0);
+ &vpd_info [OPENBMC_VPD_KEY_CHASSIS_CUSTOM1],
+ OPENBMC_VPD_KEY_CUSTOM_FIELDS_MAX);
}
-
+
if (chdr->board)
{
fru_area_info [ IPMI_FRU_AREA_BOARD_INFO ].len = 8*(*(hdr+8*chdr->board+1));
@@ -806,7 +880,8 @@
&vpd_info [OPENBMC_VPD_KEY_BOARD_SERIAL_NUM],
&vpd_info [OPENBMC_VPD_KEY_BOARD_PART_NUM],
&vpd_info [OPENBMC_VPD_KEY_BOARD_FRU_FILE_ID],
- NULL, 0);
+ &vpd_info [OPENBMC_VPD_KEY_BOARD_CUSTOM1],
+ OPENBMC_VPD_KEY_CUSTOM_FIELDS_MAX);
}
if (chdr->product)
@@ -822,7 +897,8 @@
&vpd_info [OPENBMC_VPD_KEY_PRODUCT_SERIAL_NUM],
&vpd_info [OPENBMC_VPD_KEY_PRODUCT_ASSET_TAG],
&vpd_info [OPENBMC_VPD_KEY_PRODUCT_FRU_FILE_ID],
- NULL, 0);
+ &vpd_info [OPENBMC_VPD_KEY_PRODUCT_CUSTOM1],
+ OPENBMC_VPD_KEY_CUSTOM_FIELDS_MAX);
}
if (chdr->multirec)
@@ -835,8 +911,6 @@
{
#if IPMI_FRU_PARSER_DEBUG
printf ("IPMI_FRU_AREA_TYPE=[%d] : Offset=[%d] : Len=[%d]\n", i, fru_area_info [i].off, fru_area_info[i].len);
-#else
-;
#endif
}
@@ -848,8 +922,6 @@
sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "y", chassis_type);
#if IPMI_FRU_PARSER_DEBUG
printf ("[%s] = [%d]\n", vpd_key_names[i], chassis_type);
-#else
-;
#endif
continue;
}
@@ -860,25 +932,16 @@
sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "s", timestr);
#if IPMI_FRU_PARSER_DEBUG
printf ("[%s] = [%d]\n", vpd_key_names[i], mfg_date_time);
-#else
-;
#endif
continue;
}
-
- /* FIXME: Field type encoding *ASSUMED* to be *BINARY* */
- ipmi_fru_field_str = (unsigned char*) &(vpd_info[i].type_length_field) + 1;
- sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "s", ipmi_fru_field_str);
- if (vpd_info[i].type_length_field_length)
- {
-#if IPMI_FRU_PARSER_DEBUG
- printf ("[%s] = [%s]\n", vpd_key_names[i], ipmi_fru_field_str);
-#else
-;
-#endif
- }
- }
+ /* Append TypeLen Field to Dictionary */
+ _append_to_dict (i, vpd_info[i].type_length_field, vpdtbl);
+
+ /*ipmi_fru_field_str = (unsigned char*) &(vpd_info[i].type_length_field) + 1;*/
+ /*sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "s", ipmi_fru_field_str); */
+ }
out:
rv = 0;
cleanup:
@@ -890,66 +953,72 @@
int ret = 0;
int rv = -1;
int i = 0;
+ int j = 0;
+ int sdr = 0;
+ int isprintable = 0;
+
+ /* Chassis */
+ uint8_t chassis_type;
+ /* Board */
+ uint32_t mfg_date_time;
+ /* Product */
+ unsigned int product_custom_fields_len;
+
ipmi_fru_area_info_t fru_area_info [ IPMI_FRU_AREA_TYPE_MAX ];
- ipmi_fru_common_hdr_t* chdr = NULL;
- uint8_t* hdr = NULL;
- const uint8_t* ipmi_fru_field_str=NULL;
+ ipmi_fru_field_t vpd_info [ OPENBMC_VPD_KEY_MAX ];
char timestr [ OPENBMC_VPD_VAL_LEN ];
+ uint8_t* ipmi_fru_field_str=NULL;
+ ipmi_fru_common_hdr_t* chdr = NULL;
+ uint8_t* hdr = NULL;
- ipmi_fru_field_t vpd_info [ OPENBMC_VPD_KEY_MAX ];
+ ASSERT (msgbuf);
+ ASSERT (vpdtbl);
+
for (i=0; i<OPENBMC_VPD_KEY_MAX; i++)
{
memset (vpd_info[i].type_length_field, '\0', IPMI_FRU_AREA_TYPE_LENGTH_FIELD_MAX);
vpd_info[i].type_length_field_length = 0;
}
- /* Chassis */
- uint8_t chassis_type;
-
- /* Board */
- uint32_t mfg_date_time;
-
- /* Product */
- unsigned int product_custom_fields_len;
-
- ASSERT (msgbuf);
- ASSERT (vpdtbl);
-
switch (area)
{
case IPMI_FRU_AREA_CHASSIS_INFO:
- ipmi_fru_chassis_info_area (msgbuf,
+#if IPMI_FRU_PARSER_DEBUG
+ printf ("Chassis : Buf len = [%d]\n", len);
+#endif
+ ipmi_fru_chassis_info_area ((uint8_t*)msgbuf+2,
len,
&chassis_type,
&vpd_info [OPENBMC_VPD_KEY_CHASSIS_PART_NUM],
&vpd_info [OPENBMC_VPD_KEY_CHASSIS_SERIAL_NUM],
- NULL, 0);
+ &vpd_info [OPENBMC_VPD_KEY_CHASSIS_CUSTOM1],
+ OPENBMC_VPD_KEY_CUSTOM_FIELDS_MAX);
/* Populate VPD Table */
for (i=1; i<=OPENBMC_VPD_KEY_CHASSIS_MAX; i++)
{
if (i==OPENBMC_VPD_KEY_CHASSIS_TYPE)
{
- sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "y", chassis_type);
#if IPMI_FRU_PARSER_DEBUG
- printf ("Chassis : [%s] = [%d]\n", vpd_key_names[i], chassis_type);
-#else
-;
+ printf ("Chassis : Appending [%s] = [%d]\n", vpd_key_names[i], chassis_type);
#endif
+ sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "y", chassis_type);
continue;
}
+
+ _append_to_dict (i, vpd_info[i].type_length_field, vpdtbl);
+/*
ipmi_fru_field_str = (unsigned char*) &(vpd_info[i].type_length_field) + 1;
- sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "s", ipmi_fru_field_str);
-#if IPMI_FRU_PARSER_DEBUG
- printf ("Chassis : [%s] = [%s]\n", vpd_key_names[i], ipmi_fru_field_str);
-#else
-;
-#endif
+ sdr = sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "s", ipmi_fru_field_str);
+*/
}
break;
case IPMI_FRU_AREA_BOARD_INFO:
- ipmi_fru_board_info_area (msgbuf,
+#if IPMI_FRU_PARSER_DEBUG
+ printf ("Board : Buf len = [%d]\n", len);
+#endif
+ ipmi_fru_board_info_area ((uint8_t*)msgbuf+2,
len,
NULL,
&mfg_date_time,
@@ -958,7 +1027,8 @@
&vpd_info [OPENBMC_VPD_KEY_BOARD_SERIAL_NUM],
&vpd_info [OPENBMC_VPD_KEY_BOARD_PART_NUM],
&vpd_info [OPENBMC_VPD_KEY_BOARD_FRU_FILE_ID],
- NULL, 0);
+ &vpd_info [OPENBMC_VPD_KEY_BOARD_CUSTOM1],
+ OPENBMC_VPD_KEY_CUSTOM_FIELDS_MAX);
/* Populate VPD Table */
for (i=OPENBMC_VPD_KEY_BOARD_MFR; i<=OPENBMC_VPD_KEY_BOARD_MAX; i++)
@@ -966,25 +1036,31 @@
if (i==OPENBMC_VPD_KEY_BOARD_MFG_DATE)
{
_to_time_str (mfg_date_time, timestr, OPENBMC_VPD_VAL_LEN);
- sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "s", timestr);
#if IPMI_FRU_PARSER_DEBUG
- printf ("Board : [%s] = [%d]\n", vpd_key_names[i], mfg_date_time);
-#else
-;
+ printf ("Board : Appending [%s] = [%d]\n", vpd_key_names[i], timestr);
#endif
+ sdr = sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "s", timestr);
+ if (sdr < 0)
+ {
+#if IPMI_FRU_PARSER_DEBUG
+ printf ("ipmi_fru_board_info_area : sd_bus_message_append Failed [ %d ] for [%s]\n", sdr, vpd_key_names[i]);
+#endif
+ }
continue;
}
+
+ _append_to_dict (i, vpd_info[i].type_length_field, vpdtbl);
+/*
ipmi_fru_field_str = (unsigned char*) &(vpd_info[i].type_length_field) + 1;
- sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "s", ipmi_fru_field_str);
-#if IPMI_FRU_PARSER_DEBUG
- printf ("Board : [%s] = [%s]\n", vpd_key_names[i], ipmi_fru_field_str);
-#else
-;
-#endif
+ sdr = sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "s", ipmi_fru_field_str);
+*/
}
break;
case IPMI_FRU_AREA_PRODUCT_INFO:
- ipmi_fru_product_info_area (msgbuf,
+#if IPMI_FRU_PARSER_DEBUG
+ printf ("Product : Buf len = [%d]\n", len);
+#endif
+ ipmi_fru_product_info_area ((uint8_t*)msgbuf+2,
len,
NULL,
&vpd_info [OPENBMC_VPD_KEY_PRODUCT_MFR],
@@ -994,16 +1070,12 @@
&vpd_info [OPENBMC_VPD_KEY_PRODUCT_SERIAL_NUM],
&vpd_info [OPENBMC_VPD_KEY_PRODUCT_ASSET_TAG],
&vpd_info [OPENBMC_VPD_KEY_PRODUCT_FRU_FILE_ID],
- NULL, 0);
+ &vpd_info [OPENBMC_VPD_KEY_PRODUCT_CUSTOM1],
+ OPENBMC_VPD_KEY_CUSTOM_FIELDS_MAX);
+
for (i=OPENBMC_VPD_KEY_PRODUCT_MFR; i<=OPENBMC_VPD_KEY_PRODUCT_MAX; i++)
{
- ipmi_fru_field_str = (unsigned char*) &(vpd_info[i].type_length_field) + 1;
- sd_bus_message_append (vpdtbl, "{sv}", vpd_key_names[i], "s", ipmi_fru_field_str);
-#if IPMI_FRU_PARSER_DEBUG
- printf ("Product : [%s] = [%s]\n", vpd_key_names[i], ipmi_fru_field_str);
-#else
-;
-#endif
+ _append_to_dict (i, vpd_info[i].type_length_field, vpdtbl);
}
break;
defualt:
@@ -1011,6 +1083,9 @@
break;
}
+#if IPMI_FRU_PARSER_DEBUG
+ printf ("parse_fru_area : Dictionary Packing Complete\n");
+#endif
out:
rv = 0;
cleanup: