From 558a94bb7ee2f65c9b1233a2efb2ba4091787aba Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Sun, 16 Feb 2014 12:06:18 +0100 Subject: [PATCH] set the source hmid, else OTA will fail --- flash-ota.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/flash-ota.c b/flash-ota.c index fd6cd6e..952d78c 100644 --- a/flash-ota.c +++ b/flash-ota.c @@ -42,6 +42,7 @@ #include "hmcfgusb.h" uint32_t hmid = 0; +uint32_t my_hmid = 0; enum message_type { MESSAGE_TYPE_E, @@ -85,6 +86,7 @@ static int parse_hmcfgusb(uint8_t *buf, int buf_len, void *data) break; case 'H': rdata->hmcfgusb_version = (buf[11] << 8) | buf[12]; + my_hmid = (buf[0x1b] << 16) | (buf[0x1c] << 8) | buf[0x1d]; break; default: break; @@ -310,7 +312,7 @@ int main(int argc, char **argv) out[MSGID] = msgid++; out[CTL] = 0x00; out[TYPE] = 0xCB; - SET_SRC(out, 0x000000); + SET_SRC(out, my_hmid); SET_DST(out, hmid); memcpy(&out[PAYLOAD], switch_msg, sizeof(switch_msg)); @@ -332,7 +334,7 @@ int main(int argc, char **argv) out[MSGID] = msgid++; out[CTL] = 0x20; out[TYPE] = 0xCB; - SET_SRC(out, 0x000000); + SET_SRC(out, my_hmid); SET_DST(out, hmid); memcpy(&out[PAYLOAD], switch_msg, sizeof(switch_msg)); @@ -411,7 +413,7 @@ int main(int argc, char **argv) if (ack) out[CTL] = 0x20; out[TYPE] = 0xCA; - SET_SRC(out, 0x000000); + SET_SRC(out, my_hmid); SET_DST(out, hmid); memcpy(&out[PAYLOAD], pos, payloadlen); -- 2.39.2