1
0

4 Commits e0880c8b62 ... a655581c33

Autor SHA1 Nachricht Datum
  zhangbo a655581c33 fan_index vor 3 Jahren
  zhangbo 5f2cffa009 Merge branch 'master' of https://gogs.storlead.com/zhangbo/GD32F450_BMC_BaseCode vor 3 Jahren
  zhangbo 91b4538b1d remote power control vor 3 Jahren
  zhangbo e953cb3d34 temporary submit vor 3 Jahren

BIN
app/NCP81111_Config/ncp81111_cfg


BIN
app/UpdateFirmware/updateFW_app


+ 2 - 0
app/bmc/msghndlr/App/IPMDevice/IPMDevice.c

@@ -88,6 +88,8 @@ GetDevID ( uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
     static unsigned char MinorBCD;
     static int firsttime = 1;
 
+    printf("GetDevID ReqLen %d\n", ReqLen);
+
     if(firsttime == 1)
     {
         //	printf("Calling get firmware version only for first time\n");

+ 39 - 50
app/bmc/msghndlr/MsgHndlrTask.c

@@ -159,17 +159,18 @@ void *MsgHndlrTask( void *pArg )
 			continue;
 		}
 
-		//update checksum2
-		resMsgPkt.Data[resMsgPkt.Size]	=	CalculateCheckSum2(resMsgPkt.Data, resMsgPkt.Size);
-		resMsgPkt.Size++;
-
 		if(g_BMCInfo.IpmiConfig.UDSIfcSupport == 0x01 && (reqMsgPkt.SrcQ == gFdUdsRes))
 		{			
-			//TODO:UDS的数据结构在最后多了一个0,找机会要给他去掉。
-			resMsgPkt.Size = resMsgPkt.Size+1;
+			//UDS 数据包不需要checksum
 			SwapUDSIPMIMsg(&reqMsgPkt,&resMsgPkt);
-			resMsgPkt.Data[resMsgPkt.Size-1] = 0;
 		}
+		else
+		{
+			//update checksum2
+			resMsgPkt.Data[resMsgPkt.Size]	=	CalculateCheckSum2(resMsgPkt.Data, resMsgPkt.Size);
+			resMsgPkt.Size++;
+		}
+		
 
 		if(SYS_IFC_CHANNEL == reqMsgPkt.Channel)
 		{  
@@ -233,15 +234,14 @@ ValidateMsgHdr (MsgPkt_T* pReq)
 				 pIPMIMsgReq->ResAddr  = m_PendingBridgedResTbl[PBTbl][SeqNum].ReqMsgHdr.ReqAddr;
 				 pIPMIMsgReq->RqSeqLUN = m_PendingBridgedResTbl[PBTbl][SeqNum].ReqMsgHdr.RqSeqLUN;
 
-				 /* Calculate the Second CheckSum */
-				 pReq->Data[ pReq->Size - 1 ] = CalculateCheckSum2( pReq->Data, pReq->Size - 1 );
-				 pReq->Data[2] = (~(pReq->Data[0] + pReq->Data[1])) +1; //2's complement checksum
-
 				 pReq->Param = BRIDGING_REQUEST;
-
 				 
 				 if (m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ == gFd_LanIfcQ)
 				 {			
+				 	/* Calculate the Second CheckSum */
+					 pReq->Data[ pReq->Size - 1 ] = CalculateCheckSum2( pReq->Data, pReq->Size - 1 );
+					 pReq->Data[2] = (~(pReq->Data[0] + pReq->Data[1])) +1; //2's complement checksum
+
 					  for (j=pReq->Size - 1; j>=0; j--)
 					  {
 						   pReq->Data[j+1] = pReq->Data[j];
@@ -258,8 +258,8 @@ ValidateMsgHdr (MsgPkt_T* pReq)
 				 	memcpy(&pReq->Data[sizeof(IPMIUDSMsg_T)], &pReq->Data[0], pReq->Size);
 				 	memcpy(&pReq->Data[0], &m_PendingBridgedResTbl[PBTbl][SeqNum].ResMsgHdr.UDSMsgHdr, sizeof(IPMIUDSMsg_T));
 				 	pReq->Size += sizeof(IPMIUDSMsg_T);
-				 	pReq->Size++;
-				 	pReq->Data[pReq->Size-1] = 0;
+				 	//pReq->Size++;
+				 	//pReq->Data[pReq->Size-1] = 0;
 
 				 	((IPMIUDSMsg_T*)&pReq->Data[0])->IPMIMsgLen = pReq->Size;
 
@@ -318,17 +318,18 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 	{
 		//printf("log 1, pReq->Channel: %#x\n", pReq->Channel);
 		HdrOffset = sizeof (IPMIMsgHdr_T);
-		pReq->Size  = pReq->Size - HdrOffset - 1;
+		pReq->Size  = pReq->Size - HdrOffset - 1;	//remove header and checksum2
 	}
 	if(UDS_CHANNEL == pReq->Channel)
 	{
 		//printf("log 2, pReq->Size: %d, HdrOffset: %d\n", pReq->Size, HdrOffset);
+		//UDS数据没有校验,UDSHeader + data
 		HdrOffset = sizeof(IPMIUDSMsg_T);
-		pReq->Size = pReq->Size -HdrOffset - 1;
+		pReq->Size = pReq->Size -HdrOffset;
 	}
 	
 	SwapIPMIMsgHdr((IPMIMsgHdr_T*)pReq->Data, (IPMIMsgHdr_T*)pRes->Data);
-	pRes->Size  = HdrOffset + sizeof(uint8_t);
+	pRes->Size  = HdrOffset + sizeof(uint8_t);	//+ ccode
 
 	pthread_setspecific(g_tls.CurSessionID,&pReq->SessionID);
 
@@ -336,7 +337,7 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 	{
 		pRes->Data [HdrOffset] = CC_INV_CMD;
 		printf ("Invalid Net Function 0x%x or Invalid Command 0x%x\n",NET_FN(pReq->NetFnLUN), pReq->Cmd);
-		pRes->Size	+= 2;
+		pRes->Size;//	+= 2;		//??? why
 		return;
 	}
 	
@@ -351,30 +352,19 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
     {
 		if (0 != GetMsgHndlrMap (NET_FN (pReq->NetFnLUN), &pCmdHndlrMap))
 		{
-			// if(pBMCInfo->IpmiConfig.GrpExtnSupport == 1)
-			// {
-				if (0 != GroupExtnGetMsgHndlrMap (NET_FN (pReq->NetFnLUN), pReq->Data [HdrOffset], &pCmdHndlrMap) )
-				{
-					pRes->Data [HdrOffset] = CC_INV_CMD;
-					printf ("MsgHndlr.c : Invalid Net Function 0x%x or Invalid Command 0x%x\n",NET_FN(pReq->NetFnLUN), pReq->Cmd);
-					pRes->Size	+= 2;
-					return;
-				}
-			// }
-			// else
-			// {
-			// 	pRes->Data [HdrOffset] = CC_INV_CMD;
-			// 	printf ("MsgHndlr.c : Invalid Net Function 0x%x\n",NET_FN(pReq->NetFnLUN));
-			// 	pRes->Size	+= 2;
-			// 	return;
-			// }
+			if (0 != GroupExtnGetMsgHndlrMap (NET_FN (pReq->NetFnLUN), pReq->Data [HdrOffset], &pCmdHndlrMap) )
+			{
+				pRes->Data [HdrOffset] = CC_INV_CMD;
+				printf ("MsgHndlr.c : Invalid Net Function 0x%x or Invalid Command 0x%x\n",NET_FN(pReq->NetFnLUN), pReq->Cmd);
+				pRes->Size;//	+= 2;
+				return;
+			}			
 		}
 
 		if(GetCmdHndlr(pReq,pRes,pCmdHndlrMap,HdrOffset,CmdOverride,&pCmdHndlrMap) == FALSE)
 		{
 			pRes->Data [HdrOffset] = CC_INV_CMD;
-			pRes->Size	+= 2;
-			//printf("log 3\n");
+			pRes->Size;//	+= 2;		//??? why
 			return;
 		}
    }
@@ -387,7 +377,7 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 		{	
 			printf("Warning: Request data len error, require %d\n", pCmdHndlrMap->ReqLen);
 			pRes->Data [HdrOffset] = CC_REQ_INV_LEN;
-			pRes->Size	+= 2;
+			pRes->Size;//	+= 2;	//??? why
 			return;
 		}
 	}
@@ -397,7 +387,6 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 	//prepare response data for send message command
 	if( (CMD_SEND_MSG == pReq->Cmd) && (NETFN_APP == pReq->NetFnLUN >> 2))
 	{
-//		printf("log 4, size %d, Channel %d\n",pRes->Size, pRes->Channel);
 		int Offset = 0;
 		uint8_t SeqNum = g_BMCInfo.SendMsgSeqNum;
 		if ((0 == pRes->Size) &&
@@ -405,11 +394,11 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 			 (g_BMCInfo.IpmiConfig.SecondaryIPMBSupport == 0x01 && SECONDARY_IPMB_CHANNEL == pRes->Channel)) )
 		{
 			pRes->Param = PARAM_NO_RESPONSE;
-			Offset = HdrOffset + 2;
+			Offset = HdrOffset + 2;		//ccode + checksum2
 		}
 		else if (HdrOffset == pRes->Size)
 		{
-			Offset = HdrOffset + 1;
+			Offset = HdrOffset + 1;		// + checksum2
 		}
 
 	    PBTbl = ( ((pReq->Data[sizeof (IPMIMsgHdr_T)] & 0x0F) == SECONDARY_IPMB_CHANNEL) ? SECONDARY_PB_TBL : PRIMARY_PB_TBL );
@@ -426,9 +415,7 @@ ProcessIPMIReq (MsgPkt_T* pReq, MsgPkt_T* pRes)
 				}
 				else if(m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ == gFdUdsIfc)
 				{
-					//pRes->Size ++;
 					SwapUDSIPMIMsg ( pReq, pRes);
-					//pRes->Data[pRes->Size-1] = 0;
 					memcpy (&m_PendingBridgedResTbl[PBTbl][SeqNum].ResMsgHdr, pRes->Data, sizeof (IPMIUDSMsg_T));	
 					m_PendingBridgedResTbl[PBTbl][SeqNum].UDSSocket = pRes->Socket;
 					// printf("log666 \n");
@@ -673,15 +660,19 @@ void RespondSendMessage ( MsgPkt_T* pReq, uint8_t Status)
 		 {
 			ResPkt.Data [HdrOffset] = CC_UNSPECIFIED_ERR;
 		 }
-
-		 ResPkt.Size = HdrOffset + 1 + 1; // IPMI Header + Completion Code + Second Checksum
+		 ResPkt.Size = HdrOffset + 1; // IPMI Header + Completion Code
+		 
 		 ResPkt.Cmd = pIPMIResHdr->Cmd;
 		 ResPkt.NetFnLUN = pIPMIReqHdr->NetFnLUN;
 		 ResPkt.Channel = pReq->Channel;
-		 //ResPkt.Socket = pReq->Socket;
 
-		 /* Calculate the Second CheckSum */
-		 ResPkt.Data[ResPkt.Size - 1] = CalculateCheckSum2 (ResPkt.Data, ResPkt.Size-1);
+		 //UDS不需要checksum
+		 if(m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ != gFdUdsIfc)
+		 {
+		 	/* Calculate the Second CheckSum */
+		 	ResPkt.Data[ResPkt.Size] = CalculateCheckSum2 (ResPkt.Data, ResPkt.Size);
+		 	ResPkt.Size++; //+ Second Checksum
+		 }
 
 		 ResPkt.Param = BRIDGING_REQUEST;
 
@@ -691,8 +682,6 @@ void RespondSendMessage ( MsgPkt_T* pReq, uint8_t Status)
 		 }
 		 else if(m_PendingBridgedResTbl[PBTbl][SeqNum].DestQ == gFdUdsIfc)
 		 {
-		 	ResPkt.Size++;
-		 	ResPkt.Data[ResPkt.Size-1] = 0;
 		 	((IPMIUDSMsg_T*)&ResPkt.Data[0])->IPMIMsgLen = ResPkt.Size;
 		 	ResPkt.Socket = m_PendingBridgedResTbl[PBTbl][SeqNum].UDSSocket;
 		 	QueueFd = gFdUdsRes;

+ 1 - 4
app/bmc/msghndlr/PDKCmds.c

@@ -336,14 +336,11 @@ const CmdHndlrMap_T g_Storlead_CmdHndlr [] =
 {                                                              
     { CMD_GET_SYS_INFO,         PRIV_USER,      Storlead_GetSysInfo,        0xff,  0xAAAA ,0xFFFF},
     { CMD_GET_SENSOR_INFO,      PRIV_USER,      Storlead_GetSensorInfo,     0xff,  0xAAAA  ,0xFFFF},
-    { CMD_GET_SEL_ENTIRES,      PRIV_USER,      Storlead_GetSELEntires,     0xff,  0xAAAA  ,0xFFFF},
     { CMD_AUTHOR_VERIFY,        PRIV_USER,      Storlead_AuthorVerify,     0xff,  0xAAAA  ,0xFFFF},
     { CMD_GET_SENSOR_HISTORY,   PRIV_USER,      Storlead_GetSensorHistory,     0xff,  0xAAAA  ,0xFFFF},
     { CMD_GET_FAN_INFO,         PRIV_USER,      Storlead_GetFanInfo,         0xff,  0xAAAA  ,0xFFFF},
+    { CMD_SET_FAN_INFO,         PRIV_USER,      Storlead_SetFanInfo,         0xff,  0xAAAA  ,0xFFFF},
     { CMD_GET_ALLBLADE_INFO,        PRIV_USER,      Storlead_getAllBladeStatus,         0xff,  0xAAAA  ,0xFFFF},
-    //{ CMD_SET_MANAGE_FN,         PRIV_USER,      Storlead_SetBladeManageFn,         0xff,  0xAAAA  ,0xFFFF},     { CMD_SET_FAN_INFO,         PRIV_USER,      Storlead_SetFanInfo,         0xff,  0xAAAA  ,0xFFFF},
-    //{ CMD_GET_MANAGE_FN,         PRIV_USER,      Storlead_GetBladeManageFn,         0xff,  0xAAAA  ,0xFFFF},
-    { CMD_GET_CHASSIS_INFO,      PRIV_USER,      Storlead_GetChassisInfo,         0xff,  0xAAAA  ,0xFFFF},
     { CMD_RESTORE_FACTORY_SET,      PRIV_USER,      Storlead_RestoreFactorSettings,         0xff,  0xAAAA  ,0xFFFF},
     { CMD_GET_LAN_INFO,      PRIV_USER,      Storlead_GetLanInfo,         0xff,  0xAAAA  ,0xFFFF},
     { CMD_SET_LAN_INFO,      PRIV_USER,      Storlead_SetLanInfo,         0xff,  0xAAAA  ,0xFFFF},

+ 0 - 74
app/bmc/msghndlr/Storlead/Storlead.c

@@ -272,60 +272,6 @@ int  Storlead_GetSensorInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes)
     return sizeof(StorleadGetSensorInfoRes_T);
 }
 
-
-/*
-*@fn AMIGetSELEntires
-*@param This function retrieves the SEL entries
-*@return Returns CC_NORMAL
-*/
-#define MAX_FULL_SEL_ENTRIES 900    //18*50=900, 50个SEL Entry, 每个18字节
-
-int Storlead_GetSELEntires(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
-{
-    // AMIGetSELEntriesReq_T *pAMIGetSelEntriesReq = (AMIGetSELEntriesReq_T *)pReq;
-    // AMIGetSELEntriesRes_T *pAMIGetSelEntiresRes = (AMIGetSELEntriesRes_T *)pRes;
-    // SELRepository_T *m_sel = NULL;
-    // uint16_t NumRecords = 0;
-
-    
-    //  m_sel = (SELRepository_T*)g_BMCInfo.pSEL;
-    //  NumRecords = m_sel->NumRecords;
-
-    // if(((NumRecords - pAMIGetSelEntriesReq->Noofentretrieved) * sizeof(SELRec_T)) < MAX_FULL_SEL_ENTRIES)
-    // {
-    //     pAMIGetSelEntiresRes->Status = FULL_SEL_ENTRIES;
-    //     pAMIGetSelEntiresRes->Noofentries = NumRecords - pAMIGetSelEntriesReq->Noofentretrieved;
-    // }
-    // else if(NumRecords == SEL_EMPTY_REPOSITORY)
-    // {
-    //     pAMIGetSelEntiresRes->CompletionCode = OEMCC_SEL_EMPTY_REPOSITORY;
-    //     return sizeof(*pRes);
-    // }
-    // else if (NumRecords < pAMIGetSelEntriesReq->Noofentretrieved)
-    // {
-    //     pAMIGetSelEntiresRes->CompletionCode = OEMCC_SEL_CLEARED;
-    //     return sizeof(*pRes);
-    // }
-    // else
-    // {
-    //     pAMIGetSelEntiresRes->Status = PARTIAL_SEL_ENTRIES;
-    //     pAMIGetSelEntiresRes->Noofentries = ((MAX_FULL_SEL_ENTRIES - sizeof(AMIGetSELEntriesRes_T))/sizeof(SELRec_T));
-    // }
-
-
-   
-    // memcpy((uint8_t*)(pAMIGetSelEntiresRes + 1),(uint8_t*)&m_sel->SELRecord[pAMIGetSelEntriesReq->Noofentretrieved],
-    //           sizeof(SELRec_T)*pAMIGetSelEntiresRes->Noofentries);
-  
-
-    // pAMIGetSelEntiresRes->LastRecID = m_sel->LastRecID;
-
-    // pAMIGetSelEntiresRes->CompletionCode = CC_NORMAL;
-
-    // return sizeof(AMIGetSELEntriesRes_T) + (sizeof(SELRec_T) * pAMIGetSelEntiresRes->Noofentries);
-    return 1;
-}
-
 int Storlead_AuthorVerify(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 {
     AuthorVerify_T *pAuthorVerify = (AuthorVerify_T *)pReq;
@@ -451,7 +397,6 @@ int Storlead_SetFanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 int Storlead_getAllBladeStatus(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 {
     int i, index;
-    uint8_t mReq[100] = {0};
     MsgPkt_T    ReqPkt;
     MsgPkt_T    ResPkt;
     pRes[0] = CC_NORMAL;
@@ -542,25 +487,6 @@ int Storlead_getAllBladeStatus(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
     return 1+(BLADE_NUMBERS*sizeof(BladeStatus_T));
 }
 
-int Storlead_GetChassisInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
-{
-    /*
-    typedef struct{
-    uint8_t slotNum; //total slot numbers of chassis.
-    uint8_t supportChassisManageFn;
-    uint8_t chassisManageFnEnable;
-    uint8_t curIndex;
-} OemChassisInfo_T;
-*/
-    pRes[0] = CC_NORMAL;
-    pRes[1] = BLADE_NUMBERS;
-    pRes[2] = g_BMCInfo.isChMC;
-    pRes[3] = 0;//g_BMCInfo.BladeManageEn;  //机箱管理使能,该字段废弃了。
-    pRes[4] = g_BMCInfo.IndexInChassis;
-    return 5;
-}
-
-
 int Storlead_RestoreFactorSettings(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes)
 {
     int i;

+ 0 - 4
app/bmc/msghndlr/Storlead/Storlead.h

@@ -5,15 +5,11 @@
 
 int  Storlead_GetSysInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes);
 int  Storlead_GetSensorInfo(uint8_t* pReq, uint8_t ReqLen,  uint8_t* pRes);
-int  Storlead_GetSELEntires(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
 int Storlead_AuthorVerify(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
 int Storlead_GetSensorHistory(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
 int Storlead_GetFanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
 int Storlead_SetFanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
 int Storlead_getAllBladeStatus(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
-//int Storlead_SetBladeManageFn(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
-//int Storlead_GetBladeManageFn(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
-int Storlead_GetChassisInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
 int Storlead_RestoreFactorSettings(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
 int Storlead_GetLanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);
 int Storlead_SetLanInfo(uint8_t *pReq, uint8_t ReqLen, uint8_t *pRes);

+ 0 - 4
app/bmc/msghndlr/cmdselect.c

@@ -800,15 +800,11 @@ const NetFnCmds_T g_Storlead [] =
 	/*------------------------- IPM Device Commands --------------------------------------*/
 	{ CMD_GET_SYS_INFO          ,ENABLED},
 	{ CMD_GET_SENSOR_INFO          ,ENABLED},
-	{ CMD_GET_SEL_ENTIRES          ,ENABLED},
 	{ CMD_AUTHOR_VERIFY          ,ENABLED},
 	{ CMD_GET_SENSOR_HISTORY          ,ENABLED},	
 	{ CMD_GET_FAN_INFO          ,ENABLED},	
 	{ CMD_SET_FAN_INFO          ,ENABLED},	
 	{ CMD_GET_ALLBLADE_INFO          ,ENABLED},	
-//	{ CMD_SET_MANAGE_FN          ,ENABLED},	
-//	{ CMD_GET_MANAGE_FN          ,ENABLED},	
-	{ CMD_GET_CHASSIS_INFO          ,ENABLED},	
 	{ CMD_RESTORE_FACTORY_SET          ,ENABLED},	
 	{ CMD_GET_LAN_INFO          ,ENABLED},	
 	{ CMD_SET_LAN_INFO          ,ENABLED},	

+ 3 - 3
app/bmc/uds/UDSIfc.c

@@ -298,14 +298,14 @@ int ReadUDSData(MsgPkt_T *MsgPkt,int Socket )
 
     while (RecvdLen < sizeof(IPMIUDSMsg_T))
     {
-        Len = recv (Socket, &pData[RecvdLen],sizeof(IPMIUDSMsg_T),0);
+        Len = recv (Socket, &pData[RecvdLen],MSG_PAYLOAD_SIZE,0);
         if (Len <= 0)
         {
             return UDS_FAILURE;
         }
         
         // int i;
-        // printf("---> server recv1 %#x: ", Len);
+        // printf("---> server recv1 %d: ", Len);
         // for(i=0;i<Len;i++)
         //     printf("%#x ", pData[RecvdLen+i]);
         // printf("\n");
@@ -398,7 +398,7 @@ static int ProcessUDSReq(MsgPkt_T *pReq )
 int SendUDSPkt (MsgPkt_T *pRes)
 {
     // int i;
-    // printf("---> server Send size: %#x, socket: %d: ", pRes->Size, pRes->Socket);
+    // printf("---> server Send size: %d: ", pRes->Size);
     // for(i=0;i<pRes->Size;i++)
     //     printf("%#x ", pRes->Data[i]);
     // printf("\n");

+ 2 - 2
app/common_include/com_IPMIDefs.h

@@ -98,8 +98,8 @@
 #define UDS_PARAM_FAILURE -2
 #define UDS_SOCKET_QUE_LEN  1024
 #define MAX_UDS_BUFFER_SIZE 1024
-#define	MAX_REQUEST_SIZE		1024
-#define	MAX_RESPONSE_SIZE		1024
+#define	MAX_REQUEST_SIZE		512
+#define	MAX_RESPONSE_SIZE		512
 
 
 #define WAIT_NONE       0

+ 0 - 4
app/common_include/com_IPMI_Storlead.h

@@ -3,15 +3,11 @@
 
 #define CMD_GET_SYS_INFO   		0x0
 #define CMD_GET_SENSOR_INFO   	0x1
-#define CMD_GET_SEL_ENTIRES		0x2
 #define CMD_AUTHOR_VERIFY 		0x3
 #define CMD_GET_SENSOR_HISTORY  0x4
 #define CMD_GET_FAN_INFO		0x5
 #define CMD_SET_FAN_INFO		0x6
 #define CMD_GET_ALLBLADE_INFO	0x7
-//#define CMD_SET_MANAGE_FN		0x8
-//#define CMD_GET_MANAGE_FN		0x9
-#define CMD_GET_CHASSIS_INFO	0xA
 #define CMD_RESTORE_FACTORY_SET 0xB
 #define CMD_GET_LAN_INFO		0xC
 #define CMD_SET_LAN_INFO		0xD

+ 0 - 5
app/goahead-3.6.5/src/goahead.c

@@ -179,14 +179,9 @@ websDefineAction("buy", buy);
 //dashboard
 websDefineAction("getDeviceInfo", getDeviceInfo);
 websDefineAction("getSysInfo", getSysInfo);
-websDefineAction("getCardInfo", getCardInfo);
 websDefineAction("getSensorInfo", getSensorInfo);
-websDefineAction("getChassisInfo", getChassisInfo);
-websDefineAction("getBladeManage", getBladeManage);
-websDefineAction("setBladeManage", setBladeManage);
 websDefineAction("getAllBladeInfo", getAllBladeInfo);
 
-
 //remote control
 websDefineAction("chassisPwrCtrl", chassisPwrCtrl);
 websDefineAction("getChassisStatus", getChassisStatus);

+ 0 - 10
app/goahead-3.6.5/src/libipmi/inc/libipmi_StorDevice.h

@@ -155,16 +155,6 @@ uint8_t libipmi_GetBits(uint8_t orig, uint8_t startbit, uint8_t endbit);
 				FRUWriteRes_T* pFRUWriteResData,
 				int timeout);
 
-  // uint16_t LIBIPMI_HL_GetAllFRUDevices(IPMI20_UDS_SESSION_T *pUDSSession,
-		// 		uint8_t *pFRUIDs,
-		// 		uint8_t *pFRUNames,
-		// 		uint8_t *nFRUs,
-		// 		int timeout);
-
-  uint16_t Storlead_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
-	SELEventRecordWithSensorName_T *pSELEntriesBuffer,
-	int timeout);
-
   uint16_t IPMICMD_ClearSEL(IPMI20_UDS_SESSION_T *pUDSSession,
 				int timeout);
 

+ 1 - 1
app/goahead-3.6.5/src/libipmi/inc/libipmi_storlead_OEM.h

@@ -101,7 +101,7 @@ uint16_t IPMC_SetFanInfo( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, u
 uint16_t LIBIPMI_HL_GetSysInfo( IPMI20_UDS_SESSION_T *pUDSSession, SysInfo_T *pSysInfo, int timeout);
 uint16_t IPMC_GetSysInfo( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, SysInfo_T *pSysInfo, int timeout);
 uint16_t LIBIPMI_HL_GetSensorHistory( IPMI20_UDS_SESSION_T *pUDSSession, sensor_history_st *pSensorHistory_st, int card_index, int sensor_number, int IPMB_ADDR);
-int 	 LIBIPMI_HL_GetAllBladeStatus(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t chassisManageEn, BladeStatus_T* pBladeStatus, int timeout);
+int 	 LIBIPMI_HL_GetAllBladeStatus(IPMI20_UDS_SESSION_T *pUDSSession, BladeStatus_T* pBladeStatus, int timeout);
 int LIBIPMI_HL_GetFanInfo(IPMI20_UDS_SESSION_T *pUDSSession, FanInfo_T* pFanInfo, int timeout);
 int IPMC_GetFanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, FanInfo_T* pFanInfo, int timeout);
 uint16_t Storlead_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,

+ 0 - 268
app/goahead-3.6.5/src/libipmi/src/libipmi_StorDevice.c

@@ -696,274 +696,6 @@ uint16_t LIBIPMI_HL_GetSensorName(IPMI20_UDS_SESSION_T *pUDSSession,
 	return wRet;
 }
 
-/*this function wants to be nice to all nice people in the world who display
-sensor information. Instead of letting them go nuts getting all sel entires first
-an then looping thru all sel entires to go get all the sensor names and then each time to
-get a sensor name read SDR
-it just does that for them
-GetAllSelEntires
-Also GetAllSDR stuff once
-then loop and fill it all up internally*/
-uint16_t Storlead_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
-					SELEventRecordWithSensorName_T *pSELEntriesBuffer,
-					int timeout)
-{
-	uint16_t wRet = 0;
-	SDRRepositoryAllocInfo_T SDRAllocationInfo;
-	SDRRepositoryInfo_T SDRReposInfo;
-	int MaxSDRLen = 0;
-	int i,SDRCount = 0;
-	uint8_t *pSDRBuff = NULL;
-	SDRHeader *pSDRHeader = NULL;
-	uint8_t *pSDRStart = NULL;
-	uint32_t nNumSelEntries = 0;
-	int q = 0;
-
-	
-	/***********************************Get all Sel Entries now*********************************************/
-	/* We want to read full records */
-	//DataLen = sizeof(GetSELRes_T) + sizeof(SELEventRecord_T);
-
-	wRet = Storlead_AMIGetSELEntires(pUDSSession, IpmbAddr, pSELEntriesBuffer,&nNumSelEntries,timeout);
-	if(wRet != LIBIPMI_E_SUCCESS)
-	{
-		printf("LIBIPMI_HL_AMIGetSELEntires : Error getting SEL Entries \n");
-		return wRet;
-	}
-
-	
-	/*************************************Get The SDR once so that we can get sensor names*******************/
-	/* Get max buffer size to be allocated to read all SDRs in the system */
-	if(IpmbAddr == 0x20)
-	{
-		wRet = IPMICMD_GetSDRRepositoryAllocInfo(pUDSSession, &SDRAllocationInfo, timeout);
-	}
-	else
-	{
-		wRet = IPMC_GetSDRRepositoryAllocInfo(pUDSSession, IpmbAddr, &SDRAllocationInfo, timeout);	
-	}
-	if( wRet != 0 )
-	{
-		printf("Error getting SDR Repository Allocation Info\n");
-		return wRet;
-	}
-	printf("---> NumAllocUnits: %d, AllocUnitSize: %d, NumFreeAllocUnits: %d, LargestFreeBlock: %d, MaxRecSize: %d\n", \
-		SDRAllocationInfo.NumAllocUnits, SDRAllocationInfo.AllocUnitSize, SDRAllocationInfo.NumFreeAllocUnits, \
-		SDRAllocationInfo.LargestFreeBlock, SDRAllocationInfo.MaxRecSize);
-
-	/* Get repository information */
-	if(IpmbAddr == 0x20)
-	{
-		wRet = IPMICMD_GetSDRRepositoryInfo(pUDSSession, &SDRReposInfo,timeout);
-	}
-	else
-	{
-		wRet = IPMC_GetSDRRepositoryInfo(pUDSSession, IpmbAddr, &SDRReposInfo,timeout);	
-	}
-	if( wRet != 0 )
-	{
-		printf("Error getting SDR Repository Info\n");
-		return wRet;
-	}
-
-	/* Determine max SDR entry length */
-	MaxSDRLen = SDRAllocationInfo.MaxRecSize *  ( SDRAllocationInfo.AllocUnitSize );
-
-	/* Determine total number of SDRs stored */
-	SDRCount =  ( SDRReposInfo.RecCt );
-	printf("---> SDRCount: %d, MaxSDRLen: %d\n", SDRCount, MaxSDRLen);
-
-	/* Allocate the buffer */
-	pSDRBuff = (uint8_t *) walloc(MaxSDRLen * SDRCount);
-	if(!pSDRBuff)
-	{
-		printf("Error allocating memopry for SDRs in GetAllEventsWithSensorNames\n");
-		wRet = STATUS_CODE(IPMI_ERROR_FLAG,CC_OUT_OF_SPACE);
-		return wRet;
-	}
-	pSDRStart = pSDRBuff;
-
-	/* Call the function to read all the SDRs into this buffer */
-	wRet = Storlead_GetAllSDRs(pUDSSession, IpmbAddr, 
-                                     pSDRBuff,(MaxSDRLen * SDRCount),
-                                     timeout*4);
-
-	/*************************************Get The SDR once so that we can get sensor names*******************/
-	/******************Now parse through sensor headers and get names corresponding to each event************/
-	for(q=0;q<nNumSelEntries;q++)
-	{
-
-		strcpy((char*)pSELEntriesBuffer[q].SensorName,(char*)"Unknown");
-
-		pSDRBuff = pSDRStart;
-		for( i = 0; i < SDRCount; i++)
-		{
-			pSDRHeader = (SDRHeader *) pSDRBuff;
-			if((pSDRHeader->RecordType >= 0x01) && (pSDRHeader->RecordType <= 0x03))
-			{
-				/* Compare SlaveAdd and LUNid fields */
-				uint8_t *pTmp = pSDRBuff + sizeof(SDRHeader);
-				uint8_t len = 0;
-
-
-
-				if((pSELEntriesBuffer[q].EventRecord.EvtRecord.GenID[0] == *pTmp) && (pSELEntriesBuffer[q].EventRecord.EvtRecord.GenID[1] == *(pTmp+1)))
-				{
-
-					/* Now compare the sensor number */
-					if(pSELEntriesBuffer[q].EventRecord.EvtRecord.SensorNum == *(pTmp+2))
-					{
-						/* Get the Name and return */
-						if(pSDRHeader->RecordType == 0x01)
-							pTmp = pSDRBuff + sizeof(SDRHeader) + 42;
-						else if(pSDRHeader->RecordType == 0x02)
-							pTmp = pSDRBuff + sizeof(SDRHeader) + 26;
-						else
-							pTmp = pSDRBuff + sizeof(SDRHeader) + 11;
-
-						len = GetBits(*pTmp,5,0);
-						if(len)
-						{
-							pTmp++;
-
-							memcpy(pSELEntriesBuffer[q].SensorName,pTmp,len);
-							pSELEntriesBuffer[q].SensorName[len] = 0;
-
-						}
-						else
-							strcpy((char*)pSELEntriesBuffer[q].SensorName,(char*)"Unknown");
-					}
-				}
-			}
-			pSDRBuff += MaxSDRLen;
-		}
-	}
-	wfree(pSDRStart);
-	return wRet;
-}
-
-uint16_t IPMC_GetAllSelEntriesWithSensorNames(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
-					SELEventRecordWithSensorName_T *pSELEntriesBuffer,
-					int timeout)
-{
-	uint16_t wRet = 0;
-	SDRRepositoryAllocInfo_T SDRAllocationInfo;
-	SDRRepositoryInfo_T SDRReposInfo;
-	int MaxSDRLen = 0;
-	int i,SDRCount = 0;
-	uint8_t *pSDRBuff = NULL;
-	SDRHeader *pSDRHeader = NULL;
-	uint8_t *pSDRStart = NULL;
-	uint32_t nNumSelEntries = 0;
-	int q = 0;
-
-	
-	/***********************************Get all Sel Entries now*********************************************/
-	/* We want to read full records */
-	//DataLen = sizeof(GetSELRes_T) + sizeof(SELEventRecord_T);
-
-	wRet = Storlead_AMIGetSELEntires(pUDSSession, 0x20, pSELEntriesBuffer,&nNumSelEntries,timeout);
-	if(wRet != LIBIPMI_E_SUCCESS)
-	{
-		printf("LIBIPMI_HL_AMIGetSELEntires : Error getting SEL Entries \n");
-		return wRet;
-	}
-
-	
-	/*************************************Get The SDR once so that we can get sensor names*******************/
-	/* Get max buffer size to be allocated to read all SDRs in the system */
-	wRet = IPMICMD_GetSDRRepositoryAllocInfo(pUDSSession, &SDRAllocationInfo, timeout);
-	if( wRet != 0 )
-	{
-		printf("Error getting SDR Repository Allocation Info\n");
-		return wRet;
-	}
-	printf("---> NumAllocUnits: %d, AllocUnitSize: %d, NumFreeAllocUnits: %d, LargestFreeBlock: %d, MaxRecSize: %d\n", \
-		SDRAllocationInfo.NumAllocUnits, SDRAllocationInfo.AllocUnitSize, SDRAllocationInfo.NumFreeAllocUnits, \
-		SDRAllocationInfo.LargestFreeBlock, SDRAllocationInfo.MaxRecSize);
-
-	/* Get repository information */
-	wRet = IPMICMD_GetSDRRepositoryInfo(pUDSSession, &SDRReposInfo,timeout);
-	if( wRet != 0 )
-	{
-		printf("Error getting SDR Repository Info\n");
-		return wRet;
-	}
-
-	/* Determine max SDR entry length */
-	MaxSDRLen = SDRAllocationInfo.MaxRecSize *  ( SDRAllocationInfo.AllocUnitSize );
-
-	/* Determine total number of SDRs stored */
-	SDRCount =  ( SDRReposInfo.RecCt );
-	printf("---> SDRCount: %d, MaxSDRLen: %d\n", SDRCount, MaxSDRLen);
-
-	/* Allocate the buffer */
-	pSDRBuff = (uint8_t *) walloc(MaxSDRLen * SDRCount);
-	if(!pSDRBuff)
-	{
-		printf("Error allocating memopry for SDRs in GetAllEventsWithSensorNames\n");
-		wRet = STATUS_CODE(IPMI_ERROR_FLAG,CC_OUT_OF_SPACE);
-		return wRet;
-	}
-	pSDRStart = pSDRBuff;
-
-	/* Call the function to read all the SDRs into this buffer */
-	wRet = Storlead_GetAllSDRs(pUDSSession, 0x20, 
-                                     pSDRBuff,(MaxSDRLen * SDRCount),
-                                     timeout*4);
-
-	/*************************************Get The SDR once so that we can get sensor names*******************/
-	/******************Now parse through sensor headers and get names corresponding to each event************/
-	for(q=0;q<nNumSelEntries;q++)
-	{
-
-		strcpy((char*)pSELEntriesBuffer[q].SensorName,(char*)"Unknown");
-
-		pSDRBuff = pSDRStart;
-		for( i = 0; i < SDRCount; i++)
-		{
-			pSDRHeader = (SDRHeader *) pSDRBuff;
-			if((pSDRHeader->RecordType >= 0x01) && (pSDRHeader->RecordType <= 0x03))
-			{
-				/* Compare SlaveAdd and LUNid fields */
-				uint8_t *pTmp = pSDRBuff + sizeof(SDRHeader);
-				uint8_t len = 0;
-
-
-
-				if((pSELEntriesBuffer[q].EventRecord.EvtRecord.GenID[0] == *pTmp) && (pSELEntriesBuffer[q].EventRecord.EvtRecord.GenID[1] == *(pTmp+1)))
-				{
-					/* Now compare the sensor number */
-					if(pSELEntriesBuffer[q].EventRecord.EvtRecord.SensorNum == *(pTmp+2))
-					{
-						/* Get the Name and return */
-						if(pSDRHeader->RecordType == 0x01)
-							pTmp = pSDRBuff + sizeof(SDRHeader) + 42;
-						else if(pSDRHeader->RecordType == 0x02)
-							pTmp = pSDRBuff + sizeof(SDRHeader) + 26;
-						else
-							pTmp = pSDRBuff + sizeof(SDRHeader) + 11;
-
-						len = GetBits(*pTmp,5,0);
-						if(len)
-						{
-							pTmp++;
-
-							memcpy(pSELEntriesBuffer[q].SensorName,pTmp,len);
-							pSELEntriesBuffer[q].SensorName[len] = 0;
-
-						}
-						else
-							strcpy((char*)pSELEntriesBuffer[q].SensorName,(char*)"Unknown");
-					}
-				}
-			}
-			pSDRBuff += MaxSDRLen;
-		}
-	}
-	wfree(pSDRStart);
-	return wRet;
-}
 /*****************************************************************************
 	Field Replacement Unit (FRU)
 ******************************************************************************/

+ 18 - 10
app/goahead-3.6.5/src/libipmi/src/libipmi_session.c

@@ -58,12 +58,13 @@ uint16_t LIBIPMI_CreateSession(IPMI20_UDS_SESSION_T *pUDSSession, int timeout)
     strcpy(client_addr.sun_path,UDS_SOCKET_PATH);
     int len = sizeof(client_addr.sun_family)+strlen(client_addr.sun_path);
 
-    printf("---> Create_IPMI20_UDS_Session %d\n", client_sock);
+    
     if ( connect (client_sock, (struct sockaddr *) &client_addr,len) < 0)
     {
         printf("LIBIPMI_UDS_SESSION.C: Unable to connect to Server:\n");
         return LIBIPMI_MEDIUM_E_CONNECT_FAILURE;
     }
+    printf("---> Create_IPMI20_UDS_Session %d\n", client_sock);
 
     pUDSSession->hUDSInfo.hSocket = client_sock;
     pUDSSession->hUDSInfo.byIsConnected = 1;
@@ -88,18 +89,13 @@ uint32_t FillUDSMessagePacket(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t *Buffer
 
     pUDSMsg->SessionID = pUDSSession->dwSessionID;
     pUDSMsg->ChannelNum = pUDSSession->byChannelNum;
-    //pUDSMsg->Privilege = pUDSSession->byRole;
-    pUDSMsg->IPMIMsgLen = sizeof(IPMIUDSMsg_T)+dwReqDataLen+1;
+    pUDSMsg->IPMIMsgLen = sizeof(IPMIUDSMsg_T)+dwReqDataLen;
     pUDSMsg->Cmd = byCommand;
     pUDSMsg->NetFnLUN = byNetFnLUN;
 
-    //memcpy(pUDSMsg->UserName, pUDSSession->szUName, MAX_USERNAME_LEN);
-    //memcpy(pUDSMsg->IPAddr, pUDSSession->abyIPAddr, IP6_ADDR_LEN);
-    //pUDSMsg->ProcessID = getpid();
-    //pUDSMsg->ThreadID = gettid();
     memcpy(pbyIPMIUDSData, pbyReqData, dwReqDataLen);
 
-    return ( sizeof(IPMIUDSMsg_T) + dwReqDataLen + 1);
+    return ( sizeof(IPMIUDSMsg_T) + dwReqDataLen);  //jimbo note 1
 }
 
 /*---------------------------------------------------------------------
@@ -129,6 +125,14 @@ uint16_t LIBIPMI_Send_RAW_IPMI2_0_Command(IPMI20_UDS_SESSION_T *pUDSSession,
        return -1;
     }
 
+    
+    // printf("UDS send %d: ", retlen);
+    // for(i=0;i<retlen;i++)
+    // {
+    //     printf("%02x ", ((uint8_t*)pbyIPMIUDSMsgReq)[i]);
+    // }
+    // printf("\n");
+
     send (pUDSSession->hUDSInfo.hSocket,pbyIPMIUDSMsgReq,retlen, MSG_NOSIGNAL);
 
     if((byNetFnLUN == NETFNLUN_IPMI_APP) && (byCommand == CMD_SEND_MSG))
@@ -163,6 +167,10 @@ uint16_t LIBIPMI_Send_RAW_IPMI2_0_Command(IPMI20_UDS_SESSION_T *pUDSSession,
             //     printf("%#02x ", pbyIPMIUDSResData[i]);
             // printf("\n");
         }
+        if(pbyIPMIUDSResData[sizeof(IPMIUDSMsg_T)] != 0)    //ccode != 0
+        {
+            return -1;
+        }
     }
 
     Timeout.tv_sec  =   timeout; 
@@ -192,7 +200,7 @@ uint16_t LIBIPMI_Send_RAW_IPMI2_0_Command(IPMI20_UDS_SESSION_T *pUDSSession,
         byretval = recv(pUDSSession->hUDSInfo.hSocket,pbyIPMIUDSResData,MAX_RESPONSE_SIZE,0);
         // printf("UDS Recv2 %d: ", byretval);
         // for(i=0;i<byretval;i++)
-        //     printf("%#02x ", pbyIPMIUDSResData[i]);
+        //     printf("%02x ", pbyIPMIUDSResData[i]);
         // printf("\n");
     }
 
@@ -200,7 +208,7 @@ uint16_t LIBIPMI_Send_RAW_IPMI2_0_Command(IPMI20_UDS_SESSION_T *pUDSSession,
     {
         IPMIUDSMsg_T *pIPMIUDSMsg = (IPMIUDSMsg_T *)&pbyIPMIUDSResData[0];   
         //TODO:UDS的数据结构在最后多了一个0,找机会要给他去掉。     
-        *pdwResDataLen = pIPMIUDSMsg->IPMIMsgLen-sizeof(IPMIUDSMsg_T) - 2;  //remove header, 最后多出来的一个0,and checksum
+        *pdwResDataLen = pIPMIUDSMsg->IPMIMsgLen-sizeof(IPMIUDSMsg_T);  //remove header, 最后多出来的一个0,and checksum
         memcpy(pszResData,&pbyIPMIUDSResData[sizeof(IPMIUDSMsg_T)],*pdwResDataLen);
     }
     else

+ 2 - 236
app/goahead-3.6.5/src/libipmi/src/libipmi_storlead_OEM.c

@@ -199,41 +199,14 @@ uint16_t IPMC_GetSysInfo( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, S
 	return 0;
 }
 
-// /************************************************* new add **********************************************************************/
-int LIBIPMI_HL_GetChassisInfo(IPMI20_UDS_SESSION_T *pUDSSession, OemChassisInfo_T* pChassisInfo, int timeout)
-{
-	uint8_t pRes[10];
-	int wRet = 0;
-	uint32_t	dwResLen;
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-							NETFNLUN_IPMI_STORLEAD, CMD_GET_CHASSIS_INFO,
-							NULL, 0,
-							(uint8_t*)pRes,  &dwResLen,
-							timeout);
-	if(( wRet != 0 ) || (pRes[0] != 0))
-	{
-		printf("Error getting Blade Status Info\n");
-		memset(pChassisInfo, 0, sizeof(OemChassisInfo_T));
-		pChassisInfo->slotNum = BLADE_NUMBERS;
-		pChassisInfo->curIndex = 0;
-		return -1;
-	}
-		
-	pChassisInfo->slotNum = pRes[1];
-	pChassisInfo->isChMC = pRes[2];
-	pChassisInfo->chassisManageFnEnable = pRes[3];	//该字段废弃。
-	pChassisInfo->curIndex = pRes[4];
-	return 0;
-}
-
-int LIBIPMI_HL_GetAllBladeStatus(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t chassisManageEn, BladeStatus_T *BladeStatus, int timeout)
+int LIBIPMI_HL_GetAllBladeStatus(IPMI20_UDS_SESSION_T *pUDSSession, BladeStatus_T *BladeStatus, int timeout)
 {
 	int wRet = 0;
 	uint32_t	dwResLen;
 	uint8_t pRes[BLADE_NUMBERS*sizeof(BladeStatus_T)+1];
 	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
 							NETFNLUN_IPMI_STORLEAD, CMD_GET_ALLBLADE_INFO,
-							(uint8_t*)&chassisManageEn, 1,
+							NULL, 0,
 							(uint8_t*)pRes,  &dwResLen,
 							timeout);
 	if(( wRet != 0 ) || (pRes[0] != 0))
@@ -301,213 +274,6 @@ int IPMC_GetFanInfo(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr, FanInfo
 	return 0;
 }
 
-/*
-*@fn IPMICMD_AMIGetSELEntires
-*@brief
-*@param pSession - IPMI Session Handle
-*@param pAMIGetSelEntriesReq - Pointer to the request of AMI Get SEL Entries command
-*@param pAMIGetSelEntiresRes - Pointer to the response of AMI Get SEL Entries command
-*@param timeout - Timeout Value
-**/
-uint16_t IPMICMD_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession,AMIGetSELEntriesReq_T *pAMIGetSelEntriesReq,
-											   AMIGetSELEntriesRes_T *pAMIGetSelEntiresRes,int timeout)
-{
-	uint16_t wRet;
-	uint32_t dwResLen;
-	dwResLen = sizeof(AMIGetSELEntriesRes_T);
-	
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,
-						NETFNLUN_IPMI_STORLEAD, CMD_GET_SEL_ENTIRES,
-						(uint8_t *)pAMIGetSelEntriesReq, sizeof(AMIGetSELEntriesReq_T),
-						(uint8_t*)pAMIGetSelEntiresRes, &dwResLen,
-						timeout);
-	
-	return (wRet);
-}
-
-uint16_t IPMC_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession,  uint8_t IpmbAddr, AMIGetSELEntriesReq_T *pAMIGetSelEntriesReq,
-											   AMIGetSELEntriesRes_T *pAMIGetSelEntiresRes,int timeout)
-{
-	int wRet = 0;
-	uint32_t	dwResLen;
-	uint8_t 	Req[50] = {0};
-	uint8_t		Res[50] = {0};
-
-	//first do a SEL reservation
-	Req[0] = 0x40;	//Track | channel 0
-	Req[1] = IpmbAddr;
-	Req[2] = NETFNLUN_IPMI_STORLEAD;
-	Req[3] = 0x100 - (Req[1] + Req[2])&0xff;	//checksum1
-	Req[4] = 0x20;
-	Req[5] = 0x10;
-	Req[6] = CMD_GET_SEL_ENTIRES;	
-	Req[7] = pAMIGetSelEntriesReq->Noofentretrieved&0xff;
-	Req[8] = (pAMIGetSelEntriesReq->Noofentretrieved>>8)&0xff;
-	Req[9] = (pAMIGetSelEntriesReq->Noofentretrieved>>16)&0xff;
-	Req[10] = (pAMIGetSelEntriesReq->Noofentretrieved>>24)&0xff;
-	Req[11] = 0x100 - (Req[4] + Req[5] + Req[6] + Req[7] + Req[8] + Req[9] + Req[10])&0xff;
-
-	wRet = LIBIPMI_Send_RAW_IPMI2_0_Command(pUDSSession,  
-							NETFNLUN_IPMI_APP, CMD_SEND_MSG,
-							Req, 12,
-							Res,  &dwResLen,
-							timeout);
-
-	if((wRet != 0) || (Res[6] != 0))
-	{
-		printf("get sel entires failed!\n");
-		memset(pAMIGetSelEntiresRes, 0, sizeof(AMIGetSELEntriesRes_T));
-		return -1;
-	}
-
-	memcpy(pAMIGetSelEntiresRes, &Res[6], sizeof(AMIGetSELEntriesRes_T));
-	return (wRet);
-}
-
-
-/*
-*@fn LIBIPMI_HL_AMIGetSELEntires
-*@brief High Level command to retrieve the total SEL Entries
-*@param pSession - IPMI Session Handle
-*@param pSELEntriesBuffer - Pointer to hold the retrieved SEL Entries
-*@param nNumSelEntries - Pointer which hold the no. of SEL Entries retrieved
-*@param timeout - Timeout Value
-*@return Returns LIBIPMI_E_SUCCESS on success
-*@return Returns proper completion code on error
-**/
-uint16_t Storlead_AMIGetSELEntires(IPMI20_UDS_SESSION_T *pUDSSession, uint8_t IpmbAddr,
-	SELEventRecordWithSensorName_T *pSELEntriesBuffer,uint32_t *nNumSelEntries,int timeout)
-{
-	AMIGetSELEntriesReq_T pAMIGetSelEntriesReq = {0};
-	AMIGetSELEntriesRes_T *pAMIGetSelEntiresRes;
-	SELEventRecordWithSensorName_T *CircSELEntries;
-	uint8_t *SELEntries;
-	uint16_t wRet = 0;
-	int j=0;
-	uint16_t i=0,recindex=0;
-	uint16_t LastRecID = 0xFFFF,MaxSELEntries=0;
-	uint32_t max_sel_len = MAX_SEL_RECORD*sizeof(SELRec_T) + sizeof(AMIGetSELEntriesRes_T) + 256;//margin
-	
-	SELEntries = (uint8_t *)walloc(max_sel_len);
-	if(SELEntries == NULL)
-	{
-		printf("Memory allocation error in LIBIPMI_HL_AMIGetSELEntires \n");
-		wRet = 0xFF;
-		return wRet;
-	}
-	
-	memset(SELEntries,0,max_sel_len);
-	pAMIGetSelEntiresRes = (AMIGetSELEntriesRes_T *)SELEntries;
-	
-	do
-	{
-		if(IpmbAddr == 0x20)
-		{
-			wRet = IPMICMD_AMIGetSELEntires(pUDSSession,&pAMIGetSelEntriesReq,(AMIGetSELEntriesRes_T *)SELEntries,timeout);
-		}
-		else
-		{
-			wRet = IPMC_AMIGetSELEntires(pUDSSession, IpmbAddr, &pAMIGetSelEntriesReq,(AMIGetSELEntriesRes_T *)SELEntries,timeout);
-		}
-		if(wRet == LIBIPMI_E_SUCCESS)
-		{
-			for(i = 0; i < pAMIGetSelEntiresRes->Noofentries; i++)
-			{
-				memcpy((uint8_t *)&pSELEntriesBuffer[i+*nNumSelEntries].EventRecord,&(SELEntries[sizeof(AMIGetSELEntriesRes_T) + (i * sizeof(SELRec_T))]),
-							   sizeof(SELRec_T));
-			}
-	
-			if(pAMIGetSelEntriesReq.Noofentretrieved == 0x00)
-			{
-				LastRecID = pAMIGetSelEntiresRes->LastRecID;
-			}
-	
-			if(pAMIGetSelEntiresRes->Status == FULL_SEL_ENTRIES)
-			{
-				*nNumSelEntries += pAMIGetSelEntiresRes->Noofentries;
-				break;
-			}
-			else
-			{
-				*nNumSelEntries += pAMIGetSelEntiresRes->Noofentries;
-				pAMIGetSelEntriesReq.Noofentretrieved = *nNumSelEntries;
-				memset(SELEntries,0,max_sel_len);
-				continue;
-			}
-		}
-		else if((wRet & 0xFF) == LIBIPMI_E_SEL_CLEARED)
-		{
-			memset(SELEntries,0,max_sel_len);
-			memset((uint8_t*)&pSELEntriesBuffer[0],0,sizeof(SELEventRecordWithSensorName_T) * *nNumSelEntries);
-			*nNumSelEntries =  pAMIGetSelEntriesReq.Noofentretrieved = 0;
-			continue;
-		}
-		else if((wRet & 0xFF)  == LIBIPMI_E_SEL_EMPTY)
-		{
-			/* Returning LIBIPMI_E_SUCCESS when sel repo is empty as
-				 per WebUI expectations. Will be removed once changes are made in WebUI*/
-			wRet = LIBIPMI_E_SUCCESS;
-			return wRet;
-		}
-		else
-		{
-			break;
-		}
-	}while(1);
-	
-	wfree(SELEntries);
-	
-	if(wRet == LIBIPMI_E_SUCCESS)
-	{
-		if(LastRecID != 0xFFFF)
-		{
-			if(LastRecID > MAX_SEL_RECORD)
-			{
-				for(i = 0; i < *nNumSelEntries; i++)
-				{
-					if(pSELEntriesBuffer[i].EventRecord.EvtRecord.hdr.ID == LastRecID)
-					{
-						recindex = i;
-						break;
-					}
-				}
-
-				/* Last Record is not found if reached till end of SEL Entries*/
-				if(i == *nNumSelEntries)
-				{
-					wRet = 0xFF;
-					return wRet;
-				}
-
-				/*SEL Records added lastely will be displayed first */
-				CircSELEntries = (SELEventRecordWithSensorName_T *)walloc (sizeof(SELEventRecordWithSensorName_T) * (*nNumSelEntries));
-				if(CircSELEntries != NULL)
-				{
-					memset(CircSELEntries,0,sizeof(SELEventRecordWithSensorName_T) * (*nNumSelEntries));
-					j = recindex; i = 0;
-					while(j >= 0)
-					{
-						memcpy((uint8_t *)&CircSELEntries[i],(uint8_t*)&pSELEntriesBuffer[j],sizeof(SELEventRecordWithSensorName_T));
-						j--;i++;
-					}
-
-					for(j = recindex + 1,i = 1; j < *nNumSelEntries; j++,i++)
-					{
-						memcpy((uint8_t*)&CircSELEntries[j],(uint8_t*)&pSELEntriesBuffer[*nNumSelEntries - i ],sizeof(SELEventRecordWithSensorName_T));
-					}
-
-					for(i = 0,j=1;i< *nNumSelEntries; i++,j++)
-					{
-						memcpy((uint8_t*)&pSELEntriesBuffer[i],(uint8_t*)&CircSELEntries[*nNumSelEntries - j],sizeof(SELEventRecordWithSensorName_T));
-					}
-					wfree(CircSELEntries);
-				}
-			}
-		}
-	}
-	return (wRet);
-}
-
 uint16_t IPMICMD_ResetBMC(IPMI20_UDS_SESSION_T *pUDSSession, int timeout)
 {
 	uint16_t wRet;

+ 3 - 0
app/goahead-3.6.5/src/runtime.c

@@ -1271,6 +1271,8 @@ PUBLIC int wfreeHandle(void *mapArg, int handle)
     ssize   *mp;
     int     len;
 
+
+    //printf("---> wfreeHandle handle = %d\n", handle);
     map = (void***) mapArg;
     assert(map);
     mp = &((*(ssize**)map)[-H_OFFSET]);
@@ -1299,6 +1301,7 @@ PUBLIC int wfreeHandle(void *mapArg, int handle)
             handle = len;
         }
     }
+
     return handle + 1;
 }
 

+ 9 - 4
app/goahead-3.6.5/src/socket.c

@@ -105,7 +105,7 @@ PUBLIC int socketListen(char *ip, int port, SocketAccept accept, int flags)
     if (port > SOCKET_PORT_MAX) {
         return -1;
     }
-    printf(">>>>>ip value is \n: %s", ip);
+    //printf(">>>>>ip value is \n: %s", ip);
     if ((sid = socketAlloc(ip, port, accept, flags)) < 0) {
         return -1;
     }
@@ -128,7 +128,7 @@ PUBLIC int socketListen(char *ip, int port, SocketAccept accept, int flags)
         socketFree(sid);
         return -1;
     }
-    printf("---> web socketListen.socket = %d\n", sp->sock);
+    //printf("---> web socketListen.socket = %d\n", sp->sock);
     socketHighestFd = max(socketHighestFd, sp->sock);
 
 #if ME_COMPILER_HAS_FCNTL
@@ -901,9 +901,12 @@ PUBLIC int socketAlloc(char *ip, int port, SocketAccept accept, int flags)
     WebsSocket    *sp;
     int         sid;
 
+
     if ((sid = wallocObject(&socketList, &socketMax, sizeof(WebsSocket))) < 0) {
         return -1;
     }
+
+    //printf("---> socketAlloc: sid = %d\n", sid);
     sp = socketList[sid];
     sp->sid = sid;
     sp->accept = accept;
@@ -943,8 +946,10 @@ PUBLIC void socketFree(int sid)
         if (shutdown(sp->sock, SHUT_RDWR) >= 0) {
             while (recv(sp->sock, buf, sizeof(buf), 0) > 0) {}
         }
-        printf("%s %d ---> closesocket %d\n", __FILE__, __LINE__, sp->sock);
+        
+        printf("---> closesocket header %d\n",sp->sock);
         closesocket(sp->sock);
+        printf("---> closesocket tail\n");
     }
     wfree(sp->ip);
     wfree(sp);
@@ -967,7 +972,7 @@ PUBLIC void socketFree(int sid)
  */
 WebsSocket *socketPtr(int sid)
 {
-    printf("?>>>>>>>>>>%d11\n", sid);
+    printf("---> socketPtr(): sid = %d, socketMax = %d\n", sid, socketMax);
     if (sid < 0 || sid >= socketMax || socketList[sid] == NULL) {
         assert(NULL);
         errno = EBADF;

+ 0 - 4
app/goahead-3.6.5/src/web_interface/inc/dashboard.h

@@ -7,15 +7,11 @@ void getDeviceInfo(Webs *wp);
 /*获取cpu信息*/
 void getSysInfo(Webs *wp);
 /*获取刀片信息*/
-void getCardInfo(Webs *wp);
 void getSensorInfo(Webs *wp);
 void actionTest(Webs *wp);
 void buy(Webs *wp);
 
-void getBladeManage(Webs *wp);
-void setBladeManage(Webs *wp);
 void getAllBladeInfo(Webs *wp);
-void getChassisInfo(Webs *wp);
 
 
 #endif /* __DASHBOARD_H__ */

+ 14 - 211
app/goahead-3.6.5/src/web_interface/src/dashboard.c

@@ -14,11 +14,9 @@
     废弃机箱管理是能按钮。由BMC程序里的g_BMCInfo.isChMC代替。ChMC默认就支持机箱管理,IPMC默认不支持。
     gChassisManageEn、setBladeManage、getBladeManage保留但是用不到。
 */
-uint8_t gIPMBAddr[BLADE_NUMBERS] = {0x20, 0x84, 0x86, 0x88, 0x8A, 0x8C, 0x8E, 0x90, 0x92, 0x94};
-uint8_t gChassisManageEn = 0;
+uint8_t gIPMBAddr[BLADE_NUMBERS] = {0x82, 0x84, 0x86, 0x88, 0x8A, 0x8C, 0x8E, 0x90, 0x92, 0x94};
 /*获取设备信息*/
 void getDeviceInfo(Webs *wp){
-    printf("--->getDeviceInfo  wp.index = %d\n", wp->index);
     uint16_t    wRet = LIBIPMI_E_SUCCESS;
     GetDevIDRes_T   DeviceID;
     struct ifreq ifreq;
@@ -45,7 +43,7 @@ void getDeviceInfo(Webs *wp){
         wRet = IPMICMD_GetDeviceID( &UDSSession, &DeviceID, DEFAULT_TIMEOUT);
         if (wRet == LIBIPMI_E_SUCCESS)
         {
-            sprintf(FwVersion, "%d.%d", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
+            sprintf(FwVersion, "%d.%02x", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
         }
         //get mac adn ip address
         if((sock=socket(AF_INET,SOCK_STREAM,0))<0)
@@ -93,7 +91,7 @@ void getDeviceInfo(Webs *wp){
         wRet = IPMC_GetDeviceID( &UDSSession, target_addr, &DeviceID, DEFAULT_TIMEOUT);
         if (wRet == LIBIPMI_E_SUCCESS)
         {
-            sprintf(FwVersion, "%d.%d", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
+            sprintf(FwVersion, "%d.%02x", DeviceID.FirmwareRevision1, DeviceID.FirmwareRevision2);
         }
     }
 
@@ -204,12 +202,6 @@ sys_info_end:
         cJSON_Delete(root);
 }
 
-
-/*获取刀片信息*/
-void getCardInfo(Webs *wp){
-
-}
-
 void getSensorInfo(Webs *wp){
     int         wRet;
     int         nSensors = 0;
@@ -242,7 +234,7 @@ void getSensorInfo(Webs *wp){
     //Create session
     LIBIPMI_CreateSession(&UDSSession, 10000);
      
-//    wp->index = TEST_INDEX;
+
     target_addr = gIPMBAddr[wp->index];
     if(target_addr == 0x20)
     {
@@ -446,24 +438,21 @@ void buy(Webs *wp)
 
 void actionTest(Webs *wp)
 {
-     char    *name, *age;
-    name = websGetVar(wp, "name", NULL);
-    age = websGetVar(wp, "age", NULL);
-    logmsg(2, "name value is : %s", name );
-     logmsg(2, "age value is : %s", age );
+    IPMI20_UDS_SESSION_T    UDSSession;
+     GetDevIDRes_T   DeviceID;
+    LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
+
+    IPMC_GetDeviceID( &UDSSession, 0x86, &DeviceID, DEFAULT_TIMEOUT);
+    LIBIPMI_CloseSession(&UDSSession ); 
+
     websSetStatus(wp, 200);
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp);
-   
-    websWrite(wp, "Name %s", name);
-    websWrite(wp, "age %s", age); 
+    websWrite(wp, "Every thing is ok");
     websFlush(wp, 0);
     websDone(wp);
 
-    if(name)
-        wfree(name);
-    if(age)
-        wfree(age);
+    printf("FirmwareRevision: %d.%d\n", DeviceID.FirmwareRevision1,DeviceID.FirmwareRevision2);
 
     
 }
@@ -476,7 +465,7 @@ void getAllBladeInfo(Webs *wp){
     //Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
-    wRet = LIBIPMI_HL_GetAllBladeStatus(&UDSSession, gChassisManageEn, pBladeStatus, DEFAULT_TIMEOUT);
+    wRet = LIBIPMI_HL_GetAllBladeStatus(&UDSSession, pBladeStatus, DEFAULT_TIMEOUT);
     if(wRet != 0)
     {
         printf("Get Blade status error!\n");
@@ -526,189 +515,3 @@ void getAllBladeInfo(Webs *wp){
 
 }
 
-// void getAllBladeInfo(Webs *wp){
-//     uint16_t    wRet = LIBIPMI_E_SUCCESS;
-    
-//     IPMI20_UDS_SESSION_T    UDSSession;
-//     BladeStatus_T   *pBladeStatus = walloc(BLADE_NUMBERS*sizeof(BladeStatus_T));
-//     //Create session
-//     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
-
-//     wRet = LIBIPMI_HL_GetAllBladeStatus(&UDSSession, gChassisManageEn, pBladeStatus, DEFAULT_TIMEOUT);
-//     if(wRet != 0)
-//     {
-//         printf("Get Blade status error!\n");
-//         websError(wp, 404, "Get Blade status error!");
-//         wfree(pBladeStatus);
-//         return;
-//     }
-//     //Close session
-//     LIBIPMI_CloseSession(&UDSSession );
-    
-//     char *pStr;
-//     cJSON * root =  cJSON_CreateObject();
-//     cJSON  *pJsonArry,*pJsonsub;
-//     pJsonArry=cJSON_CreateArray();   /*创建数组*/
-//     cJSON_AddItemToObject(root, "data", pJsonArry);//根节点下添加
-//     cJSON_AddStringToObject(root, "msg", "");
-//     cJSON_AddNumberToObject(root, "code", 200);
-
-//     int i;
-//     for(i=0;i<BLADE_NUMBERS;i++)
-//     {
-//         cJSON_AddItemToArray(pJsonArry,pJsonsub=cJSON_CreateObject()); /* 给创建的数组增加对对象*/
-//         cJSON_AddNumberToObject(pJsonsub, "present", pBladeStatus[i].present);  //0:不在位,1:在位
-//         cJSON_AddNumberToObject(pJsonsub, "status", pBladeStatus[i].healthStatus); //0:灰色, 1: 绿色 2:红色
-//         cJSON_AddNumberToObject(pJsonsub, "slot", pBladeStatus[i].slotID); 
-//         cJSON_AddNumberToObject(pJsonsub, "power", pBladeStatus[i].pwrStatus); 
-//         cJSON_AddStringToObject(pJsonsub, "name", pBladeStatus[i].bladeName); 
-//         cJSON_AddNumberToObject(pJsonsub, "isChMC", pBladeStatus[i].isChMC); 
-
-//         //将主模块的IPMB地址改成0x20
-//         if(pBladeStatus[i].isChMC)
-//         {
-//             gIPMBAddr[i] = 0x20;
-//             printf("Modify %d blade ipmb address to 0x20\n", i);
-//         }
-//     }
-  
-//     pStr = cJSON_PrintUnformatted(root);
-
-//     websSetStatus(wp, 200);
-//     websWriteHeaders(wp, -1, 0);
-//     websWriteEndHeaders(wp);
-//     websWrite(wp, "%s", pStr);
-//     websFlush(wp, 0);
-//     websDone(wp);
-//     printf("cJSON:%s\n", pStr);
-
-//     if(pStr)
-//         wfree(pStr);
-//     if(root)
-//         cJSON_Delete(root);
-//     if(pBladeStatus)
-//         wfree(pBladeStatus);
-
-// }
-
-//废弃
-void setBladeManage(Webs *wp){
-    char *strEnable = websGetVar(wp, "enable", NULL);
-
-    gChassisManageEn = atoi(strEnable);
-    
-    char *pStr;
-    cJSON * root =  cJSON_CreateObject();
-    cJSON * data =  cJSON_CreateObject();
-    cJSON_AddItemToObject(root, "data", data);//根节点下添加
-    cJSON_AddStringToObject(root, "msg", "");
-    cJSON_AddNumberToObject(root, "code", 200);
-    
-    pStr = cJSON_PrintUnformatted(root);
- 
-    websSetStatus(wp, 200);
-    websWriteHeaders(wp, -1, 0);
-    websWriteEndHeaders(wp);
-    websWrite(wp, "%s", pStr);
-    websFlush(wp, 0);
-    websDone(wp);
-    printf("cJSON:%s\n", pStr);
-
-    if(pStr)
-        wfree(pStr);
-    if(root)
-        cJSON_Delete(root);
-
-}
-
-//废弃
-void getBladeManage(Webs *wp){
-    char *pStr;
-    cJSON * root =  cJSON_CreateObject();
-    cJSON * data =  cJSON_CreateObject();
-    cJSON_AddItemToObject(root, "data", data);//根节点下添加
-    cJSON_AddStringToObject(root, "msg", "");
-    cJSON_AddNumberToObject(root, "code", 200);
-    cJSON_AddNumberToObject(data, "isEnable", gChassisManageEn);  //机箱管理功能是否已经打开    
-    
-    pStr = cJSON_PrintUnformatted(root);
-
-    websSetStatus(wp, 200);
-    websWriteHeaders(wp, -1, 0);
-    websWriteEndHeaders(wp);
-    websWrite(wp, "%s", pStr);
-    websFlush(wp, 0);
-    websDone(wp);
-    printf("cJSON:%s\n", pStr);
-
-    if(pStr)
-        wfree(pStr);
-    if(root)
-        cJSON_Delete(root);
-
-}
-
-
-void getChassisInfo(Webs *wp){
-    uint16_t    wRet = LIBIPMI_E_SUCCESS;
-    IPMI20_UDS_SESSION_T    UDSSession;
-    OemChassisInfo_T ChassisInfo;
-
-    //Create session
-    LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
-
-    wRet = LIBIPMI_HL_GetChassisInfo(&UDSSession, &ChassisInfo, DEFAULT_TIMEOUT);
-    if(wRet != 0)
-    {
-        websError(wp, 404, "Get Chassis Info Error!");
-        LIBIPMI_CloseSession(&UDSSession );
-        return;
-    }
-
-    //Close session
-    LIBIPMI_CloseSession(&UDSSession );
-
-    if(ChassisInfo.isChMC)
-    {
-        if(ChassisInfo.curIndex < BLADE_NUMBERS)
-        {
-            gIPMBAddr[ChassisInfo.curIndex] = 0x20;
-        }
-        else
-        {
-            printf("\n\n\nWarning: Invalid curIndex %d\n\n\n", ChassisInfo.curIndex);
-        }
-    }
-    else
-    {
-        gChassisManageEn = 0;
-    }
-
-
-    char *pStr;
-    cJSON * root =  cJSON_CreateObject();
-    cJSON * data =  cJSON_CreateObject();
-    cJSON_AddItemToObject(root, "data", data);//根节点下添加
-    cJSON_AddStringToObject(root, "msg", "");
-    cJSON_AddNumberToObject(root, "code", 200);
-
-    cJSON_AddNumberToObject(data, "slotNum", ChassisInfo.slotNum);    //机箱内一共有多少个槽位
-    cJSON_AddNumberToObject(data, "supportManage", ChassisInfo.isChMC); //是否支持机箱管理功能。 0:不支持, 1:支持
-    cJSON_AddNumberToObject(data, "ManageEn", gChassisManageEn);   //是否打开机箱管理功能。0:关闭, 1:打开
-    cJSON_AddNumberToObject(data, "curIndex", ChassisInfo.curIndex);   //当前刀片插在第几个槽位。
-    
-    pStr = cJSON_PrintUnformatted(root);
-    websSetStatus(wp, 200);
-    websWriteHeaders(wp, -1, 0);
-    websWriteEndHeaders(wp);
-    websWrite(wp, "%s", pStr);
-    websFlush(wp, 0);
-    websDone(wp);
-    printf("cJSON:%s\n", pStr);
-
-    if(pStr)
-        wfree(pStr);
-    if(root)
-        cJSON_Delete(root);
-
-}

+ 3 - 4
app/goahead-3.6.5/src/web_interface/src/fan.c

@@ -30,7 +30,7 @@ void getAllFanInfo(Webs *wp){
 	//Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
-//    wp->index = TEST_INDEX;
+
     target_addr = gIPMBAddr[wp->index];
     if(target_addr == 0x20)
     {
@@ -62,7 +62,7 @@ void getAllFanInfo(Webs *wp){
         if(fanInfo[i].index != 0xff)
         {
         	cJSON_AddItemToArray(pJsonArry,pJsonsub=cJSON_CreateObject()); /* 给创建的数组增加对对象*/
-            cJSON_AddNumberToObject(pJsonsub, "index", fanInfo[i].index); 
+            cJSON_AddNumberToObject(pJsonsub, "fan_index", fanInfo[i].index); 
             cJSON_AddStringToObject(pJsonsub, "name", fanInfo[i].name);
             cJSON_AddNumberToObject(pJsonsub, "mode", fanInfo[i].mode);			//0: 自动, 1:手动
             cJSON_AddNumberToObject(pJsonsub, "level", fanInfo[i].level);
@@ -92,7 +92,7 @@ void setFanInfo(Webs *wp){
     int i;
     uint8_t target_addr;
 
-    char *strIndex = websGetVar(wp, "index", NULL);
+    char *strIndex = websGetVar(wp, "fan_index", NULL);
     char *strMode = websGetVar(wp, "mode", NULL);
     char *strLevel = websGetVar(wp, "level", NULL);
 
@@ -118,7 +118,6 @@ void setFanInfo(Webs *wp){
 	//Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
 
-//    wp->index = TEST_INDEX;
     target_addr = gIPMBAddr[wp->index];
     if(target_addr == 0x20)
     {

+ 5 - 2
app/goahead-3.6.5/src/web_interface/src/remote_control.c

@@ -107,6 +107,7 @@ void getChassisStatus(Webs *wp)
 	IPMI20_UDS_SESSION_T    UDSSession;
     uint8_t target_addr;
     uint16_t wRet;
+    char ptr[100];
 
 	//Create session
     LIBIPMI_CreateSession(&UDSSession, DEFAULT_TIMEOUT);
@@ -127,9 +128,11 @@ void getChassisStatus(Webs *wp)
     websWriteHeaders(wp, -1, 0);
     websWriteEndHeaders(wp);
     if(chassisSta.power_state == 0)
-        websWrite(wp, "{\"data\":{\"powerStatus\":\"on\"},\"msg\":\"\",\"code\":200}");
+        sprintf(ptr, "{\"data\":{\"powerStatus\":\"off\"},\"msg\":\"\",\"code\":200}");
     else
-        websWrite(wp, "{\"data\":{\"powerStatus\":\"off\"},\"msg\":\"\",\"code\":200}");
+        sprintf(ptr, "{\"data\":{\"powerStatus\":\"on\"},\"msg\":\"\",\"code\":200}");
+    websWrite(wp, "%s", ptr);
     websFlush(wp, 0);	
     websDone(wp);
+    printf("---> cJson:%s\n", ptr);
 }

BIN
app/i2c_scan/i2c-scan


BIN
app/ipmitool-1.8.18/ipmitool


BIN
app/test_app/test_app