Saturday, December 29, 2007

More about control files

When I say that the files are 16k in size, I mean that they appear to be 16k on the filesystem. Interestingly, the Eye-Fi Manager also seems to write to them only in 16k chunks. It never writes partial bits of the files. Also, it's good to note that you need to do synchronous file i/o to the files when doing things to them.

Operating systems cache access to files so that if you write to them twice in quick succession, it sometimes only makes one write to the actual disk. It can take seconds or minutes for a filesystem operation to get out to the disk. The Eye-Fi manager ensures that it does synchronous i/o by using some fcntl() calls on OSX. I'm not sure what it does in Windows. I'm using fsync() on the file descriptors in Linux to get the same effect.

Wednesday, December 26, 2007

New EyeFi Card

I got an EyeFi card for Christmas. It's a wonderful little device. But, sadly, it doesn't come with any software for Linux. I intend to see what I can do to change that. I'd at least like to be able to scan for and add new access points without rebooting into Windows. I'd also like to be able to have it dump its pictures on my Linux PCs instead of uploading to other servers, but that's a way down the line.

The card itself has a number of files on it:

$ find /media/EYE-FI/EyeFi/

These are how the EyeFi Manager communicates with the card. I think the filenames stand for REQuest or ReSPonse (for the first part of the filename) and Message or Code (for the last character). They are each apparently 16k in size.

From what I can glean so far, the manager starts by making sure the files are there, then zeroing them out. It then writes a command to reqm. I think those commands are single characters because the log has things like this in them:

[00:19] Host control channel received command 'o' (0x6f).

It also writes a character after those command characters, and that's where it starts to get murky. I'll post some more about that tomorrow. In the mean time, if anyone knows anything more about this card, please contact me.