Skip to content

Commit eee28da

Browse files
Merge pull request #13 from adafruit/tannewt-patch-2
Fixes and directory path tweak.
2 parents 8673cc2 + cca8081 commit eee28da

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,13 @@ Commands
104104

105105
Commands always start with a fixed header. The first entry is always the command number itself encoded in a single byte. The number of subsequent entries in the header will vary by command. The entire header must be sent as a unit so set the characteristic with the full header packet. You can combine multiple commands into a single write as long as the complete header is in the packet.
106106

107-
Paths use ``/`` as a separator and full paths must start with ``/``. Directory paths
108-
must end with ``/`` when provided as a full path.
107+
Paths use ``/`` as a separator and full paths must start with ``/``.
109108

110109
All numbers are unsigned.
111110

112111
All values are aligned with respect to the start of the packet.
113112

114-
Status bytes are ``0x01`` for OK and ``0x02`` for error. Other values for error may be used for specific commands.
113+
Status bytes are ``0x01`` for OK and ``0x02`` for error. Values other than ``0x01`` are errors. ``0x00`` should not be used for a specific error but still considered an error. ``0x05`` is an error for trying to modify a read-only filesystem.
115114

116115
``0x10`` - Read a file
117116
++++++++++++++++++++++
@@ -167,7 +166,7 @@ The header is four fixed entries and a variable length path:
167166
The server will repeatedly respond until the total length has been transferred with:
168167

169168
* Command: Single byte. Always ``0x21``.
170-
* Status: Single byte. ``0x01`` if OK. ``0x02`` if any parent directory is missing or a file.
169+
* Status: Single byte. ``0x01`` if OK. ``0x05`` if the filesystem is read-only. ``0x02`` if any parent directory is missing or a file.
171170
* 2 Bytes reserved for padding.
172171
* Offset: 32-bit number encoding the starting offset to write. (Should match the offset from the previous 0x20 or 0x22 message)
173172
* Truncated time: 64-bit number encoding nanoseconds since January 1st, 1970 as stored by the file system. The resolution may be less that the protocol. It is sent back for use in caching on the host side.
@@ -202,7 +201,7 @@ The header is two fixed entries and a variable length path:
202201
The server will reply with:
203202

204203
* Command: Single byte. Always ``0x31``.
205-
* Status: Single byte. ``0x01`` if the file or directory was deleted or ``0x02`` if the path is non-existent.
204+
* Status: Single byte. ``0x01`` if the file or directory was deleted, ``0x05`` if the filesystem is read-only or ``0x02`` if the path is non-existent.
206205

207206
**NOTE**: In version 2, this command now deletes contents of a directory as well. It won't error.
208207

@@ -223,7 +222,7 @@ The header is two fixed entries and a variable length path:
223222
The server will reply with:
224223

225224
* Command: Single byte. Always ``0x41``.
226-
* Status: Single byte. ``0x01`` if the directory(s) were created or ``0x02`` if any parent of the path is an existing file.
225+
* Status: Single byte. ``0x01`` if the directory(s) were created, ``0x05`` if the filesystem is read-only or ``0x02`` if any parent of the path is an existing file.
227226
* 6 Bytes reserved for padding.
228227
* Truncated time: 64-bit number encoding nanoseconds since January 1st, 1970 as stored by the file system. The resolution may be less that the protocol. It is sent back for use in caching on the host side.
229228

@@ -275,8 +274,9 @@ The header is two fixed entries and a variable length path:
275274
* New Path: UTF-8 encoded string that is *not* null terminated. (We send the length instead.)
276275

277276
The server will reply with:
277+
278278
* Command: Single byte. Always ``0x61``.
279-
* Status: Single byte. ``0x01`` on success or ``0x02`` on error.
279+
* Status: Single byte. ``0x01`` on success, ``0x05`` if read-only, or ``0x02`` on other error.
280280

281281
**NOTE**: This is added in version 4.
282282

@@ -297,6 +297,8 @@ Version 3
297297
Version 4
298298
---------
299299
* Adds move command.
300+
* Adds 0x05 error for read-only filesystems. This is commonly that USB is editing the same filesystem.
301+
* Removes requirement that directory paths end with /.
300302

301303
Contributing
302304
============

0 commit comments

Comments
 (0)