Wednesday, January 7, 2009

Eye-Fi

Update: Perl standalone server that runs under linux for Eye-Fi card is linked here.

I bought an Eye-Fi sd-card a few weeks ago in a fit of laziness. The idea being I could put it in the SLR camera, and it would auto-upload images to the fileserver instead of me having to do the (very onerous..) walk to the server and plug it in.

I bought it in ignorance of the hugely proprietary nature of the card; Not sure I would have bought it knowing what I know now.

Part of the problem is that Eye-Fi's business model apparently includes charging large sums of money for trivial features. Thus, they go through all sorts of contortions to avoid you implementing said trivial features yourself rather than paying them.

Luckily, the protocol that the card uses on the WiFi side has been reverse engineered by others that have gone before me.

Chris helpfully wrote a little perl server that looked like it worked once apon a time. It appears that Eye-Fi have changed a few things since then so it took a little bashing to get it to work seamlessly with my card.

The two major changes are the certification calculation and the transfer mode.

It turns out that a different forumula is used to authenticate the client to the server. It's md5(mac addr, upload key, snonce) rather than the md5(mac address, cnonce, upload key) used in the other direction. Seems strange to me; Not sure this isn't a bug in the Eye-Fi code.

The other one is reflecting back the transfermode and transfermodetimestamp used in the session setup. Without this, the Eye-Fi refused to transfer more than one picture in a session.

Some minor changes include the server doing a fork for each client connect, and an unsuccessful attempt to verify that file checksum. The eye-fi card passes an MD5 sum along with the file on each upload, but it isn't a straight md5 of the tar file, nor of the embedded JPG file. I had a very quick poke, but the calculation wasn't immediately obvious to me so I wrote it off as a 'nice to have'.

Changed file can be found here. The upload key that's required in the file is stored in Settings.xml if you've used the windows app manager to configure the card. (Which I did: I failed to get it to do anything useful when run under wine).

So now I have it all working on my linux fileserver; When the camera comes into range and it's turned on, photos are automagically dropped into a spool directory, and a little daemon renames them into timestamped directories. So now I'm happy. Yay. :)

Ps: I would really have liked to get working the eyefi-config tools that Dave Hansen wrote but I simply couldn't get them to do anything beyond detect that there was a card in the USB adaptor. It appears that the protocol between the manager and the card has changed enough that the tools no longer work.

I had a quick bash trying to get the manager to run under wine so I could spy on the protocol, but after more than an hour of fighting wine the end wasn't in sight, so I moved onto other things.

1 comment:

pjwelsh said...

Thanks! This is great. No problem at all with Fedora 13. My goal is to make sure it works with CentOS 5.5 soon. Only oddity is Fedora 13 reports, "b35b7870169d9238ae7d56946ec2addf != dd7f4b1027e58734b77ef274d7b13db8; file failed?", but I still have files. No biggie. Thank you.