@@ -8,10 +8,13 @@ Message Format:
8
8
directory or symlink.
9
9
The command here is referred to as 'id' in the code and the 4-letter codes
10
10
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
+
11
14
12
15
STAT:
13
16
request:
14
- u32 command = 'STAT' == 0x53544154
17
+ u32 command = 'STAT' == 0x54415453
15
18
u32 size = len(filename) < 1024
16
19
u8 data[size] = filename (no null)
17
20
@@ -24,58 +27,58 @@ Message Format:
24
27
25
28
LIST:
26
29
request:
27
- u32 command = 'LIST' == 0x4C495354
30
+ u32 command = 'LIST' == 0x5453494C
28
31
u32 size = len(path) < 1024
29
32
u8 data[size] = path (no null)
30
33
31
34
response:
32
35
for each filename in listing of path:
33
36
struct stat st = lstat(filename)
34
- u32 command = 'DENT' == 0x44454E54
37
+ u32 command = 'DENT' == 0x544E4544
35
38
u32 mode = st.st_mode
36
39
u32 size = st.st_size
37
40
u32 time = st.st_mtime
38
41
u32 namelen = len(filename)
39
42
u8 data[namelen] = filename
40
43
41
44
done (device -> host):
42
- u32 command = 'DONE' == 0x444F4E45
45
+ u32 command = 'DONE' == 0x454E4F44
43
46
u32[4] = 0
44
47
45
48
SEND:
46
49
struct stat st = lstat(filename)
47
50
request:
48
51
fileinfo = sprintf(',%d', st.st_mode)
49
- u32 command = 'SEND' == 0x53454E44
52
+ u32 command = 'SEND' == 0x444E4553
50
53
u32 size = len(filename) + len(fileinfo) < 1024
51
54
u8 data[size] = filename + fileinfo
52
55
53
56
repeated data command (host -> device):
54
- u32 command = 'DATA' == 0x44415441
57
+ u32 command = 'DATA' == 0x41544144
55
58
u32 size < (64 * 1024)
56
59
u8 data[size] = file contents
57
60
58
61
finish command (host -> device):
59
- u32 command = 'DONE' == 0x444F4E45
62
+ u32 command = 'DONE' == 0x454E4F44
60
63
u32 timestamp = st.st_mtime
61
64
62
65
response (device -> host):
63
- u32 command = 'OKAY' == 0x4F4B4159 or 'FAIL' == 0x4641494C
66
+ u32 command = 'OKAY' == 0x59414BF4 or 'FAIL' == 0x4C494146
64
67
u32 size = 0 if 'OKAY' else len(fail_message)
65
68
u8 data[] = fail_message
66
69
67
70
RECV:
68
71
request:
69
- u32 command = 'RECV' == 0x52454356
72
+ u32 command = 'RECV' == 0x56434552
70
73
u32 size = len(filename)
71
74
u8 data[size] = filename
72
75
73
76
repeated data response (device -> host):
74
- u32 command = 'DATA' == 0x44415441
77
+ u32 command = 'DATA' == 0x41544144
75
78
u32 size < (64 * 1024)
76
79
u8 data[size] = file contents
77
80
78
81
finish response (device -> host):
79
- u32 command = 'DONE' == 0x444F4E45
82
+ u32 command = 'DONE' == 0x454E4F44
80
83
u32 size = 0
81
84
0 commit comments