abort on missing acks
authorMichael Gernoth <michael@gernoth.net>
Wed, 5 Mar 2014 00:48:39 +0000 (01:48 +0100)
committerMichael Gernoth <michael@gernoth.net>
Wed, 5 Mar 2014 00:48:39 +0000 (01:48 +0100)
flash-ota.c

index 2b6e75e053d4ed890eec07be2857a054d9cbc8e8..71cb57e548bbe35970a571ba516185f6291f6925 100644 (file)
@@ -227,7 +227,7 @@ 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;
@@ -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;
Impressum, Datenschutz