What's this?

Here, I'll be trying to keep track of developments as work continues on putting together a driver for gphoto2 for Polaroid's Xirlink-based digital cameras (the "Digital 320" and the "Fun! Flash 640SE", and perhaps others).

Nathan Stenzel has related site devoted to the Polaroid "Digital 320" (which seems to use essentially the same protocol) and the efforts to get it working for gphoto as well, which you may also find informative.

More news - 21-Feb-2001
Polaroid, it turns out, is exceptionally unhelpful about their products, at least, the digital ones. (Note that the polaroid digital products that DO work with gphoto apparently only do so because they use the same chipset as another manufacturer's camera, which somebody managed to figure out the protocol for on his own...)

So far, all requests from people for information about the camera protocol (and, in my case, a request for information about information about the protocol [no, that's not a typo - I asked them about who I should contact about getting information about the protocol information and/or permission to see it]) seem to be getting curt dismissal from Polaroid, inc. If nobody can make any sense of the data transfer format for these cameras, someone may have to contact Xirlink directly...

Okay, enough self-pity from me for now. On with the known details and sample data.

Sample Files

UPDATE - A more complete set of sample data (click here)
Here is a log of the data transfer of a picture (photo #1 in the camera at the time) and the .jpg file that resulted.

A "cleaned" version of the log (Thanks to Scott Fritzinger for sending me the parse-portmon.pl script!)
The "raw" log file from Portmon
This is the image that "PhotoMAX" produced after this exchange:

Protocol Info

Here's what's known about the protocol as of 11-January-2001, from Scott Fritzinger's posting to the gphoto-devel mailing list:
> Here is an updated version (Someone should save this to a file :):
> >> - Transport Layer
> >> All communication is done at 115200 over a serial connection.
> >> Timeouts should be set to 3 seconds (that's what the windows
> >> driver uses).
> >>
> >> - Packet structure:
> >> Command:
> >>
> >> 0xE6 0xE6 0xE6 0xE6 [COMMAND] [DATA] [CHECKSUM]
> >>
> >> Response:
> >> [RESPONSE] [DATA] [CHECKSUM]
> >>
> >> DATA is one of the following:
> >> 1) nothing (commands/responses)
> >> 2) PICTURE_NUMBER (255 pictures maximum?)
> >> 3) PICTURE_SIZE (4 bytes, little endian)
> >>
> >> CHECKSUM appears to be all packet bytes (with E6's) XOR'ed with
> >> 0xFFFF in little endian format (lower byte is before higher byte).
> >> So, if the packet sum was 0x0A, the checksum would be:
> >>
> >> 0xFFFF XOR 0x000A = 0xFFF5 -> F5 FF
> >>
> >> For higher values of packet sums, say 0x010A, it would be:
> >>
> >> 0xFFFF XOR 0x010A = 0xFEF5 -> F5 FE
> >>
> >> * Note: for command 0x0F, the checksum remains 0xFFFF. This
> >> sequence is all 1's, and is used as a break/wake-up. It is
> >>
> >> preceded by 8 total E6's (not just 4)
> >>
> >> - Commands:
- -- 0x00 (this looks like the "init/wake up" command to me - Sean)
> >>
> >> 0x01 Send Camera information (maker, firmware revision?)
> >> 0x02 Send Camera state information (number of pictures? quality
> >> setting?) *More details at bottom of this section! - added 22-Feb-2001
> >> 0x03 Number of pictures on camera
> >> 0x04 Get picture size, uses PICTURE_NUMBER
> >> 0x05 Get picture, uses PICTURE_NUMBER
> >>
> >> 0x06 ?Delete a single picturem uses PICTURE_NUMBER (try it!)
> >>
> >> 0x07 Delete all pictures
> >> 0x0A ?End of init (Lutz)
> >> 0x0C ?Checksum (Lutz got this one. it looks right. i was stumped :)
> >> 0x0F Wake-up (ping)
> >>
> >> - Responses:
> >> 0x00 Camera Information follows
> >>
> >> 0x01 ERROR (NAK)
> >>
> >> 0x02 ?Camera State Information follows
> >> 0x03 Number of pictures on camera (uses PICTURE_NUMBER)
> >>
> >> 0x04 ?Picture Data (some bytes after it?)
> >>
> >> 0x05 Camera On (pong)
> >> 0x06 Return the picture's size, uses PICTURE_SIZE
> >> 0x07 ?Return the picture's checksum
> >> 0x08 Deleting pictures
> >> 0x09 Deleting pictures completed

Some details of the responses of the PDC320 and the 640Se "Fun!" cameras to command #2...

(320 on top row, 640 on bottom row)
02 3F 01 40  00 F0 00 05  01 40 00 F0  00 05 00 50  00 50 00 00  07 D0 F0 E6
02 40 02 80  01 E0 00 05  02 80 01 E0  00 05 00 78  00 78 00 00  02 10 F1 F5
----- -----  ----- -----  ----- -----  ----- -----  ----- -----  ----- -----
  |     |      |     |      |     |      |     |      |     |      |     |
  A     B      C     D      E     F      G     H      I     J      K     L

A - Unknown. Chipset/protocol version? Xirlink model? (=576 for the 640se,
575 for the PDC320)

B - Horizontal pixels ("X") per picture (320 for the PDC320, 640 for the 640Se)

C - Vertical pixels ("Y") per picture (200 for the PDC320, 480 for the 640Se)

D - ? I'm guessing picture info of some kind, but what?
(bpp value for RGB?) See "G".

E - Horizontal pixels, again. Is one "original data" and the other a
"scaling" factor?

F - Vertical pixels, again. See above.

G - the mysterious "00 05" again. Being duplicated with the rest of the
picture info, I figure it's got to be something about the picture format.
Does "00 05" mean the data format? Something to do with the color values?

H - Unknown. (Decimal value 80 for the pdc320, 120 for the 640Se.
Some sort of bit mask? Binary works out to 1010000 for the 320
and 1110000 for the 640.)

J - Who knows.

K - (Maximum) packet size used to transfer picture data.

L - Response checksum.
---And some further notes regarding "get the picture" procedure:

> also, here is what i'm noticing about the picture transfer. (Sean, you
> might want to add this to the protocol specs).
>
> Here is the initial picture-download sequence:
>
> 0001 > E6
> 0001 > E6
> 0001 > E6
> 0001 > E6
> 0004 > 05 01 FA FE
> 0001 < 04
> 0004 < 00 00 00 02
> 0528 < FF C2 01 E0 02 80 F6 D8 0C 6A B3 47 29 50 B1 39 EA 7F E5
> 9B 80 E0 9F C5 98 0F A5 74 4F 92 CA 57 AB 28 3F 42 32 BF
> FB 21 3F FD 6A CA CF 0A 4F 62 41 CF 62 8D F2 8C 7F B8 63
> 38 EF 9F C2 BD BA 09 20 8D 25 59 59 02 C3 23 6E 2C 46 36
> 9F DE A1 C7 B2 B8 03 D4 83 E9 59 7A F3 D9 BE 93 72 D1 CC
> AB 88 5A 58 D9 65 65 56 68 4E 76 FF 00 75 89 1F 2E DE A4
> 64 0E D4 27 98 77 EF 03 61 56 5D D8 0C 41 21 B9 CE 3E 50
> 18 2E 1B 71 07 24 10 31 F3 35 89 52 8C 7F 85 E3 62 A4 1C
> 14 2D CF 1D F8 C1 E0 64 1E 4F 6A C7 F1 14 F6 27 47 9A 65
> 74 50 91 AC F1 38 DE 11 FC A6 CE CC AF CA C5 D4 63 6F 56
> 1F 85 79 B4 57 49 70 9E 7A CC D0 C7 68 0B 42 E9 3A E5 24
> 0D BD E5 8C
> 0002 < DA 85
> 0001 < 04
> 0004 < 00 01 00 03
> 0528 < 8F 17 E9 36 76 0D 7C D6 22 57 31 BE C9 D2 48 D8 A9 2A E0
> 40 59 81 25 25 CB 2F 94 AA AA A8 CE C2 3E 01 38 7A 5F C4
> [snip]
>
> E6's are written 1 at a time, command packet (0x05) is all in the same
> chunk. the response (0x04) is read in, then 4 bytes (the packet
> 'counter'/sequence bytes), then 528 bytes of data, then 2 bytes read in
> (checksum).
>
> notice how the 4 bytes after 0x04 are constantly increasing. it starts
> out at 00 00 00 02, then next one is 00 01 00 03, and so on. the second
> and fourth bytes are incremented by 1 with each packet (sequencing bytes).
>
(Note by Sean - I think the first two bytes are "packet number of this picture", while
the second two bytes are "total packets sent since the beginning of this 'session'" (e.g.
since initialization)
> after the last packet is received:
>
> 0001 > E6
> 0001 > E6
> 0001 > E6
> 0001 > E6
> 0004 > 0C 01 F3 FE
> 0001 < 07
> 0002 < 00 06
> 0006 < 00 54 81 2A 66 59
> 0002 < 1B 18
>
> "0C" appears to be requesting some info about picture #1. The response
> is 0x07, followed by 2 bytes (big-endian length of following data?),
> followed by 6 bytes of data, and then 2 byte checksum.