diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2005-04-14 19:01:09 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2005-04-14 19:01:09 +0000 |
commit | a61864c6a30065b38b1183156917dc4bbcf4049b (patch) | |
tree | 14ae1cbf7581c737d639ccf466bf45037867fa0c /sys/dev/microcode/uyap/build.c | |
parent | 3a29f22c43977e3d113800aef90acbbc856e8fda (diff) |
write actual data to file, not pointers.
store the address field in little endian order.
Diffstat (limited to 'sys/dev/microcode/uyap/build.c')
-rw-r--r-- | sys/dev/microcode/uyap/build.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/dev/microcode/uyap/build.c b/sys/dev/microcode/uyap/build.c index 30fc01ba80f..6f0b204f81f 100644 --- a/sys/dev/microcode/uyap/build.c +++ b/sys/dev/microcode/uyap/build.c @@ -1,4 +1,4 @@ -/* $OpenBSD: build.c,v 1.1 2004/12/19 15:20:13 deraadt Exp $ */ +/* $OpenBSD: build.c,v 1.2 2005/04/14 19:01:08 damien Exp $ */ /* * Copyright (c) 2004 Theo de Raadt <deraadt@openbsd.org> @@ -26,7 +26,8 @@ int main(int argc, char *argv[]) { - int i; + const struct ezdata *ptr; + u_int16_t address; int fd; printf("creating %s length %d\n", FILENAME, sizeof uyap_firmware); @@ -34,7 +35,15 @@ main(int argc, char *argv[]) if (fd == -1) err(1, "%s", FILENAME); - write(fd, uyap_firmware, sizeof uyap_firmware); - close(fd); + for (ptr = uyap_firmware; ; ptr++) { + write(fd, &ptr->length, 1); + address = htole16(ptr->address); + write(fd, &address, 2); + write(fd, ptr->data, ptr->length); + + if (ptr->length == 0) + break; + } + return 0; } |