the commands reference
This page contains information relevant to the firmware v1.2.2, build 208.
warning
This page describes communication methods by which you can damage your camera. I repeat that information herein presented is neither official nor confirmed and 3rd party communication with the camera explicitly breaks your warranty. I am not responsible for any consequences either, even if used as described.
You might find the hard reset instructions useful once the camera (or wifi) stops working.
The camera accepts connections on TCP ports 5678 and 5679. As already noted, both requests and responses contain 28 bytes of header, optionally followed by payload data (content).
AF 55 AA FA LE LE LE LE FL FL FL FL CM CM (magic number, content/buffer length, flags, command)
PA PA PA PA PA PA PA PA PA PA PA PA PA PA (parameters)
__ __ __ __ __ __ __ __ __ __ __ __ __ __ (optional payload)
All numbers are little endian.
- length is 32-bit integer, representing either the numbers of bytes of payload attached, or the number of bytes of the receiving buffer (i.e. maximum allowed payload length of the response), depending on flags.
- flags two LSB observed only:
xxxx xxx0 length is length of the payload
xxxx xxx1 length is length of the buffer, no payload in the request
xxxx xx0x message is request
xxxx xx1x message is response
- command is 16-bit integer and determines the action the camera will execute and format of parameters and payload. Responses preserve the command and parameter values of requests.
- Each command has different number of parameters, not necessarily aligned. Unused bytes are zero.
- When payload is present, the length value contains its length in bytes. Format of the payload is different for each command.
Follows a list of commands with pretty clear meaning and syntax. Should you be interested in a command not mentioned below, feel free to contact me to discuss the current findings. Command names are first guess and subject to change.
load command (C2 00)
load hardware info (C2 00 00)
This command loads basic information about the camera.
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | load type (0 = hardware info) |
Request payload:
none
Response payload:
none
Download payload:
offset | size | type | contents |
0x0000 | 256 | string | camera manufacturer, right padded with zeros |
0x0100 | 128 | string | camera serial number, right padded with zeros |
0x0180 | 128 | string | camera build ID, right padded with zeros |
0x0200 | 128 | string | camera software version, right padded with zeros |
0x0280 | 4 | | |
load file (C2 00 01)
This command loads a file from the camera.
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | load type (1 = file) |
Request payload:
offset | type | contents |
0x0000 | string | path to the file, null terminated |
Response payload:
offset | type | contents |
0x0000 | string | path to the file, null terminated (same as in the request) |
In case the requested file is not found, the response contains no payload.
Download payload:
Contents of the file.
load picture list (C2 00 02)
This command loads a list of pictures available on the camera.
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | load type (2 = picture list) |
Request payload:
none
Response payload:
none
Download payload:
offset | size | type | contents |
0x0000 | 4 | int | 1 |
0x0004 | 4 | int | number of bytes per one item in the list |
0x0008 | 4 | int | number of records in one such item |
then definition for each record (8 bytes) |
0x00 | 4 | int | record index (zero based) |
0x04 | 4 | int | record offset from the beginning of an item |
then records for each item (currently 128 bytes known) |
0x00 | 8 | string | folder name postfix, right padded with zeros |
0x08 | 8 | string | file name prefix, right padded with zeros |
0x10 | 4 | int | folder number |
0x14 | 4 | int | file number |
0x18 | 4 | | |
0x1C | 4 | | |
0x20 | 4 | | |
0x24 | 4 | | |
0x28 | 4 | int | liked, 1 if picture marked favorite, 0 otherwise |
0x2C | 4 | float | last lambda (at which user focused image in camera) |
0x30 | 48 | string | picture id, right padded with zeros |
0x60 | 28 | string | date picture taken, ISO 8601 format, right padded with zeros |
0x7C | 4 | int | binary encoded rotation, 6 = 270°, 3 = 180°, 8 = 90°, 1 = 0° (counter-clockwise) |
load picture (C2 00 05)
This command loads a picture from the camera.
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | load type (5 = picture) |
Request payload:
offset | type | contents |
0x0000 | string | picture id followed by picture format digit, null terminated |
Response payload:
offset | type | contents |
0x0000 | string | picture id followed by picture format digit, null terminated (same as in the request) |
In case the requested picture is not found, the response contains no payload.
Download payload:
4 bytes for length (int) followed by that amount of bytes containing the picture data, depending on the value of picture format digit.
When picture format = '0', data contains a single JPEG file. The camera shoots in RAW+JPEG configuration. This is the JPEG part of it with compressed, color microlens image (pretty useless). Data is equivalent to downloading I:\DCIM\###PHOTO\IMG_####.JPG file.
When picture format = '1', data contains a single RAW file. The camera shoots in RAW+JPEG configuration. This is the RAW part of it. Data is equivalent to downloading I:\DCIM\###PHOTO\IMG_###.RAW file, and to the Raw Sensor Data component in the raw.lfp file.
When picture format = '2', data contains a single TXT file with metadata about the picture, including debug metadata which are otherwise inaccessible. Data is equivalent to downloading I:\DCIM\###PHOTO\IMG_###.TXT file.
When picture format = '3', data contains a single thumbnail image with dimensions of 128×128 pixels. It is raw data, 16 bits per pixel, 4:2:2 YUY2 format. Data is equivalent to downloading I:\DCIM\###PHOTO\IMG_###.128 file.
When picture format = '4', data contains prerendered JPEG files with dimensions of 320×1280 pixels, each containing 4 frames of 320×320 pixels at different lambda. Data is equivalent to downloading I:\DCIM\###PHOTO\IMG_###.STK file and is laid as follows:
offset | size | type | contents |
0x0000 | 4 | int | total size of the file, including this field |
0x0004 | 4 | int | |
0x0008 | 4 | int | |
0x000C | 4 | int | total number of frames |
0x0010 | 4 | int | total number of files |
0x0014 | 4 | int | width of frame |
0x0018 | 4 | int | height of frame |
then for each file |
0x0000 | 4 | int | length of the file |
0x0004 | | | (file contents) |
Picture data are not guaranteed to exist even for valid picture IDs. In that case, payload for all picture formats contains only 4 bytes for the length (= 0).
Warning: requesting other picture formats causes the camera to halt.
load calibration data (C2 00 06)
This command loads the calibration data minimum (set of files).
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | load type (6 = calibration data) |
Request payload:
none
Response payload:
none
Download payload:
offset | size | type | contents |
for each file in the set |
0x0000 | 4 | int | length of the file |
0x0004 | 32 | string | path to the file (on camera), right padded with zeros |
then for each file in the set, in the same order |
0x0000 | | | (file contents) |
load compressed raw picture (C2 00 07)
This command loads a picture in the rawPackedJpegCompressed representation.
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | load type (7 = compressed raw picture) |
Request payload:
offset | type | contents |
0x0000 | string | picture id, null terminated |
Response payload:
offset | type | contents |
0x0000 | string | picture id, null terminated (same as in the request) |
In case the requested picture is not found, the response contains no payload.
Download payload:
offset | size | type | contents |
0x0000 | 4 | int | length of metadata |
0x0004 | 4 | int | kind of length of the data, but not really |
0x0008 | | | metadata of specified length followed by the data (a JPEG file) |
download command (C4 00)
This command retrieves the content loaded by a load command above.
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | (0 or 1) |
0x01 | 4 | int | offset |
Request payload:
none
Response payload:
Loaded content (see above commands for the data format), starting at specified offset. If content length is smaller than suggested buffer size, the response header contains the actual returned length. If it is larger, only the requested amount will be specified. The offset parameter can be used to retrieve the rest.
Specifying offset larger than content length (or not loading any content ahead) will result in no payload in the response. You can get the total content length using the query command as described below.
Warning: do use limited buffer size and the offset parameter. Requesting a buffer size that the camera cannot allocate will cause it to halt. Current software uses 2 MB buffer size.
query command (C6 00)
query content length (C6 00 00)
This command returns the loaded content length.
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | query type (0 = content length) |
Request payload:
none
Response payload:
offset | size | type | contents |
0x0000 | 4 | int | content length |
If no content was loaded, the returned length is zero.
query camera time (C6 00 03)
This command returns current camera time.
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | query type (3 = camera time) |
Request payload:
none
Response payload:
offset | size | type | contents |
0x0000 | 2 | short | year |
0x0002 | 2 | short | month |
0x0004 | 2 | short | day |
0x0006 | 2 | short | hours |
0x0008 | 2 | short | minutes |
0x000A | 2 | short | seconds |
0x000C | 2 | short | milliseconds |
Milliseconds are currently not reported (the value is zero).
query battery level (C6 00 06)
This command returns camera battery level (as percentage).
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | query type (6 = battery level) |
Request payload:
none
Response payload:
offset | size | type | contents |
0x0000 | 4 | float | battery level (percentage) |
other commands
take a picture (C0 00 00)
This command triggers the camera shutter.
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | set type (0 = shutter) |
Request payload:
none
Response payload:
none
set camera time (C0 00 04)
This command sets current camera time.
Parameters:
offset | size | type | contents |
0x00 | 1 | byte | set type (4 = camera time) |
Request payload:
offset | size | type | contents |
0x0000 | 2 | short | year |
0x0002 | 2 | short | month |
0x0004 | 2 | short | day |
0x0006 | 2 | short | hours |
0x0008 | 2 | short | minutes |
0x000A | 2 | short | seconds |
0x000C | 2 | short | milliseconds |
Response payload:
New camera time, same format as in request. Note that using this command can be logged to I:\RTCERROR.LOG file on the camera.
Milliseconds are currently not reported (the value is zero), but the written value is used.
the communicator
You can easily try the commands from your computer now — use the communicator.
Disclaimer: Jan Kučera and miloush.net are not affiliated with or endorsed by Lytro, Inc.