From 35c4b69542a6dcc3b48462e6682848d0c37ff5a2 Mon Sep 17 00:00:00 2001 From: fishsoupisgood Date: Mon, 27 May 2019 03:32:21 +0100 Subject: add 150 support, tidy up 50 support --- master/model-150-fixes.patch | 80 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 master/model-150-fixes.patch (limited to 'master/model-150-fixes.patch') diff --git a/master/model-150-fixes.patch b/master/model-150-fixes.patch new file mode 100644 index 0000000..912d581 --- /dev/null +++ b/master/model-150-fixes.patch @@ -0,0 +1,80 @@ +diff --git a/dl_init_watch.c b/dl_init_watch.c +index d6a7408..ec2c1bc 100644 +--- a/dl_init_watch.c ++++ b/dl_init_watch.c +@@ -139,7 +139,7 @@ WatchInfoPtr dl_init_watch(int type) + result->max_wristapp_len = 742; + result->max_mel_len = 64; + result->pre_notification_time = 0; +- result->time_adjust = 9; ++ result->time_adjust = 2; + break; + case DATALINK_IRONMAN: + result->dl_device = type; +diff --git a/dl_send_data.c b/dl_send_data.c +index 20f4203..3ea7bfa 100644 +--- a/dl_send_data.c ++++ b/dl_send_data.c +@@ -825,6 +825,8 @@ int dl_send_data(WatchInfoPtr wi, int type) + + if (*buf != 4) + { ++ *buf += 2; ++ + dl_docrc(buf); + + if (write(ofd, buf, *buf) != *buf) +@@ -845,7 +847,21 @@ int dl_send_data(WatchInfoPtr wi, int type) + + if (dl_download_data.num_melody) + { ++ unsigned melody_len; ++ unsigned char *melody_data; ++ unsigned char melody_header[]={0x25, 0x04, 0x19, 0x69}; + melody = dl_download_data.melody; ++ ++ ++ melody_len = melody->len; ++ melody_data = melody->data; ++ ++ ++ if ((melody_len >= sizeof(melody_header)) && (!memcmp(melody_data, melody_header, sizeof(melody_header)))) { ++ melody_len -= sizeof(melody_header); ++ melody_data += sizeof(melody_header); ++ } ++ + memcpy(buf, dstart, *dstart); + buf[2] = 3; + dl_docrc(buf); +@@ -856,12 +872,12 @@ int dl_send_data(WatchInfoPtr wi, int type) + + memcpy(buf, dinfo, *dinfo); + buf[2] = 3; +- buf[3] = melody->len / (max_pckt - 6); ++ buf[3] = melody_len / (max_pckt - 6); + +- if (melody->len % (max_pckt - 6)) ++ if (melody_len % (max_pckt - 6)) + buf[3]++; + +- buf[4] = 0xff - melody->len; ++ buf[4] = 0xff - melody_len; + *buf = 7; + + dl_docrc(buf); +@@ -883,12 +899,14 @@ int dl_send_data(WatchInfoPtr wi, int type) + buf[3] = pnum++; + + if (!_write_data +- (ofd, buf, melody->data, melody->len, &pnum, 3, wi)) ++ (ofd, buf, melody_data, melody_len, &pnum, 3, wi)) + return ((*dl_error_proc) + ("Can't write to tmp file.")); + + if (*buf != 4) + { ++ *buf += 2; ++ + dl_docrc(buf); + + if (write(ofd, buf, *buf) != *buf) -- cgit v1.2.3