brought to you by Deparment of Optics & Acoustics

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.

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:

offsetsizetypecontents
0x001byteload type (0 = hardware info)

Request payload:

none

Response payload:

none

Download payload:

offsetsizetypecontents
0x0000256stringcamera manufacturer, right padded with zeros
0x0100128stringcamera serial number, right padded with zeros
0x0180128stringcamera build ID, right padded with zeros
0x0200128stringcamera software version, right padded with zeros
0x02804

load file (C2 00 01)

This command loads a file from the camera.

Parameters:

offsetsizetypecontents
0x001byteload type (1 = file)

Request payload:

offsettypecontents
0x0000stringpath to the file, null terminated

Response payload:

offsettypecontents
0x0000stringpath 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:

offsetsizetypecontents
0x001byteload type (2 = picture list)

Request payload:

none

Response payload:

none

Download payload:

offsetsizetypecontents
0x00004int1
0x00044intnumber of bytes per one item in the list
0x00084intnumber of records in one such item
then definition for each record (8 bytes)
0x004intrecord index (zero based)
0x044intrecord offset from the beginning of an item
then records for each item (currently 128 bytes known)
0x008stringfolder name postfix, right padded with zeros
0x088stringfile name prefix, right padded with zeros
0x104intfolder number
0x144intfile number
0x184
0x1C4
0x204
0x244
0x284intliked, 1 if picture marked favorite, 0 otherwise
0x2C4floatlast lambda (at which user focused image in camera)
0x3048stringpicture id, right padded with zeros
0x6028stringdate picture taken, ISO 8601 format, right padded with zeros
0x7C4intbinary 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:

offsetsizetypecontents
0x001byteload type (5 = picture)

Request payload:

offsettypecontents
0x0000stringpicture id followed by picture format digit, null terminated

Response payload:

offsettypecontents
0x0000stringpicture 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:

offsetsizetypecontents
0x00004inttotal size of the file, including this field
0x00044int
0x00084int
0x000C4inttotal number of frames
0x00104inttotal number of files
0x00144intwidth of frame
0x00184intheight of frame
then for each file
0x00004intlength 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:

offsetsizetypecontents
0x001byteload type (6 = calibration data)

Request payload:

none

Response payload:

none

Download payload:

offsetsizetypecontents
for each file in the set
0x00004intlength of the file
0x000432stringpath 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:

offsetsizetypecontents
0x001byteload type (7 = compressed raw picture)

Request payload:

offsettypecontents
0x0000stringpicture id, null terminated

Response payload:

offsettypecontents
0x0000stringpicture id, null terminated (same as in the request)

In case the requested picture is not found, the response contains no payload.

Download payload:

offsetsizetypecontents
0x00004intlength of metadata
0x00044intkind of length of the data, but not really
0x0008metadata 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:

offsetsizetypecontents
0x001byte(0 or 1)
0x014intoffset

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:

offsetsizetypecontents
0x001bytequery type (0 = content length)

Request payload:

none

Response payload:

offsetsizetypecontents
0x00004intcontent length

If no content was loaded, the returned length is zero.

query camera time (C6 00 03)

This command returns current camera time.

Parameters:

offsetsizetypecontents
0x001bytequery type (3 = camera time)

Request payload:

none

Response payload:

offsetsizetypecontents
0x00002shortyear
0x00022shortmonth
0x00042shortday
0x00062shorthours
0x00082shortminutes
0x000A2shortseconds
0x000C2shortmilliseconds

Milliseconds are currently not reported (the value is zero).

query battery level (C6 00 06)

This command returns camera battery level (as percentage).

Parameters:

offsetsizetypecontents
0x001bytequery type (6 = battery level)

Request payload:

none

Response payload:

offsetsizetypecontents
0x00004floatbattery level (percentage)

other commands

take a picture (C0 00 00)

This command triggers the camera shutter.

Parameters:

offsetsizetypecontents
0x001byteset type (0 = shutter)

Request payload:

none

Response payload:

none

set camera time (C0 00 04)

This command sets current camera time.

Parameters:

offsetsizetypecontents
0x001byteset type (4 = camera time)

Request payload:

offsetsizetypecontents
0x00002shortyear
0x00022shortmonth
0x00042shortday
0x00062shorthours
0x00082shortminutes
0x000A2shortseconds
0x000C2shortmilliseconds

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.