- cnt = 0;
- do {
- memset(buf, 0, sizeof(buf));
- r = read(fd, buf, sizeof(buf));
- if (r < 0) {
- perror("read");
+ printf("\nHM-CFG-USB opened.\n\n");
+
+
+ printf("Flashing %d blocks", fw->fw_blocks);
+ if (debug) {
+ printf("\n");
+ } else {
+ printf(": %c", twiddlie[0]);
+ fflush(stdout);
+ }
+
+ for (block = 0; block < fw->fw_blocks; block++) {
+ len = fw->fw[block][2] << 8;
+ len |= fw->fw[block][3];
+
+ len += 4; /* block nr., length */
+
+ if (debug)
+ hexdump(fw->fw[block], len, "F> ");
+
+ rdata.ack = 0;
+ if (!hmcfgusb_send(dev, fw->fw[block], len, 0)) {
+ perror("\n\nhmcfgusb_send");