/*
- * $Id$
*
- * Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
+ * Copyright (C) 2007-2009 Gabor Juhos <juhosg@openwrt.org>
*
* This program was based on the code found in various Linux
* source tarballs released by Edimax for it's devices.
BOARD_ADM("BR-6114WG", "Edimax BR-6114WG", 2, SIG_BR6114WG),
BOARD_ADM("BR-6524K", "Edimax BR-6524K", 2, SIG_BR6524K),
BOARD_ADM("BR-6524KP", "Edimax BR-6524KP", 2, SIG_BR6524KP),
+ BOARD_ADM("BR-6524N", "Edimax BR-6524N", 2, SIG_BR6524N),
BOARD_ADM("BR-6524WG", "Edimax BR-6524WG", 4, SIG_BR6524WG),
BOARD_ADM("BR-6524WP", "Edimax BR-6524WP", 4, SIG_BR6524WP),
BOARD_ADM("BR-6541K", "Edimax BR-6541K", 2, SIG_BR6541K),
/* Conceptronic products */
BOARD_ADM("C54BSR4", "Conceptronic C54BSR4", 2, SIG_C54BSR4),
+ /* OSBRiDGE products */
+ BOARD_ADM("5GXi", "OSBDRiDGE 5GXi", 2, SIG_5GXI),
+
{.model = NULL}
};
#define ERRS(fmt, ...) do { \
int save = errno; \
fflush(0); \
- fprintf(stderr, "[%s] *** error: " fmt "\n", progname, ## __VA_ARGS__ \
+ fprintf(stderr, "[%s] *** error: " fmt ": %s\n", progname, ## __VA_ARGS__ \
, strerror(save)); \
} while (0)
void
-csum16_update(uint8_t *p, uint32_t len, struct csum_state *css)
+csum16_update(void *data, uint32_t len, struct csum_state *css)
{
+ uint8_t *p = data;
uint16_t t;
if (css->odd) {
void
-csum_update(uint8_t *p, uint32_t len, struct csum_state *css)
+csum_update(void *data, uint32_t len, struct csum_state *css)
{
+ uint8_t *p = data;
+
switch (css->size) {
case CSUM_SIZE_8:
csum8_update(p,len,css);
case CSUM_SIZE_16:
ret = csum16_get(css);
break;
+ default:
+ ERR("invalid checksum size\n");
+ return 0;
}
return ret;
* routines to write data to the output file
*/
int
-write_out_data(FILE *outfile, uint8_t *data, size_t len,
+write_out_data(FILE *outfile, void *data, size_t len,
struct csum_state *css)
{
+ uint8_t *ptr = data;
+
errno = 0;
- fwrite(data, len, 1, outfile);
+ fwrite(ptr, len, 1, outfile);
if (errno) {
ERRS("unable to write output file");
return ERR_FATAL;
}
if (css) {
- csum_update(data, len, css);
+ csum_update(ptr, len, css);
}
return 0;
/* setup header fields */
memcpy(hdr.sig, block->sig, 4);
hdr.addr = HOST_TO_LE32(block->addr);
- hdr.size = HOST_TO_LE32(block->align-block->size_hdr);
+ hdr.size = HOST_TO_LE32(block->size - block->size_hdr - block->size_csum);
DBG(1,"writing header for block");
res = write_out_data(outfile, (uint8_t *)&hdr, sizeof(hdr),NULL);
/* write padding data if neccesary */
padlen = block->size_avail - block->file_size;
- DBG(1,"padding block, length=%d", padlen);
+ DBG(1,"padding block, length=%zu", padlen);
res = write_out_padding(outfile, padlen, block->padc, block->css);
return res;
{
char buf[MAX_ARG_LEN];
char *argv[MAX_ARG_COUNT];
- int argc;
char *p;
struct csys_block *block;
int i;
return ERR_FATAL;
}
- argc = parse_arg(arg, buf, argv);
+ parse_arg(arg, buf, argv);
i = 0;
p = argv[i++];
res = ERR_FATAL;
if (keep_invalid_images == 0) {
- WARN("generation of invalid images disabled", ofname);
+ WARN("generation of invalid images \"%s\" disabled", ofname);
goto out;
}
- WARN("generating invalid image", ofname);
+ WARN("generating invalid image: \"%s\"", ofname);
}
outfile = fopen(ofname, "w");