]> cvs.zerfleddert.de Git - hmcfgusb/blobdiff - flash-ota.c
fix error messages
[hmcfgusb] / flash-ota.c
index 2b6e75e053d4ed890eec07be2857a054d9cbc8e8..91267680f31da89f052c5513b4ff7ffd96b2e389 100644 (file)
@@ -227,14 +227,14 @@ int send_hm_message(struct ota_dev *dev, struct recv_data *rdata, uint8_t *msg)
                                }
 
                                if (msg[CTL] & 0x20) {
-                                       int cnt = 10;
+                                       int cnt = 3;
                                        int pfd;
                                        do {
                                                errno = 0;
                                                pfd = culfw_poll(dev->culfw, 1);
                                                if ((pfd < 0) && errno) {
                                                        if (errno != ETIMEDOUT) {
-                                                               perror("\n\nhmcfgusb_poll");
+                                                               perror("\n\nculfw_poll");
                                                                exit(EXIT_FAILURE);
                                                        }
                                                }
@@ -242,6 +242,11 @@ int send_hm_message(struct ota_dev *dev, struct recv_data *rdata, uint8_t *msg)
                                                        break;
                                                }
                                        } while(cnt--);
+
+                                       if (cnt == -1) {
+                                               fprintf(stderr, "\nMissing ACK!\n");
+                                               return 0;
+                                       }
                                }
                        }
                        break;
@@ -654,7 +659,7 @@ int main(int argc, char **argv)
                }
                if ((pfd < 0) && errno) {
                        if (errno != ETIMEDOUT) {
-                               perror("\n\nhmcfgusb_poll");
+                               perror("\n\npoll");
                                exit(EXIT_FAILURE);
                        }
                }
Impressum, Datenschutz