summaryrefslogtreecommitdiffstats
path: root/master
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2019-05-27 03:32:21 +0100
committerfishsoupisgood <github@madingley.org>2019-05-27 03:32:21 +0100
commit35c4b69542a6dcc3b48462e6682848d0c37ff5a2 (patch)
treee8ecf1274618a16cec69dd98c9b86fca28e3b264 /master
parent9eb2f077abae0c7b2a6ff0722e9ac388b0ea9586 (diff)
downloaddatalink-pq-35c4b69542a6dcc3b48462e6682848d0c37ff5a2.tar.gz
datalink-pq-35c4b69542a6dcc3b48462e6682848d0c37ff5a2.tar.bz2
datalink-pq-35c4b69542a6dcc3b48462e6682848d0c37ff5a2.zip
add 150 support, tidy up 50 support
Diffstat (limited to 'master')
-rw-r--r--master/endstop0
-rw-r--r--master/model-150-fixes.patch80
-rw-r--r--master/model-50-v2.patch128
-rw-r--r--master/series2
-rw-r--r--master/tools.patch104
5 files changed, 190 insertions, 124 deletions
diff --git a/master/endstop b/master/endstop
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/master/endstop
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)
diff --git a/master/model-50-v2.patch b/master/model-50-v2.patch
index a486300..7951a9f 100644
--- a/master/model-50-v2.patch
+++ b/master/model-50-v2.patch
@@ -83,7 +83,7 @@ index ab6f2d7..d14eeae 100644
#define DEF_LPTRANSINFO 1
diff --git a/dl_init_watch.c b/dl_init_watch.c
-index 9cfc929..9e88500 100644
+index 9cfc929..d6a7408 100644
--- a/dl_init_watch.c
+++ b/dl_init_watch.c
@@ -62,6 +62,32 @@ WatchInfoPtr dl_init_watch(int type)
@@ -114,16 +114,16 @@ index 9cfc929..9e88500 100644
+ result->max_wristapp_len = 0;
+ result->max_mel_len = 0;
+ result->pre_notification_time = 0;
-+ result->time_adjust = 9;
++ result->time_adjust = 2;
+ break;
case DATALINK_70:
result->dl_device = type;
result->max_tz = 2;
diff --git a/dl_send_data.c b/dl_send_data.c
-index 3dfa12e..e68904f 100644
+index 3dfa12e..20f4203 100644
--- a/dl_send_data.c
+++ b/dl_send_data.c
-@@ -27,10 +27,16 @@
+@@ -27,10 +27,15 @@
#include <sys/wait.h>
#include <string.h>
#include <limits.h>
@@ -132,15 +132,15 @@ index 3dfa12e..e68904f 100644
#include "datalink.h"
#include "datalink_private.h"
-+#if 0
- #define MAX_PCKT 38
-+#else
-+#define MAX_PCKT 32
-+#endif
+-#define MAX_PCKT 38
++#define MAX_PCKT_OTHERS 38
++#define MAX_PCKT_50 32
++
++unsigned max_pckt=MAX_PCKT_OTHERS;
#define TIME_70 0x30
#define DSTART_70 0x60
-@@ -53,7 +59,7 @@ static unsigned char datablock2[] = { 0x14, 0x70, 0x02, 0x5a,
+@@ -53,7 +58,7 @@ static unsigned char datablock2[] = { 0x14, 0x70, 0x02, 0x5a,
0x47, 0xb7, 0xa9, 0xcc,
0x74, 0x6f, 0x00, 0x00
};
@@ -149,7 +149,22 @@ index 3dfa12e..e68904f 100644
1, 0, 0, 0
};
static unsigned char dstart[] = { 5, 0x93, 0, 0, 0 };
-@@ -94,11 +100,18 @@ int _write_data(int fd, unsigned char *buf, unsigned char *data, int size,
+@@ -78,11 +83,11 @@ int _write_data(int fd, unsigned char *buf, unsigned char *data, int size,
+ {
+ int bytes_left;
+
+- while (*buf + size > MAX_PCKT - 2)
++ while (*buf + size > max_pckt - 2)
+ {
+- bytes_left = *buf + size - MAX_PCKT + 2;
++ bytes_left = *buf + size - max_pckt + 2;
+ memcpy(&buf[buf[0]], data, size - bytes_left);
+- buf[0] = MAX_PCKT;
++ buf[0] = max_pckt;
+ dl_docrc(buf);
+
+ if (write(fd, buf, *buf) != *buf)
+@@ -94,11 +99,18 @@ int _write_data(int fd, unsigned char *buf, unsigned char *data, int size,
memcpy(buf, dspace, *dspace);
@@ -171,7 +186,7 @@ index 3dfa12e..e68904f 100644
}
if (!size)
-@@ -135,6 +148,14 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -135,6 +147,14 @@ int dl_send_data(WatchInfoPtr wi, int type)
int status;
int ret=0;
int p;
@@ -186,7 +201,7 @@ index 3dfa12e..e68904f 100644
if (type == BLINK_FILE)
{
-@@ -148,6 +169,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -148,6 +168,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
}
else
{
@@ -194,7 +209,7 @@ index 3dfa12e..e68904f 100644
/* Try to get the directory for a temporary file from
* the envinronment variable TMPDIR
* Try P_tmpdir if that fails
-@@ -171,11 +193,41 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -171,11 +192,43 @@ int dl_send_data(WatchInfoPtr wi, int type)
sprintf(buf, "Can't open %s for writing.", fname);
return ((*dl_error_proc) (buf));
}
@@ -227,8 +242,10 @@ index 3dfa12e..e68904f 100644
+#endif
}
-+ if (wi->dl_device == DATALINK_50)
++ if (wi->dl_device == DATALINK_50) {
+ addr = 0x000e;
++ max_pckt = MAX_PCKT_50;
++ }
+
memcpy(buf, start1, *start1);
@@ -237,7 +254,7 @@ index 3dfa12e..e68904f 100644
{
buf[4] = 1;
}
-@@ -212,7 +264,10 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -212,7 +265,10 @@ int dl_send_data(WatchInfoPtr wi, int type)
for (i = 0; i < dl_download_data.num_times; i++)
{
@@ -249,7 +266,7 @@ index 3dfa12e..e68904f 100644
p = 2;
if (wi->dl_device == DATALINK_IRONMAN)
{
-@@ -235,23 +290,29 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -235,23 +291,29 @@ int dl_send_data(WatchInfoPtr wi, int type)
buf[p++] = dl_download_data.times[i].year;
buf[p++] = dl_download_data.times[i].dow;
buf[p++] = dl_download_data.times[i].seconds;
@@ -291,7 +308,7 @@ index 3dfa12e..e68904f 100644
}
if (wi->dl_device == DATALINK_150 ||
-@@ -263,7 +324,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -263,7 +325,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
dl_download_data.times[i].date_fmt & 0xFF;
}
@@ -300,7 +317,7 @@ index 3dfa12e..e68904f 100644
buf[1] = TIME_70;
dl_docrc(buf);
-@@ -276,43 +337,80 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -276,43 +338,80 @@ int dl_send_data(WatchInfoPtr wi, int type)
if (wi->dl_device != DATALINK_IRONMAN && dl_download_data.memory)
{
@@ -309,9 +326,9 @@ index 3dfa12e..e68904f 100644
+ if (wi->dl_device == DATALINK_50) {
+ buf[0] = 0x05;
+ buf[1] = 0x60;
-+ buf[2] = dl_download_data.memory / (MAX_PCKT - 6);
++ buf[2] = dl_download_data.memory / (max_pckt - 6);
+
-+ if (dl_download_data.memory % (MAX_PCKT - 6))
++ if (dl_download_data.memory % (max_pckt - 6))
+ buf[2]++;
+ buf[2]++;
+ } else {
@@ -379,9 +396,9 @@ index 3dfa12e..e68904f 100644
+ } else {
+ memcpy(buf, dinfo, *dinfo);
+ buf[2] = 1;
-+ buf[3] = dl_download_data.memory / (MAX_PCKT - 6);
++ buf[3] = dl_download_data.memory / (max_pckt - 6);
+
-+ if (dl_download_data.memory % (MAX_PCKT - 6))
++ if (dl_download_data.memory % (max_pckt - 6))
+ buf[3]++;
+
+ buf[12] = dl_download_data.num_apps;
@@ -410,7 +427,7 @@ index 3dfa12e..e68904f 100644
dl_docrc(buf);
-@@ -320,15 +418,26 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -320,15 +419,26 @@ int dl_send_data(WatchInfoPtr wi, int type)
return ((*dl_error_proc)
("Can't write dinfo to tmp file."));
@@ -442,36 +459,35 @@ index 3dfa12e..e68904f 100644
for (i = 0; i < dl_download_data.num_apps; i++)
{
ap = &dl_download_data.apps[i];
-@@ -421,8 +530,16 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -421,8 +531,16 @@ int dl_send_data(WatchInfoPtr wi, int type)
return ((*dl_error_proc)
("Can't write to tmp file."));
+- memcpy(buf, dend, *dend);
+- buf[2] = 1;
+
-+#if 0
- memcpy(buf, dend, *dend);
- buf[2] = 1;
-+#else
-+ buf[0]=0x4;
-+ buf[1]=0x62;
-+#endif
++ if (wi->dl_device == DATALINK_50) {
++ buf[0]=0x4;
++ buf[1]=0x62;
++ } else {
++ memcpy(buf, dend, *dend);
++ buf[2] = 1;
++ }
+
+
dl_docrc(buf);
if (write(ofd, buf, *buf) != *buf)
-@@ -558,7 +675,11 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -558,7 +676,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
}
/* timezone label packet for IRONMAN watch */
-+#if 0
- if (wi->dl_device == DATALINK_IRONMAN)
-+#else
-+ if (1)
-+#endif
+- if (wi->dl_device == DATALINK_IRONMAN)
++ if ((wi->dl_device == DATALINK_IRONMAN) || (wi->dl_device == DATALINK_50))
for (i = 0; i < dl_download_data.num_times; i++)
{
p = 0;
-@@ -621,6 +742,22 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -621,6 +739,22 @@ int dl_send_data(WatchInfoPtr wi, int type)
return ((*dl_error_proc)
("Can't write to tmp file."));
@@ -481,7 +497,7 @@ index 3dfa12e..e68904f 100644
+ buf[0] = 0x07;
+ buf[1] = 0x70;
+ buf[2] = 0x00;
-+ buf[3] = 0x61 + dl_download_data.alarms[i].alarm_num;
++ buf[3] = 0x60 + dl_download_data.alarms[i].alarm_num;
+ buf[4] = 0x00;
+
+ dl_docrc(buf);
@@ -494,7 +510,19 @@ index 3dfa12e..e68904f 100644
}
for (i = 0; i < dl_download_data.num_timers; i++)
-@@ -673,7 +810,10 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -657,9 +791,9 @@ int dl_send_data(WatchInfoPtr wi, int type)
+
+ memcpy(buf, dinfo, *dinfo);
+ buf[2] = 2;
+- buf[3] = wristapp->len / (MAX_PCKT - 6);
++ buf[3] = wristapp->len / (max_pckt - 6);
+
+- if (wristapp->len % (MAX_PCKT - 6))
++ if (wristapp->len % (max_pckt - 6))
+ buf[3]++;
+
+ buf[4] = 1;
+@@ -673,7 +807,10 @@ int dl_send_data(WatchInfoPtr wi, int type)
memcpy(buf, dspace, *dspace);
@@ -506,7 +534,19 @@ index 3dfa12e..e68904f 100644
buf[1] = DATA_70;
pnum = 1;
-@@ -735,7 +875,10 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -719,9 +856,9 @@ 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;
+@@ -735,7 +872,10 @@ int dl_send_data(WatchInfoPtr wi, int type)
memcpy(buf, dspace, *dspace);
@@ -518,7 +558,7 @@ index 3dfa12e..e68904f 100644
buf[1] = DATA_70;
pnum = 1;
-@@ -798,6 +941,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -798,6 +938,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
close(ofd);
@@ -526,7 +566,7 @@ index 3dfa12e..e68904f 100644
switch (type)
{
case BLINK_FILE:
-@@ -892,6 +1036,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
+@@ -892,6 +1033,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
break;
}
diff --git a/master/series b/master/series
index 8c351d7..f4daf8c 100644
--- a/master/series
+++ b/master/series
@@ -1,4 +1,6 @@
model-50-v2.patch
+model-150-fixes.patch
tools.patch
+endstop
#model-50-v1.patch
#model-50-v2-cumul.patch
diff --git a/master/tools.patch b/master/tools.patch
index 96a117d..b618df5 100644
--- a/master/tools.patch
+++ b/master/tools.patch
@@ -1,93 +1,37 @@
-diff --git a/dl_init_watch.c b/dl_init_watch.c
-index 9e88500..d6a7408 100644
---- a/dl_init_watch.c
-+++ b/dl_init_watch.c
-@@ -86,7 +86,7 @@ WatchInfoPtr dl_init_watch(int type)
- result->max_wristapp_len = 0;
- result->max_mel_len = 0;
- result->pre_notification_time = 0;
-- result->time_adjust = 9;
-+ result->time_adjust = 2;
- break;
- case DATALINK_70:
- result->dl_device = type;
-diff --git a/dl_send_data.c b/dl_send_data.c
-index e68904f..af2a24f 100644
---- a/dl_send_data.c
-+++ b/dl_send_data.c
-@@ -531,13 +531,13 @@ int dl_send_data(WatchInfoPtr wi, int type)
- ("Can't write to tmp file."));
-
-
--#if 0
-- memcpy(buf, dend, *dend);
-- buf[2] = 1;
--#else
-- buf[0]=0x4;
-- buf[1]=0x62;
--#endif
-+ if (wi->dl_device == DATALINK_50) {
-+ buf[0]=0x4;
-+ buf[1]=0x62;
-+ } else {
-+ memcpy(buf, dend, *dend);
-+ buf[2] = 1;
-+ }
-
-
- dl_docrc(buf);
-@@ -675,11 +675,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
- }
-
- /* timezone label packet for IRONMAN watch */
--#if 0
-- if (wi->dl_device == DATALINK_IRONMAN)
--#else
-- if (1)
--#endif
-+ if ((wi->dl_device == DATALINK_IRONMAN) || (wi->dl_device == DATALINK_50))
- for (i = 0; i < dl_download_data.num_times; i++)
- {
- p = 0;
-@@ -748,7 +744,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
- buf[0] = 0x07;
- buf[1] = 0x70;
- buf[2] = 0x00;
-- buf[3] = 0x61 + dl_download_data.alarms[i].alarm_num;
-+ buf[3] = 0x60 + dl_download_data.alarms[i].alarm_num;
- buf[4] = 0x00;
-
- dl_docrc(buf);
diff --git a/tools/to_h.c b/tools/to_h.c
new file mode 100644
-index 0000000..d2b100d
+index 0000000..915437c
--- /dev/null
+++ b/tools/to_h.c
-@@ -0,0 +1,27 @@
+@@ -0,0 +1,31 @@
+#include <stdio.h>
+
+
-+int main(int argc, char *argv)
++int
++main (int argc, char *argv)
+{
-+unsigned i,n;
-+unsigned char c;
-+int fd;
++ unsigned i, n;
++ unsigned char c;
++ int fd;
+
-+fd=open("DEBUGOUTPUT",0);
++ fd = open ("DEBUGOUTPUT", 0);
+
+
-+while (read(fd,&c,1)==1) {
-+n=c;
-+printf (" 0x%02x, ",c);
++ while (read (fd, &c, 1) == 1)
++ {
++ n = c;
++ printf (" 0x%02x, ", c);
+
-+for (i=1;i<n;++i) {
-+if (!(i%16)) {
-+ printf("\n");
-+ printf(" ");
-+}
-+read(fd,&c,1);
-+printf ("0x%02x, ",c);
-+}
-+printf("\n");
-+}
++ for (i = 1; i < n; ++i)
++ {
++ if (!(i % 16))
++ {
++ printf ("\n");
++ printf (" ");
++ }
++ read (fd, &c, 1);
++ printf ("0x%02x, ", c);
++ }
++ printf ("\n");
++ }
+}