From: Michael Gernoth Date: Sun, 16 Feb 2014 11:06:18 +0000 (+0100) Subject: set the source hmid, else OTA will fail X-Git-Tag: v0.100~31 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb/commitdiff_plain/558a94bb7ee2f65c9b1233a2efb2ba4091787aba set the source hmid, else OTA will fail --- 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);