aqhome-tool: increased verbosity for flashing.

This commit is contained in:
Martin Preuss
2025-02-01 16:20:57 +01:00
parent b38d864612
commit 2d259ae9be

View File

@@ -68,7 +68,7 @@ static int _sendFlashRecord(GWEN_MSG_ENDPOINT *epTcp,
const AQH_FLASHRECORD *flashRecord,
uint16_t pageSize,
int timeoutInSeconds);
static int _sendFlashEnd(GWEN_MSG_ENDPOINT *epTcp, int reason);
static int _sendFlashEnd(GWEN_MSG_ENDPOINT *epTcp, int reason, int timeoutInSeconds);
@@ -344,7 +344,7 @@ int _performFlashProcedure(GWEN_MSG_ENDPOINT *epTcp,
flashRecord=AQH_FlashRecord_List_Next(flashRecord);
}
rv=_sendFlashEnd(epTcp, 0);
rv=_sendFlashEnd(epTcp, 0, timeoutInSeconds);
if (rv<0) {
DBG_INFO(NULL, "here (%d)", rv);
return rv;
@@ -502,22 +502,44 @@ int _sendFlashStart(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid)
int _sendFlashEnd(GWEN_MSG_ENDPOINT *epTcp, int reason)
int _sendFlashEnd(GWEN_MSG_ENDPOINT *epTcp, int reason, int timeoutInSeconds)
{
GWEN_MSG *msgNode;
GWEN_MSG *msgOut;
int i;
msgNode=AQH_FlashEndMsg_new(0, 0xc1, AQH_MSG_TYPE_FLASH_END, reason);
if (msgNode==NULL) {
DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_GENERIC;
for (i=0;i<FLASH_TOOL_MAX_REPEAT;i++) {
GWEN_MSG *msgNode;
GWEN_MSG *msgOut;
int rv;
fprintf(stdout, "Sending end\n");
usleep(100000);
msgNode=AQH_FlashEndMsg_new(0, 0xc1, AQH_MSG_TYPE_FLASH_END, reason);
if (msgNode==NULL) {
DBG_ERROR(NULL, "Error creating message");
return GWEN_ERROR_GENERIC;
}
msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_NODES_FORWARD,
GWEN_MsgEndpoint_GetNextMessageId(epTcp), 0,
GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode));
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_Msg_free(msgNode);
rv=_waitForFlashResponseMessage(epTcp, timeoutInSeconds);
if (rv==0) {
fprintf(stdout, "-> ACK received.\n");
break;
}
else {
DBG_ERROR(NULL, "Negative response to flash end message (%d)", rv);
}
} /* for */
if (i>=FLASH_TOOL_MAX_REPEAT) {
DBG_ERROR(NULL, "Too many errors (tried %d times), giving up", i);
return GWEN_ERROR_IO;
}
msgOut=AQH_ForwardIpcMsg_new(AQH_MSGTYPE_IPC_NODES_FORWARD,
GWEN_MsgEndpoint_GetNextMessageId(epTcp), 0,
GWEN_Msg_GetConstBuffer(msgNode), GWEN_Msg_GetBytesInBuffer(msgNode));
GWEN_MsgEndpoint_AddSendMessage(epTcp, msgOut);
GWEN_Msg_free(msgNode);
return 0;
}