Skip to content

Commit 7d52418

Browse files
author
dbonafilia
committed
Fixed the command IDs. Prior to this change the command IDs were using the 4 letter code to generate the ID rather than the reversed 4 letter code.
1 parent 05339fb commit 7d52418

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

filesync_protocol.txt

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ Message Format:
88
directory or symlink.
99
The command here is referred to as 'id' in the code and the 4-letter codes
1010
are prefixed by ID_, eg ID_STAT.
11+
The command IDs are found by reversing the 4 letter command codes and
12+
converting them to hexadecimal.
13+
1114

1215
STAT:
1316
request:
14-
u32 command = 'STAT' == 0x53544154
17+
u32 command = 'STAT' == 0x54415453
1518
u32 size = len(filename) < 1024
1619
u8 data[size] = filename (no null)
1720

@@ -24,58 +27,58 @@ Message Format:
2427

2528
LIST:
2629
request:
27-
u32 command = 'LIST' == 0x4C495354
30+
u32 command = 'LIST' == 0x5453494C
2831
u32 size = len(path) < 1024
2932
u8 data[size] = path (no null)
3033

3134
response:
3235
for each filename in listing of path:
3336
struct stat st = lstat(filename)
34-
u32 command = 'DENT' == 0x44454E54
37+
u32 command = 'DENT' == 0x544E4544
3538
u32 mode = st.st_mode
3639
u32 size = st.st_size
3740
u32 time = st.st_mtime
3841
u32 namelen = len(filename)
3942
u8 data[namelen] = filename
4043

4144
done (device -> host):
42-
u32 command = 'DONE' == 0x444F4E45
45+
u32 command = 'DONE' == 0x454E4F44
4346
u32[4] = 0
4447

4548
SEND:
4649
struct stat st = lstat(filename)
4750
request:
4851
fileinfo = sprintf(',%d', st.st_mode)
49-
u32 command = 'SEND' == 0x53454E44
52+
u32 command = 'SEND' == 0x444E4553
5053
u32 size = len(filename) + len(fileinfo) < 1024
5154
u8 data[size] = filename + fileinfo
5255

5356
repeated data command (host -> device):
54-
u32 command = 'DATA' == 0x44415441
57+
u32 command = 'DATA' == 0x41544144
5558
u32 size < (64 * 1024)
5659
u8 data[size] = file contents
5760

5861
finish command (host -> device):
59-
u32 command = 'DONE' == 0x444F4E45
62+
u32 command = 'DONE' == 0x454E4F44
6063
u32 timestamp = st.st_mtime
6164

6265
response (device -> host):
63-
u32 command = 'OKAY' == 0x4F4B4159 or 'FAIL' == 0x4641494C
66+
u32 command = 'OKAY' == 0x59414BF4 or 'FAIL' == 0x4C494146
6467
u32 size = 0 if 'OKAY' else len(fail_message)
6568
u8 data[] = fail_message
6669

6770
RECV:
6871
request:
69-
u32 command = 'RECV' == 0x52454356
72+
u32 command = 'RECV' == 0x56434552
7073
u32 size = len(filename)
7174
u8 data[size] = filename
7275

7376
repeated data response (device -> host):
74-
u32 command = 'DATA' == 0x44415441
77+
u32 command = 'DATA' == 0x41544144
7578
u32 size < (64 * 1024)
7679
u8 data[size] = file contents
7780

7881
finish response (device -> host):
79-
u32 command = 'DONE' == 0x444F4E45
82+
u32 command = 'DONE' == 0x454E4F44
8083
u32 size = 0
8184

0 commit comments

Comments
 (0)