- hexdump(out, outp-out, "F> ");
- //hmcfgusb_send(dev, out, r/2, 1);
+ if (debug)
+ hexdump(out, cnt, "F> ");
+
+ rdata.ack = 0;
+ if (!hmcfgusb_send(dev, out, cnt, 0)) {
+ perror("hmcfgusb_send");
+ exit(EXIT_FAILURE);
+ }
+
+ printf("Waiting for ack...\n");
+ do {
+ errno = 0;
+ pfd = hmcfgusb_poll(dev, 1);
+ if ((pfd < 0) && errno) {
+ perror("hmcfgusb_poll");
+ exit(EXIT_FAILURE);
+ }
+ if (rdata.ack) {
+ break;
+ }
+ } while (pfd < 0);
+
+ if (rdata.ack == 2) {
+ printf("Firmware update successfull!\n");
+ break;
+ }