projects
/
hmcfgusb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
920d34e
)
flash-ota: make it possible to reduce the payload-length with -l
author
Michael Gernoth
<michael@gernoth.net>
Sun, 6 Sep 2015 10:19:10 +0000
(12:19 +0200)
committer
Michael Gernoth
<michael@gernoth.net>
Sun, 6 Sep 2015 10:19:10 +0000
(12:19 +0200)
flash-ota.c
patch
|
blob
|
blame
|
history
diff --git
a/flash-ota.c
b/flash-ota.c
index 754cc29a8a3bb1f16d12ea6069f058a16640e517..50f20f66909dd45de5d4f860441b699747e16d38 100644
(file)
--- a/
flash-ota.c
+++ b/
flash-ota.c
@@
-43,13
+43,18
@@
#include "culfw.h"
#include "util.h"
#include "culfw.h"
#include "util.h"
-#define MAX_RETRIES 5
+#define MAX_RETRIES 5
+#define NORMAL_MAX_PAYLOAD 37
+#define LOWE_MAX_PAYLOAD 17
extern char *optarg;
uint32_t hmid = 0;
uint32_t my_hmid = 0;
extern char *optarg;
uint32_t hmid = 0;
uint32_t my_hmid = 0;
+/* Maximum payloadlen supported by IO */
+uint32_t max_payloadlen = NORMAL_MAX_PAYLOAD;
+
enum device_type {
DEVICE_TYPE_HMCFGUSB,
DEVICE_TYPE_CULFW,
enum device_type {
DEVICE_TYPE_HMCFGUSB,
DEVICE_TYPE_CULFW,
@@
-337,6
+342,7
@@
void flash_ota_syntax(char *prog)
fprintf(stderr, "\nPossible options:\n");
fprintf(stderr, "\t-c device\tenable CUL-mode with CUL at path \"device\"\n");
fprintf(stderr, "\t-b bps\t\tuse CUL with speed \"bps\" (default: %u)\n", DEFAULT_CUL_BPS);
fprintf(stderr, "\nPossible options:\n");
fprintf(stderr, "\t-c device\tenable CUL-mode with CUL at path \"device\"\n");
fprintf(stderr, "\t-b bps\t\tuse CUL with speed \"bps\" (default: %u)\n", DEFAULT_CUL_BPS);
+ fprintf(stderr, "\t-l\t\tlower payloadlen (required for devices with little RAM, e.g. CUL v2 and CUL v4)\n");
fprintf(stderr, "\t-h\t\tthis help\n");
}
fprintf(stderr, "\t-h\t\tthis help\n");
}
@@
-366,7
+372,7
@@
int main(int argc, char **argv)
printf("HomeMatic OTA flasher version " VERSION "\n\n");
printf("HomeMatic OTA flasher version " VERSION "\n\n");
- while((opt = getopt(argc, argv, "b:c:f:hs:")) != -1) {
+ while((opt = getopt(argc, argv, "b:c:f:h
l
s:")) != -1) {
switch (opt) {
case 'b':
bps = atoi(optarg);
switch (opt) {
case 'b':
bps = atoi(optarg);
@@
-377,6
+383,10
@@
int main(int argc, char **argv)
case 'f':
fw_file = optarg;
break;
case 'f':
fw_file = optarg;
break;
+ case 'l':
+ printf("Reducing payload-len from %d to %d\n", max_payloadlen, LOWE_MAX_PAYLOAD);
+ max_payloadlen = LOWE_MAX_PAYLOAD;
+ break;
case 's':
serial = optarg;
break;
case 's':
serial = optarg;
break;
@@
-412,7
+422,7
@@
int main(int argc, char **argv)
}
dev.type = DEVICE_TYPE_CULFW;
}
dev.type = DEVICE_TYPE_CULFW;
- printf("Requesting firmware
-
version\n");
+ printf("Requesting firmware
version\n");
culfw_send(dev.culfw, "\r\n", 2);
culfw_flush(dev.culfw);
culfw_send(dev.culfw, "\r\n", 2);
culfw_flush(dev.culfw);
@@
-645,11
+655,11
@@
int main(int argc, char **argv)
first = 1;
cnt = 0;
do {
first = 1;
cnt = 0;
do {
- int payloadlen =
35
;
+ int payloadlen =
max_payloadlen - 2
;
int ack = 0;
if (first) {
int ack = 0;
if (first) {
- payloadlen =
37
;
+ payloadlen =
max_payloadlen
;
first = 0;
}
first = 0;
}
Impressum
,
Datenschutz