diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2016-11-23 22:16:06 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2016-11-23 22:16:06 +0000 |
commit | 81ba1f28a675cd0e7fda82cb87e0ae6f1e797aab (patch) | |
tree | 4bbd6a06e4f566c25d4b508d5e8ae12d32e00514 | |
parent | 1199bd52dee21faf818b04d7738275fc5d80e684 (diff) | |
download | hktool-81ba1f28a675cd0e7fda82cb87e0ae6f1e797aab.tar.gz hktool-81ba1f28a675cd0e7fda82cb87e0ae6f1e797aab.tar.xz hktool-81ba1f28a675cd0e7fda82cb87e0ae6f1e797aab.zip |
halfkay.c: Fix reboot
-rw-r--r-- | halfkay.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -93,7 +93,7 @@ static void fmtcmd(void *_dest, const struct flashparams *fp, size_t addr) addr >>= fp->addrshft; for (size_t i = 0; i < fp->cmdsz; i++) - dest[i] = (addr >> (i * CHAR_BIT)) & 0xFF; + dest[i] = (addr >> (i * 8)) & 0xFF; } int flash(const struct flashparams *fp, const char *file) @@ -152,13 +152,14 @@ int reboot(const struct flashparams *fp) { size_t tsize = fp->blksz + fp->cmdsz; unsigned char *cmd = malloc(tsize); + memset(cmd, 0x00, tsize - 3); + memset(cmd, 0xff, 3); usbopen(); - - fmtcmd(cmd, fp, SIZE_MAX); usbsendcmd(cmd, tsize, true); - usbclose(); + free(cmd); + return 0; } |