1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
|
diff --git a/Makefile b/Makefile
index e758fa4..ee168c2 100644
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@ LIBDIR=$(PREFIX)/lib
MANDIR=$(PREFIX)/man
INCDIR=$(PREFIX)/include
-PORT = /dev/ttyUSB1
+PORT = /dev/ttyACM1
CC = gcc
CPPFLAGS = -DBINDIR=\"$(BINDIR)\" -DPORT=\"$(PORT)\"
diff --git a/datalink.h b/datalink.h
index ab6f2d7..d14eeae 100644
--- a/datalink.h
+++ b/datalink.h
@@ -212,10 +212,11 @@ typedef struct watch_info_s
/* Watch types */
#define NO_WATCH 0
-#define DATALINK_70 1
-#define DATALINK_150 2
-#define DATALINK_150S 3
-#define DATALINK_IRONMAN 4
+#define DATALINK_50 1
+#define DATALINK_70 2
+#define DATALINK_150 3
+#define DATALINK_150S 4
+#define DATALINK_IRONMAN 5
#define DEF_LPTRANSINFO 1
diff --git a/dl_init_watch.c b/dl_init_watch.c
index 9cfc929..9e88500 100644
--- a/dl_init_watch.c
+++ b/dl_init_watch.c
@@ -62,6 +62,32 @@ WatchInfoPtr dl_init_watch(int type)
switch (type)
{
+ case DATALINK_50:
+ result->dl_device = type;
+ result->max_tz = 2;
+ result->max_alarms = 5;
+ result->max_chrons = 0;
+ result->max_chron_str = 0;
+ result->max_apps = 255;
+ result->max_phones = 255;
+ result->max_timers = 0;
+ result->max_todos = 255;
+ result->max_annivs = 255;
+ result->max_system = 1;
+ result->max_wristapp = 0;
+ result->max_melody = 0;
+ result->max_tzlen = 3;
+ result->max_mem = 850;
+ result->mem_size = 0;
+ result->max_str = 15;
+ result->max_alarm_str = 8;
+ result->max_phone_str = 12;
+ result->max_timer_str = 0;
+ result->max_wristapp_len = 0;
+ result->max_mel_len = 0;
+ result->pre_notification_time = 0;
+ result->time_adjust = 9;
+ 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 94f93e7..1ccbcf0 100644
--- a/dl_send_data.c
+++ b/dl_send_data.c
@@ -99,19 +99,18 @@ int _write_data(int fd, unsigned char *buf, unsigned char *data, int size,
memcpy(buf, dspace, *dspace);
-#if 1
- buf[0] = 0x3;
-#endif
+ if (wi->dl_device == DATALINK_50)
+ buf[0] = 0x3;
- if (wi->dl_device == DATALINK_70)
+ if ((wi->dl_device == DATALINK_50) || (wi->dl_device == DATALINK_70))
buf[1] = DATA_70;
-#if 0
- buf[2] = type;
- buf[3] = (*pnum)++;
-#else
- buf[2] = (*pnum)++;
-#endif
+ if (wi->dl_device == DATALINK_50) {
+ buf[2] = (*pnum)++;
+ } else {
+ buf[2] = type;
+ buf[3] = (*pnum)++;
+ }
}
if (!size)
@@ -221,7 +220,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
memcpy(buf, start1, *start1);
- if (wi->dl_device == DATALINK_70)
+ if ((wi->dl_device == DATALINK_50) || (wi->dl_device == DATALINK_70))
{
buf[4] = 1;
}
@@ -259,9 +258,8 @@ int dl_send_data(WatchInfoPtr wi, int type)
for (i = 0; i < dl_download_data.num_times; i++)
{
memcpy(buf, time, *time);
-#if 1
- buf[0] = 0xd;
-#endif
+ if (wi->dl_device == DATALINK_50)
+ buf[0] = 0xd;
p = 2;
if (wi->dl_device == DATALINK_IRONMAN)
@@ -285,29 +283,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;
- } else
- {
+ } else {
buf[p++] = dl_download_data.times[i].hours;
buf[p++] = dl_download_data.times[i].minutes;
buf[p++] = dl_download_data.times[i].month;
buf[p++] = dl_download_data.times[i].day;
buf[p++] = dl_download_data.times[i].year;
-#if 0
- buf[p++] =
- dl_pack_char(dl_download_data.
- times[i].label[0]);
- buf[p++] =
- dl_pack_char(dl_download_data.
- times[i].label[1]);
- buf[p++] =
- dl_pack_char(dl_download_data.
- times[i].label[2]);
- buf[p++] = dl_download_data.times[i].dow - 1;
-#else
- buf[p++] = dl_download_data.times[i].dow;
- buf[p++] = dl_download_data.times[i].seconds;
- buf[p++] = dl_download_data.times[i].hour_fmt;
-#endif
+
+ if (wi->dl_device == DATALINK_50) {
+ buf[p++] = dl_download_data.times[i].dow;
+ buf[p++] = dl_download_data.times[i].seconds;
+ buf[p++] = dl_download_data.times[i].hour_fmt;
+ } else {
+ buf[p++] =
+ dl_pack_char(dl_download_data.
+ times[i].label[0]);
+ buf[p++] =
+ dl_pack_char(dl_download_data.
+ times[i].label[1]);
+ buf[p++] =
+ dl_pack_char(dl_download_data.
+ times[i].label[2]);
+ buf[p++] = dl_download_data.times[i].dow - 1;
+ }
}
if (wi->dl_device == DATALINK_150 ||
@@ -319,7 +317,7 @@ int dl_send_data(WatchInfoPtr wi, int type)
dl_download_data.times[i].date_fmt & 0xFF;
}
- if (wi->dl_device == DATALINK_70)
+ if ((wi->dl_device == DATALINK_50) || (wi->dl_device == DATALINK_70))
buf[1] = TIME_70;
dl_docrc(buf);
@@ -332,18 +330,19 @@ int dl_send_data(WatchInfoPtr wi, int type)
if (wi->dl_device != DATALINK_IRONMAN && dl_download_data.memory)
{
-#if 0
- memcpy(buf, dstart, *dstart);
- buf[2] = 1;
-#else
- buf[0] = 0x05;
- buf[1] = 0x60;
- buf[2] = dl_download_data.memory / (MAX_PCKT - 6);
+ if (wi->dl_device == DATALINK_50) {
+ buf[0] = 0x05;
+ buf[1] = 0x60;
+ 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]++;
- buf[2]++;
-#endif
+ } else {
+ memcpy(buf, dstart, *dstart);
+ buf[2] = 1;
+ }
+
dl_docrc(buf);
if (write(ofd, buf, *buf) != *buf)
@@ -351,61 +350,60 @@ int dl_send_data(WatchInfoPtr wi, int type)
("Can't write dstart to tmp file."));
-#if 0
- memcpy(buf, dinfo, *dinfo);
- buf[2] = 1;
- buf[3] = dl_download_data.memory / (MAX_PCKT - 6);
-
- if (dl_download_data.memory % (MAX_PCKT - 6))
- buf[3]++;
+ if (wi->dl_device == DATALINK_50) {
+ pnum=1;
- buf[12] = dl_download_data.num_apps;
- buf[13] = dl_download_data.num_todos;
- buf[14] = dl_download_data.num_phones;
- buf[15] = dl_download_data.num_annivs;
- buf[4] = (addr >> 8) & 0xff;
- buf[5] = addr & 0xff;
- addr += dl_download_data.app_size;
- buf[6] = (addr >> 8) & 0xff;
- buf[7] = addr & 0xff;
- addr += dl_download_data.todo_size;
- buf[8] = (addr >> 8) & 0xff;
- buf[9] = addr & 0xff;
- addr += dl_download_data.phone_size;
- buf[10] = (addr >> 8) & 0xff;
- buf[11] = addr & 0xff;
- buf[16] = 0x62;
- buf[17] = dl_download_data.pre_notification_time / 5;
- if (!buf[17])
- buf[17] = 0xff;
-
- if (wi->dl_device == DATALINK_70)
- buf[1] = DATA_70;
-#else
-
- pnum=1;
-
- buf[0] = 0x13;
- buf[1] = 0x61;
- buf[2] = pnum;
- buf[3] = (addr >> 8) & 0xff;
- buf[4] = addr & 0xff;
- addr += dl_download_data.app_size;
- buf[5] = (addr >> 8) & 0xff;
- buf[6] = addr & 0xff;
- addr += dl_download_data.todo_size;
- buf[7] = (addr >> 8) & 0xff;
- buf[8] = addr & 0xff;
- addr += dl_download_data.phone_size;
- buf[9] = (addr >> 8) & 0xff;
- buf[10] = addr & 0xff;
- buf[11] = dl_download_data.num_apps;
- buf[12] = dl_download_data.num_todos;
- buf[13] = dl_download_data.num_phones;
- buf[14] = dl_download_data.num_annivs;
- buf[15] = 0x00;
- buf[16] = 0x03;
-#endif
+ buf[0] = 0x13;
+ buf[1] = 0x61;
+ buf[2] = pnum;
+ buf[3] = (addr >> 8) & 0xff;
+ buf[4] = addr & 0xff;
+ addr += dl_download_data.app_size;
+ buf[5] = (addr >> 8) & 0xff;
+ buf[6] = addr & 0xff;
+ addr += dl_download_data.todo_size;
+ buf[7] = (addr >> 8) & 0xff;
+ buf[8] = addr & 0xff;
+ addr += dl_download_data.phone_size;
+ buf[9] = (addr >> 8) & 0xff;
+ buf[10] = addr & 0xff;
+ buf[11] = dl_download_data.num_apps;
+ buf[12] = dl_download_data.num_todos;
+ buf[13] = dl_download_data.num_phones;
+ buf[14] = dl_download_data.num_annivs;
+ buf[15] = 0x00;
+ buf[16] = 0x03;
+ } else {
+ memcpy(buf, dinfo, *dinfo);
+ buf[2] = 1;
+ buf[3] = dl_download_data.memory / (MAX_PCKT - 6);
+
+ if (dl_download_data.memory % (MAX_PCKT - 6))
+ buf[3]++;
+
+ buf[12] = dl_download_data.num_apps;
+ buf[13] = dl_download_data.num_todos;
+ buf[14] = dl_download_data.num_phones;
+ buf[15] = dl_download_data.num_annivs;
+ buf[4] = (addr >> 8) & 0xff;
+ buf[5] = addr & 0xff;
+ addr += dl_download_data.app_size;
+ buf[6] = (addr >> 8) & 0xff;
+ buf[7] = addr & 0xff;
+ addr += dl_download_data.todo_size;
+ buf[8] = (addr >> 8) & 0xff;
+ buf[9] = addr & 0xff;
+ addr += dl_download_data.phone_size;
+ buf[10] = (addr >> 8) & 0xff;
+ buf[11] = addr & 0xff;
+ buf[16] = 0x62;
+ buf[17] = dl_download_data.pre_notification_time / 5;
+ if (!buf[17])
+ buf[17] = 0xff;
+
+ if (wi->dl_device == DATALINK_70)
+ buf[1] = DATA_70;
+ }
dl_docrc(buf);
@@ -413,27 +411,26 @@ int dl_send_data(WatchInfoPtr wi, int type)
return ((*dl_error_proc)
("Can't write dinfo to tmp file."));
-#if 0
- pnum = 1;
-#else
- pnum = 2;
-#endif
+ if (wi->dl_device == DATALINK_50)
+ pnum = 2;
+ else
+ pnum = 1;
+
memcpy(buf, dspace, *dspace);
-#if 1
- buf[0] = 0x3;
-#endif
+ if (wi->dl_device == DATALINK_50)
+ buf[0] = 0x3;
- if (wi->dl_device == DATALINK_70)
+ if ((wi->dl_device == DATALINK_50) || (wi->dl_device == DATALINK_70))
buf[1] = DATA_70;
-#if 0
- buf[2] = 1;
- buf[3] = pnum++;
-#else
- buf[2] = pnum++;
-#endif
-
+ if (wi->dl_device == DATALINK_50) {
+ buf[2] = pnum++;
+ } else {
+ buf[2] = 1;
+ buf[3] = pnum++;
+ }
+
for (i = 0; i < dl_download_data.num_apps; i++)
{
ap = &dl_download_data.apps[i];
@@ -792,11 +789,10 @@ int dl_send_data(WatchInfoPtr wi, int type)
memcpy(buf, dspace, *dspace);
-#if 1
- buf[0] = 0x3;
-#endif
+ if (wi->dl_device == DATALINK_50)
+ buf[0] = 0x3;
- if (wi->dl_device == DATALINK_70)
+ if ((wi->dl_device == DATALINK_50) || (wi->dl_device == DATALINK_70))
buf[1] = DATA_70;
pnum = 1;
@@ -858,11 +854,10 @@ int dl_send_data(WatchInfoPtr wi, int type)
memcpy(buf, dspace, *dspace);
-#if 1
- buf[0] = 0x3;
-#endif
+ if (wi->dl_device == DATALINK_50)
+ buf[0] = 0x3;
- if (wi->dl_device == DATALINK_70)
+ if ((wi->dl_device == DATALINK_50) || (wi->dl_device == DATALINK_70))
buf[1] = DATA_70;
pnum = 1;
diff --git a/settime.c b/settime.c
index 3c89093..ab98990 100644
--- a/settime.c
+++ b/settime.c
@@ -117,6 +117,9 @@ int main( int argc, char ** argv)
if(argc==2)
{
+ if(!strcmp("-model50",argv[1])||!strcmp("-50",argv[1]))
+ wi = dl_init_watch(DATALINK_50);
+ else
if(!strcmp("-model70",argv[1])||!strcmp("-70",argv[1]))
wi = dl_init_watch(DATALINK_70);
else
@@ -130,7 +133,7 @@ int main( int argc, char ** argv)
wi = dl_init_watch(DATALINK_IRONMAN);
else
{
- printf("Usage: %s [ -model70 | -70 | -model70 | "
+ printf("Usage: %s [ -model50 | -50 | -70 | -model70 | "
"-150 | -model150 | -model150s | -150s |"
" -ironman]\nVersion "
"$Id: settime.c,v 1.13 2002/07/10 04:23:23 david Exp $\n", argv[0]);
diff --git a/setwatch.c b/setwatch.c
index 93a9364..eee146b 100644
--- a/setwatch.c
+++ b/setwatch.c
@@ -120,7 +120,8 @@ void Usage()
printf("Usage: datalink [watch type] [options] [datafile]\n");
printf
("watchtype (ironman is default, must be specified before other options)\n");
- printf(" -model70\t use if you have this watch\n");
+ printf(" -50\t use if you have this watch\n");
+ printf(" -model50\t use if you have this watch\n");
printf(" -70\t use if you have this watch\n");
printf(" -model70\t use if you have this watch\n");
printf(" -150\t use if you have this watch\n");
@@ -199,6 +200,7 @@ void Usage()
#define CHRON 0x400
/* All would be 0x755 */
+#define ALL50 0x07F
#define ALL70 0x07F
#define ALL150 0x1FF
#define ALLIRONMAN 0x653
@@ -228,6 +230,8 @@ int main(int argc, char **argv)
if (strcmp("-all", argv[1]) == 0)
{
+ if (type == DATALINK_50)
+ flags = ALL50;
if (type == DATALINK_70)
flags = ALL70;
if (type == DATALINK_150 || type == DATALINK_150S)
@@ -300,6 +304,10 @@ int main(int argc, char **argv)
output = BLINK_FILE;
else if (strcmp("-serial", argv[1]) == 0)
output = SER_BLINK;
+ else if (strcmp("-model50", argv[1]) == 0)
+ type = DATALINK_50;
+ else if (strcmp("-50", argv[1]) == 0)
+ type = DATALINK_50;
else if (strcmp("-model70", argv[1]) == 0)
type = DATALINK_70;
else if (strcmp("-70", argv[1]) == 0)
diff --git a/svgablink.c b/svgablink.c
index 185a2ca..3e30461 100644
--- a/svgablink.c
+++ b/svgablink.c
@@ -70,10 +70,14 @@ int main(int argc, char **argv)
|| strcmp(argv[1], "-model70") == 0)
type = DATALINK_70;
else
+ if (strcmp(argv[1], "-50") == 0
+ || strcmp(argv[1], "-model50") == 0)
+ type = DATALINK_50;
+ else
{
fprintf(stderr, "Unknown option %s.\n", argv[1]);
fprintf(stderr, "Usage: %s [ -ironman | -modelironman | -150 | -model150 | -150s | \n"
- "\t-model150s | -70 | -model70 ] datafile\n"
+ "\t-model150s | -70 | -model70 | -50 | -model50 ] datafile\n"
"Version $Id: svgablink.c,v 1.12 2002/07/10 04:27:08 david Exp $\n", argv[0]);
exit(-1);
}
|