ESP8266-based WiFi serial modem emulator ROM
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

OTA: Add tracing

+34 -3
+33 -3
update.cpp
··· 63 63 */ 64 64 client_tls.setInsecure(); 65 65 } else { 66 - outputf("ERROR failed parsing URL %s\r\n", url); 66 + outputf("ERROR failed parsing URL \"%s\"\r\n", url); 67 67 free(path); 68 68 free(host); 69 69 return false; ··· 75 75 } else { 76 76 port = (tls ? 443 : 80); 77 77 } 78 + 79 + #ifdef UPDATE_TRACE 80 + syslog.logf(LOG_DEBUG, "%s: host \"%s\" path \"%s\" port %d tls %d", 81 + __func__, host, path, port, tls ? 1 : 0); 82 + #endif 78 83 79 84 if (!(tls ? client_tls : client).connect(host, port)) { 80 85 outputf("ERROR OTA failed connecting to http%s://%s:%d\r\n", ··· 99 104 (tls ? client_tls : client).available()) { 100 105 String line = (tls ? client_tls : client).readStringUntil('\n'); 101 106 107 + #ifdef UPDATE_TRACE 108 + syslog.logf(LOG_DEBUG, "%s: read header \"%s\"", __func__, 109 + line.c_str()); 110 + #endif 111 + 102 112 if (lines == 0) 103 113 sscanf(line.c_str(), "HTTP/1.%d %d%n", &httpver, 104 114 &status, &chars); ··· 112 122 lines++; 113 123 } 114 124 125 + #ifdef UPDATE_TRACE 126 + syslog.logf(LOG_DEBUG, "%s: read status %d, content-length %d vs " 127 + "expected %ld", __func__, status, clength, expected_length); 128 + #endif 129 + 115 130 if (status != 200) { 116 131 outputf("ERROR OTA fetch of %s failed with HTTP status %d\r\n", 117 132 url, status); ··· 127 142 return true; 128 143 129 144 drain: 145 + #ifdef UPDATE_TRACE 146 + syslog.logf(LOG_DEBUG, "%s: draining remaining body", __func__); 147 + #endif 130 148 while ((tls ? client_tls : client).available()) 131 149 (tls ? client_tls : client).read(); 132 150 (tls ? client_tls : client).stop(); ··· 152 170 memcpy_P(url, OTA_VERSION_URL, len); 153 171 } 154 172 173 + #ifdef UPDATE_TRACE 174 + syslog.logf(LOG_DEBUG, "processing update from \"%s\"", url); 175 + #endif 176 + 155 177 if (!update_https_get_body(url, 0)) { 156 178 if (furl) 157 179 free(furl); ··· 164 186 while ((tls ? client_tls : client).available()) { 165 187 String line = (tls ? client_tls : client).readStringUntil('\n'); 166 188 189 + #ifdef UPDATE_TRACE 190 + syslog.logf(LOG_DEBUG, "%s: read body[%d] \"%s\"", __func__, 191 + lines, line.c_str()); 192 + #endif 193 + 167 194 switch (lines) { 168 195 case 0: 169 196 version = line; ··· 200 227 return; 201 228 } 202 229 203 - /* doing an update, parse the url */ 204 - 230 + /* doing an update, parse the url read */ 231 + #ifdef UPDATE_TRACE 232 + syslog.logf(LOG_DEBUG, "%s: doing update with ROM url \"%s\" size %d", 233 + __func__, rom_url.c_str(), bytesize); 234 + #endif 205 235 if (!update_https_get_body((char *)rom_url.c_str(), bytesize)) 206 236 return; 207 237
+1
wifippp.h
··· 32 32 // #define PIXEL_TRACE 33 33 // #define PPP_TRACE 34 34 // #define SOCKS_TRACE 35 + // #define UPDATE_TRACE 35 36 36 37 #define EEPROM_SIZE 512 37 38 struct __attribute((__packed__)) eeprom_data {