Skip to content

Automatic Wireless Uploading with the Eye Fi

tz1 edited this page Sep 13, 2010 · 3 revisions

An eye-fi (http://www.eye.fi) is an SD card which has an onboard wireless connection that can upload photos or movies. Some versions of the card can do more, or do more (raw) formats, but it is generally limited and intended for pics or movies to end up on one of the photo sharing sites. These are generally formatted as FAT32 since they are SDHC cards, but the 2GB apparently work as FAT16.

To use them with a micro SD slot device, you need an adapter, such as: http://www.dealextreme.com/details.dx/sku.27001

The rest is simply playing by the rules for the camera filesystem, starting with creating a DCIM directory off the root:

http://en.wikipedia.org/wiki/Design_rule_for_Camera_File_system

There are also limits from the FAT filesystem itself, e.g. the number of directory entries.

For files to be uploaded, they must be valid JPEGs and there seems to be some minimal size/content, however JPEGs created by the serial camera all seem to upload (even nearly blank ones), and you can have a valid single black pixel with whatever you want in the comment metadata. So taking a minimal http://www.techsupportteam.org/forum/digital-imaging-photography/1892-worlds-smallest-valid-jpeg.html jpeg, you can put any information and if it is above a threshold of size (around 30k for this from tests), the EyeFi will upload it. Then you just need to strip out the comments and you have the file.

For example, here are enpeg.c and depeg.c – they are “unix filters” so read from stdin and write to stdout.

enpeg.c:


#include <stdio.h> static unsigned char dotjpg0[20] = { 0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x48, 0x00, 0x48, 0x00, 0x00 };

static unsigned char dotjpg9[] = {
0xFF, 0xDB, 0×00, 0×43, 0×00,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xC2, 0×00, 0×0B, 0×08, 0×00, 0×01, 0×00,
0×01, 0×01, 0×01, 0×11, 0×00,
0xFF, 0xC4, 0×00, 0×14, 0×10, 0×01,
0×00, 0×00, 0×00, 0×00, 0×00, 0×00, 0×00, 0×00,
0×00, 0×00, 0×00, 0×00, 0×00, 0×00, 0×00, 0×00,
0xFF, 0xDA, 0×00, 0×08, 0×01, 0×01, 0×00, 0×01,
0×3F, 0×10
};

static unsigned char textbuf65536 = { 0xff, 0xfe };

int main(int argc, char *argv[])
{
int len;
fwrite(dotjpg0, 1, sizeof(dotjpg0), stdout);

for (;;) { len = fread(&textbuf4, 1, 65532, stdin); if (len <= 0) break; // fprintf(stderr, “add %d\n”, len); len += 2; textbuf2 = len >> 8; textbuf3 = len; fwrite(textbuf, len + 2, 1, stdout); } fwrite(dotjpg9, 1, sizeof(dotjpg9), stdout);

}



depeg.c:

#include <stdio.h>

static unsigned char textbuf65536;

int main(int argc, char *argv[])
{
int len;

fread(textbuf, 1, 20, stdin); for (;;) { if (1 > fread(textbuf, 1, 2, stdin)) break; if (textbuf0 != 0xff || textbuf1 != 0xfe) break; fread(textbuf, 1, 2, stdin); len = textbuf0; len <<= 8; len |= textbuf1; fread(textbuf, len – 2, 1, stdin); fwrite(textbuf, len – 2, 1, stdout); }

}


Clone this wiki locally