diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-11-07 22:31:48 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2013-11-07 22:31:48 +0000 |
commit | 5a85a21e061772188f4a3cdc76d451d98cc8ae57 (patch) | |
tree | b47b1fe870d2bdaa616a157df7ae4828bdb1e85d /tools/firmware-utils | |
parent | 0615b9d83a678b677e0e9cd2e9e266ce28df1391 (diff) | |
download | mtk-20170518-5a85a21e061772188f4a3cdc76d451d98cc8ae57.zip mtk-20170518-5a85a21e061772188f4a3cdc76d451d98cc8ae57.tar.gz mtk-20170518-5a85a21e061772188f4a3cdc76d451d98cc8ae57.tar.bz2 |
tools: adapt addpattern for WD's Range Extender
A few things had to be changed to add support for these devices:
- support code patterns with 8 characters
- new board definition for the range extender device
Patchwork: http://patchwork.openwrt.org/patch/4280/
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 38685
Diffstat (limited to 'tools/firmware-utils')
-rw-r--r-- | tools/firmware-utils/src/addpattern.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tools/firmware-utils/src/addpattern.c b/tools/firmware-utils/src/addpattern.c index da6797c..1d72285 100644 --- a/tools/firmware-utils/src/addpattern.c +++ b/tools/firmware-utils/src/addpattern.c @@ -77,10 +77,11 @@ /* (from 3.00.24 firmware cyutils.h) */ #define SUPPORT_4704_CHIP 0x0008 #define SUPPORT_5352E_CHIP 0x0010 +/* (from WD My Net Wi-Fi Range Extender's cyutils.s) */ +#define SUPPORT_4703_CHIP 0x0020 struct code_header { /* from cyutils.h */ - char magic[4]; - char res1[4]; /* for extra magic */ + char magic[8]; char fwdate[3]; char fwvern[3]; char id[4]; /* U2ND */ @@ -110,6 +111,13 @@ struct board_info boards[] = { .hw_ver = 0x00, .sn = 0x0f, .flags = {0x3f, 0x00}, + }, + { + .id = "mynet-rext", + .pattern = "WDHNSTFH", + .hw_ver = 0x00, + .sn = 0x00, + .flags = {0x3f, 0x00}, }, { /* Terminating entry */ .id = NULL, @@ -243,8 +251,8 @@ int main(int argc, char **argv) hdr->flags[1] = board->flags[1]; } - if (strlen(pattern) != 4) { - fprintf(stderr, "illegal pattern \"%s\": length != 4\n", pattern); + if (strlen(pattern) > 8) { + fprintf(stderr, "illegal pattern \"%s\"\n", pattern); usage(); } @@ -270,16 +278,16 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - memcpy(&hdr->magic, pattern, 4); + memcpy(hdr->magic, pattern, strlen(pattern)); if (pbotflag) - memcpy(&hdr->res1, pbotpat, 4); + memcpy(&hdr->magic[4], pbotpat, 4); hdr->fwdate[0] = ptm->tm_year % 100; hdr->fwdate[1] = ptm->tm_mon + 1; hdr->fwdate[2] = ptm->tm_mday; hdr->fwvern[0] = v0; hdr->fwvern[1] = v1; hdr->fwvern[2] = v2; - memcpy(&hdr->id, CODE_ID, strlen(CODE_ID)); + memcpy(hdr->id, CODE_ID, strlen(CODE_ID)); off = sizeof(struct code_header); |