more debugging
This commit is contained in:
parent
65b85824ed
commit
b8f40b506f
@ -27,7 +27,10 @@ int main(int argc, char *argv[])
|
||||
config_patch(config->data, CFG_PORTNAME_MASK + 1, "PORT-001");
|
||||
config_patch(config->data, CFG_PORTNAME_MASK + 2, "PORT-002");
|
||||
|
||||
put_filedata(argv[2], config);
|
||||
char outname[64];
|
||||
strncpy(outname, argv[1], sizeof(outname));
|
||||
strcat(outname, ".patched");
|
||||
put_filedata(outname, config);
|
||||
|
||||
free(config);
|
||||
return 0;
|
||||
|
11
configdata.c
11
configdata.c
@ -48,6 +48,13 @@ static int patch_ip(void *config, struct cfg_patch *patch, int code, const char
|
||||
return (inet_pton(AF_INET, parameter, config + patch->offset) <= 0) ? -1 : 0;
|
||||
}
|
||||
|
||||
static int patch_defaultgw(void *config, struct cfg_patch *patch, int code, const char *parameter)
|
||||
{
|
||||
/* metric? */
|
||||
*((uint8_t *)(config + 0x110d)) = 0x02;
|
||||
return patch_ip(config, patch, code, parameter);
|
||||
}
|
||||
|
||||
static int patch_portname(void *config, struct cfg_patch *patch, int code, const char *parameter)
|
||||
{
|
||||
int num = code - patch->code;
|
||||
@ -75,7 +82,7 @@ static struct cfg_patch patcharr[] = {{
|
||||
.size = 0x1d,
|
||||
}, {
|
||||
.code = CFG_DEFAULTGW,
|
||||
.patch = patch_ip,
|
||||
.patch = patch_defaultgw,
|
||||
.offset = 0x10fc,
|
||||
}, {
|
||||
.code = CFG_IPADDRESS,
|
||||
@ -100,7 +107,7 @@ static struct cfg_patch patcharr[] = {{
|
||||
.mask = 0xFFFFFFE0,
|
||||
.patch = patch_portname,
|
||||
.offset = 0x336c,
|
||||
.size = 8,
|
||||
.size = 9,
|
||||
.min = 1, .max = 26,
|
||||
}};
|
||||
|
||||
|
3
lzsc.c
3
lzsc.c
@ -249,6 +249,8 @@ int lzs_pack(uint8_t *srcbuf, int srcsize, uint8_t *dstbuf, int dstsize)
|
||||
|
||||
/* get length of match (min. 2, 0 if collision) */
|
||||
int matchlen = getMatchLen(search->pos, state.src, maxlen);
|
||||
printf(" testing pos=0x%03x has 0x%02x matching bytes\n", (state.src - search->pos), matchlen);
|
||||
|
||||
if (matchlen > bestmatchlen) {
|
||||
bestmatchlen = matchlen;
|
||||
bestmatch = search;
|
||||
@ -257,6 +259,7 @@ int lzs_pack(uint8_t *srcbuf, int srcsize, uint8_t *dstbuf, int dstsize)
|
||||
|
||||
/* found something? */
|
||||
if (bestmatch != NULL) {
|
||||
printf(" selected pos=0x%03x with 0x%02x matching bytes\n", (state.src - bestmatch->pos), bestmatchlen);
|
||||
put_compressed_string(&state, state.src - bestmatch->pos, bestmatchlen);
|
||||
/* add bytes to history hash */
|
||||
while (bestmatchlen--)
|
||||
|
8
lzsd.c
8
lzsd.c
@ -99,12 +99,10 @@ uint32_t lzs_unpack(uint8_t *srcbuf, uint32_t srcsize, uint8_t *dstbuf, uint32_t
|
||||
/* end condition (7bit offset == 0x00) */
|
||||
if (tag == 1 && offset == 0) {
|
||||
/* align src to next byte */
|
||||
if (state.bitcnt > 7)
|
||||
printf("ERROR: alignment?\n");
|
||||
uint32_t cnt = state.bitcnt;
|
||||
uint32_t tmp = get_bits(&state, cnt);
|
||||
|
||||
state.bitcnt = 0;
|
||||
|
||||
printf("=== BLOCK END === \n");
|
||||
printf("=== BLOCK END (align=%d bits=0x%x) === \n", cnt, tmp);
|
||||
get_zyxel_header(&state);
|
||||
state.srcblkstart = state.src;
|
||||
state.dstblkstart = state.dst;
|
||||
|
Loading…
Reference in New Issue
Block a user