Thursday, April 2, 2009

Eye Fi Standalone Server Version 2.0

I'd like to release an updated version of the Eye Fi standalone server in python that I have been working on. This version should work on Linux, Mac OS X, Windows, Solaris, or wherever else you can load a Python interpreter. As always I love comments so if you are using this feel free to e-mail me or drop me a note!

Source on GitHub: http://github.com/tachang/EyeFiServer

Download (zip): http://www.darkeneddesire.com/EyeFiServer/2.0/EyeFiServer-v2.0.zip

I know some people just like to browse around the source without having to download stuff (I'm one of those people):

http://www.darkeneddesire.com/EyeFiServer/2.0/Release/

This new version has the following features:
  • The server can now execute an arbitrary command on each uploaded photo. This is a very dangerous feature and should be used with caution. On the other hand it is also very cool. You can have the server FTP files, display them using an image viewer, or even run sorting programs on the images.
  • Improved security: the server now generates its own nonces instead of using one that was hard coded. The nonce is based on the random library provided by python. The INTEGRITYDIGEST field is also checked.
  • Ability to read settings from a configuration file (there is a included DefaultSettings.ini for reference). The file allows you to configure the listen port, console output, logging, download location, and execute on upload, and upload key.
Some other notable improvements but not really features are the addition of regression tests and support for Python 2.5. The regression tests are interesting since I run them against the official Eye-Fi Manager to make sure my behavior is a close match.

Getting usage information as to how to specify a configuration file:

C:\EyeFiServer\Release>EyeFiServer.py -h
Usage: EyeFiServer.py [options]

Options:
-h, --help show this help message and exit
-c CONFIGFILE, --config=CONFIGFILE
Path to configuration file (example in
DefaultSettings.ini)

Actually specifying a configuration file:
C:\EyeFiServer\Release>EyeFiServer.py -c DebugSettings.ini

192 comments:

Levi said...

Is there a way to have the pictures deleted after they are uploaded?

Jeff Tchang said...

Deleted from the computer running the server or deleted from the memory card?

There is no way to delete it from the memory card.

Levi said...

Yeah. The card. That stinks.

kevin said...

I will be loading version 2 today. This will solve many issues I am having with using the Eye-fi card for our emergency first responder aerial surveillance system. Thank you Jeff!
Kevin

jwgorman said...

I have an application where a device logs data in .CSV format onto an SD card. I would like to use a EyeFi card instead, and have these text files beamed up somewhere. is this possible with your software? thanks!

Jeff Tchang said...

@jwgorman That is not possible without a firmware hack to the card.

Andrew said...

Right now, there is an option to run a program after the upload is complete. This is very handy.

How difficult would it be to call a program when the upload starts? (Something that could be used to show a notification that a photo is starting the upload, or perhaps do something else.)

Jeff Tchang said...

@Andrew It's possible but not sure why you'd want to do so. The upload is in a tar format and may or may not complete. What kind of use case are you thinking about?

Andrew said...

The official Eye-Fi software shows a preview of the image as it is loading. I was thinking about having a similar thing under Linux. (Even if it just says 'An image is uploading' and doesn't have a thumbnail to show for it.)

Jeff Tchang said...

I see. I have a TODO in the code actually:

# TODO: Implement some kind of visual progress bar

You will see that the code is commented out right now because I am not entirely sure how I want to implement this feature.

jwgorman said...

on another note, question about SDIO - do you think device would present information about sd card disk writes on the COM port as serial events?

http://www.spectec.com.tw/sdrs232.htm

jwgorman said...

just for context, my application is this - trying to get the live data recorded (usually) on an sd card by this device:

http://english.ivt-hirschau.de/content.php?parent_id=CAT_64&doc_id=DOC_220

it is a solar controller that makes a file called solarlog.txt and it's in comma or tab delimited format on the SD card. I would like to intercept that file, and log it directly into a database. that software we have already written to accomodate a number of controllers - here is the site:

http://www.solarnetwork.net/

thanks, John

Andrew said...

Is it possible to use this with multiple EyeFi cards?

Jeff Tchang said...

@Andrew This will probably not work out of the box with multiple Eye-Fi cards. I only own one card so can't really test.

Bob H said...

I've been considering buying an Eye-Fi at some point, but the current closed nature of the device has made me a little unsure so far (at the price).

However your server looks very interesting. Looking at something Dave Hansen said had me wondering, what about a PythonCE implementation for mobile phones?

Bob

Jeff Tchang said...

@Bob H

I'd love to port this to mobile phones but the reason this server works is because the Eye-Fi card connects to an access point. There are exactly zero phones on the market place right now that support acting as an access point.

The only phone I know if that even has a remote possibility of this is the OpenMoko phone in which you'd have to write drivers to have it function in AP mode. This phone is really on its deathbed though because of Android.

matt said...

You're a clever dude Jeff. I'm Eying the Eye-Fi to help streamline data entry for out non-profit organisation. We receive donated furniture which we data enter into a web-based inventory management app. Each item requires a (reasonably high-res) photograph which we currently have to download to a fileshare from the camera and at a later time painstakingly associate each one with its inventory record via the web interface (this is stupid). I'm looking for ways to get a decent digital camera to provide an image to a web applicaiton in one hit right at the point of data entry. Can you see a way forward using Eye-Fi... or even have any suggestions for things I could investigate?

Andrew said...

@matt

Depending on the resolution of the image (along with other factors, like proximity to the wireless access point since the eye-fi's wireless isn't as strong as a normal laptop's wireless) it may take up to a couple minutes before the image is fully uploaded (with either Jeff's server or the official one). This may or may not affect your entry of data. (Perhaps write it so that it associates the photo after you add the details based on exif time or something.)

Jeff Tchang said...

@Matt

Here is a scenario that could work:

1. User brings up the web-based inventory management app.
2. User clicks a button and the web based app waits for an image.
3. When image is uploaded the web based application associates the image to the correct inventory description.

How this would happen technologically:

I own a small netbook (an MSI Wind). One of the best things about this netbook is that it comes with an RALink wireless card that supports access point mode in windows. What this means is that you can essentially have a mobile access point. What I did was setup this netbook as an access point and run my Eye-Fi software. When the EyeFi card in my camera starts up it connects to the netbook and starts uploading photographs.

My scenario would be having a person walking around with the netbook and camera. They would bring up the inventory management app and click a button when they were ready to upload a photograph. They would then snap a quick photo. My software would capture it within 1-2 minutes and associate it to the inventory item. I imagine this use case would work because the person would be filling out details about the item as they were waiting for the photograph to finish transferring.

The pluses to this is that you can do any sort of photograph transformation inline. Photos are never deleted off the SD disk so you can do it manually later if you need to.


I would be interested in working on this as a side project (sounds like fun). If you want some help feel free to e-mail me! :)

cochran242 said...

The Windows Mobile phone can work as an access point. You just need to install a piece of software called wmwifirouter. http://www.wmwifirouter.com/

On a side note I tried your script on my linux box and it starts up but does not receive any files. I opened the firewall port and still no love. I double checked the upload key. How does the card know to send the pics to the server? Is there anything else I should do?

Jeff Tchang said...

@cochran242

Please post a log or enable logging.

cochran242 said...

Thanks for helping!!! It would noy let me paste in my log so I have uploaded it here:
http://rustyfenders.com/Log.txt

Thanks again

Jeff Tchang said...

@cochran242

Basically what is happening is that the card does not trust the server. This usually happens because the UploadKey is incorrect.

Are you sure you got the right upload key?

cochran242 said...

Ok, I have uploaded the Settings.xml file from my windows box here: http://rustyfenders.com/settings.txt
and I have uploaded a new log here without editing (looked like it reattempted):
http://rustyfenders.com/Log.txt

Again, thank you for your time

Jeff Tchang said...

@cochran242

Did you recently upgrade the firmware? What kind of card do you have? EyeFi might have changed something and I just didn't pick up on it. It doesn't seem like anything is blatantly wrong. Odd.

Do you have chat? Go ahead and e-mail me directly your screen name. My e-mail is on this site.

-Jeff

Jeff Tchang said...

Ack. I just saw that Eye-Fi released a new firmware. Need to check it. Probably the cause.

Jeff Tchang said...

The new Eye Fi firmware adds an option called "Relayed Uploads". If this is enabled the Eye-Fi server on this site will not work out of the box. The easy fix is to disable it. I will release a new version shortly that will take care of all this.

The detailed answer is that the relayed uploads feature adds a new transfermode. This transfermode, which happens to be 3, is sent by the card to the server. The problem is I hardcoded a transfermode of 2. I just need to clean up the code and make sure I send back whatever transfermode the card sends me.

sorboimages said...

Is there a way to have the server only upload images from the eye-fi card that have been "tagged" protected in camera?
That's the biggest problem using an eye-fi card is it's too slow when uploading all the images, but if it could only upload selected images it would really be useful.
Thanks for all your work.

Rob

sorboimages said...
This comment has been removed by the author.
sorboimages said...
This comment has been removed by the author.
Andrew said...

@sorboimages Since the sending of images is completely handled by the card and not the server, that wouldn't be something that this could do. I'd recommend checking the official Eye-Fi forums for your suggestion (or posting it if you can't find it) since it would have to be done on the card's firmware.

sorboimages said...

@Andrew Yes, I was just wondering if the server could accept or reject a download based on the "tagged" meta data or is that just not doable?
Thanks for your reply.

FP said...

i dream of this thing on a synology NAS ...
fred

Jeff Tchang said...

If you are getting the following error:

TypeError: stat() argument 1 must be (encoded string without NULL bytes), not str

then you are most likely running Python 2.5.1 or less. This error is the result of a bug in the tarfile library that I use. In Python 2.5.2 or later this is fixed.

Link to the issue where people talk about it on the mailing list:
http://mail.python.org/pipermail/tutor/2008-July/063075.html

-Jeff

eeyago said...

Jeff, I was hoping to use your setup out in the field, to beam pictures directly to my laptop via AP, with no Internet connection available. Is this possible? If so, I am unable to get it to work that way. Looks like the script is making calls to specific web sites. Help!

eeyago said...

Jeff, I was hoping to use your setup out in the field, to beam pictures directly to my laptop via AP, with no Internet connection available. Is this possible? If so, I am unable to get it to work that way. Looks like the script is making calls to specific web sites. Help!

Jeff Tchang said...

@eeyago

What seems to be the problem? The script does not call out to any websites.

In general to debug I need to know what your setup. Also the logs would be a great help.

eeyago said...

@Jeff,
The log file is located here:
http://www.crazyclix.com/temp/EyeFiServer.log

At home, my network is WEP secure connected to the Net and the upload works fine. I bought a cheap router (Dynex) and setup the wireless config the same, but fails. However, as stated previously, this new router is not connected to the Net.

Thanks and look forward to what you find out. PS: Server ver 2.0.4.

Jeff Tchang said...

@eeyago

The Eye-Fi card does seem to find the server but doesn't want to upload to it. Double check that you have relayed upload disabled (using the standard Windows tool). Make sure you have it configured to upload to a computer (you can specify any destination).

Let me know what you find.

cochran242 said...

This script is working great. I have one feature request. If this script could place files in subfolders based on the picture taken date. Thanks!

eeyago said...

@Jeff,
Apparently, I was using an older version of your code. I upgraded to the latest version, but still unable to successfully connect. Log in same place: http://www.crazyclix.com/temp/EyeFiServer.log

The relayed upload is disabled thru the EyeFi config online, but don't know where to check otherwise. Please advise.

Thanks!

William said...

Would anyone care to write a short tutorial on how to get this up and running for those of us who aren't computer experts? It looks like a great idea, and I'd love to try it, but I don't really know how Python works, or how to get up and running so that I can transfer photos via ad-hoc.

chairman said...

is it possible to use eye-fi standalone server and used relayed upload?

Or have something running on a server on the internet and whenever I take a picture and get in coverage for a public access point the pictured would be uploaded to my own server. Either directly or via eye.fi or something like that...

Elo & Fred said...

hi,
because you now well know the eye-fi, do you know if there is a way to configure it to use it like on wayport but not on wayport ? see : http://f28f2.tk and http://n73aq.tk
regards

Guillaume Filion said...

Is there any of you using this on an iphone?

I managed to install python using Cydia on my jailbroken iphone, then connect to the iphone using ssh and download and run the Eye Fi Standalone Server, but I don't have a Eye-Fi card, so I don't know if it *really* works! ;)

It would be nice since it would allow to transfer the photos directly on the iphone. Once it's done, then the iphone becomes a great photo manager. It can even post pictures on the Net using the 3G network!

I guess I'll buy an Eye-Fi card and see for myself... :)

gifford said...

Do you know how the eye-fi card finds the computer running the server ? I would like to run the server on a completely different computer and expect that it will not "just work" ...

Jeff Tchang said...

@gifford

The Eye-Fi card actually does a scan of the subnet in which it obtains the DHCP address.

Therefore running the Eye-Fi server on a different computer really will "just work"!

Andrew said...

@gifford

In addition to Jeff's comment, make sure you only have one eye-fi server running on the network.

gifford said...

@{Jeff Tchang, Andrew}

Thanks for the insight! I guess Eye-Fi actually makes it pretty easy.

Daniel said...

@Jeff Tchang. I've got a few questions about your standalone server:

1. Will it work for any file type or just images and video?
2. If not, is there a way to disable the code that prevents it from checking the file type or can we make any file look like the correct file type with?

I appreciate any help.

Thanks,

Daniel

Daniel said...

Can I embed your code into another application?

Thanks again!

Andrew said...

@Daniel It should work with any type of file that the Eye-Fi card sends. This software has no control over what the card does or does not send.

Daniel said...

Thanks, I'm guessing that it's limited to image and video files since that's what the Eye-fi card would send. Has anyone tried transferring a PDF file or something completely different from a media file?

Thanks again.

Jonathan said...

Hmmm... I can run old script fine but with new script, when receiving image I get:
File "/home/jon/nbprojects/NewPythonProject/src/configobj.py", line 580, in __getitem__
val = dict.__getitem__(self, key)
KeyError: 'Card'

I am running Python 2.6.2 and relevant config is same directory and I believe correct.

Not sure what my problem is but just wanted to say I really appreciate writing / releasing this software.

Jeff Tchang said...

@Jonathan

What do the logs say? More than likely you didn't specify a configuration file or you forgot to edit it and make sure there is a [Card] section.

-Jeff

Jonathan said...

Oops forgot to specify config file - my bad! Yeah going fine.
Would be nice idea to put out help message if no parameters specified?

Thanks.

Daniel said...

Hi Jeff,

Can multiple Eye-Fi cards download at the same time to the same computer or does it only allow for one Eye-Fi card to download at a time?

Thanks,

Daniel

Andrew said...

@Daniel: The code included with this post does not support more than one card. I have altered the code to allow for multiple cards. I'll try to get it up in a few hours. (Running out now, and will have to find it.)

Daniel said...

Thanks !!! I appreciate it.

Daniel said...

Hi Andrew,

Can you tell me where I can find the code that allows the multiple cards to download simultaneously?

Thanks,

Daniel

Andrew said...

@Daniel

Here are the changes that I made to the original code:

http://sandbox.ahotw.com/eye-fi/multipleCards.txt

Jeff Tchang said...

@Daniel

Andrew e-mailed this a while back but I never actually incorporated the change. Just have been too busy with other stuff. That said the project is on github if anyone wants to work on it. Here is the change:




Config File:
In the section [Card], for each card put the mac address and the upload key (mac address is also in the file where the uploadkey is found).

[Card]

[[001856xxxxxx]]
UploadKey=c686e547e3728c63a8f78729c1592757

[[001856xxxxxx]]
UploadKey=c686e547e3a8f78729c15927573728c6


EyeFiServer.py:
396c396
< self.server.eyeFiConfiguration['Card']['UploadKey'])
---
> self.server.eyeFiConfiguration['Card'][handler.extractedElements["macaddress"]]['UploadKey'])
482c482
< credentialString = handler.extractedElements["macaddress"] + self.server.eyeFiConfiguration['Card']['UploadKey'] + self.server.serverNonce;
---
> credentialString = handler.extractedElements["macaddress"] + self.server.eyeFiConfiguration['Card'][handler.extractedElements["macaddress"]]['UploadKey'] + self.server.serverNonce;
534c534
< eyeFiUploadKey = self.server.eyeFiConfiguration['Card']['UploadKey']
---
> eyeFiUploadKey = self.server.eyeFiConfiguration['Card'][handler.extractedElements["macaddress"]]['UploadKey']

Daniel said...

Cool, thanks guys; much appreciated.

neociano said...

Hey Jeff awesome script but I am have some questions about which eye fi card to use. I have both versions (basic and pro). The pro uses the ad hoc feature and the basic does not. Is your script applicable to both and finally when I run the regression.py in IDLE python I get an error which I guess is my major problem. I have not yet had a successful upload and was wondering If I missed something.

Andrew said...

@neociano This script was written prior to the release of the Pro cards, and I doubt it's been tested with them.

Elo & Fred said...

seems there a lot activity backon this thread ! nice !
does anybody tried to use that on a synology nas ?
++
fred

neociano said...

@Andrew Thank you for your quick response! I am still having difficulty setting this up. I have the defaultsettings.ini configured correctly, and I am running the eyefiserver.py with the -c command but I just get no response from the card. I got the uploadkey error but once I changed the key I get nothing. I also tried running the recession test and it said it couldn't upload. I am using python 2.63 for winxp and a Nikon D40 to capture. Any help would be greatly appreciated as I need this technology for my current business,

Thanks again!

Jeff Tchang said...

@neociano

I have had some people tell me that the pro card works. If you post a log I can troubleshoot what is going on.

neociano said...

@Jeff Will do! Thank you very much

Luciano said...

@Jeff these are my configuration files....http://rapidshare.com/files/294990568/Settings.xml

http://rapidshare.com/files/294990437/DefaultSettings.ini

http://rapidshare.com/files/294990221/log.txt


Thanks again for all your help in advance

Regards Neociano

Luciano said...

I hope I didn't confuse anyone this is still neociano! lol for some reason the blog changed it to my real name..if anyone could help me with my config settings I would greatl appreaciate it!

Luciano said...

@Everyone (lol) I would like to confirm that the script works for both regular and pro cards. The pro card is a bit faster and I am currently testing if it works ad hoc with no internet connection, as of right now I have only gotten the script to work when connected to my home wifi internet with either card.

@Jeff Thanks again for all your help, You are the man.

holla2040 said...

Jeff,
Just got my pro card to adhoc to jaunty running your EyeFiServer v2.0. Thanks for all your hard work!
Craig

Luciano said...

Ok 1 last question I have a belkin router which has a access point feature, I just cannot get it configured correctly....I have tried to connect the card to the router (with no internet access)with no success. If any one has I would love to discuss how you did it..Thanks Neociano

Andrew said...

I've never had issues with setting up a card to use an access point. You will need to use the eye-fi manager to set the card up with the access point and give the card the ssid (wireless network name) and any encryption keys that might be in place.

Rajadurai said...

Dear Jeff,Andrew,
(Sorry to repeat a question.)
1. Will it work with all file types(mp3,avi,mpg,pdf etc)
2. Can we write data on Card using wifi server.

*This hack will be used to power my Car stereo mp3 player, My Sony HDTV with USB(EyeFi hooked to card reader)

Andrew said...

Rajadurai:

1. No (perhaps if you found a way to make custom firmware for the card).
2. No (the only way to write data *to* the card is via normal means).

Rajadurai said...
This comment has been removed by the author.
Rajadurai said...

@Andrew
Thanks

I'm working on a HARDWARE project.
WLAN NAS FlashDrive. So i was intrested in Modding EyeFi. When i came across the standalone server, i geussed that they were controlled at server.

Thanks.

register said...

I have moved my ldif to tsv code here: http://codeblogger.net/blog/?p=13

pnord said...

On the Mac the Settings.xml file is in:
~/Library/Eye-Fi/Settings.xml

Lee M said...

Hello this is Lee, I am bringing up your EyeFi server.

I have one question (at the end) and these notes for other people bringing up the Linux python eye-fi server.

On Windows, the Settings.xml file is hidden. I had to futz around with "view" or some such setting to see the file.

It is helpful you explained the EyeFi card searches the subnet when finding a EyeFi server. I turned off my wife's Windows computer running EyeFi server software to enable the search to find the Linux box running the Python EyeFi server software.

I am starting the server with "-i" and doing two steps to quit the server. First control-c and then the python function quit() (parentheses required). Otherwise I have to kill the python process which is kinda mean.

python -i EyeFiServer.py -c DefaultSettings.ini

Initially, I started seeing file transfers when I turned on Loglevel=DEBUG.

And, how do you observe the basic EyeFi card transfer processes?

Mark said...
This comment has been removed by the author.
Mark said...

this is great. have you thought about putting it on github so others can contribute?

Jeff Tchang said...

@Mark

Already there: http://github.com/tachang/EyeFiServer

bart said...

Hi Jeff, Good work on the EyeFi Server i have it running with out any problems.

One thing i have noticed is that if an image has the same name it auto overwrites it, is there any way to counteract this? Or is there any way to make the server software create folders per day or month then upload to them?

Thanks again, Bart

Fho said...

Jeff,

Any chance of making this work on Android? I know you're experienced with Android so I'm sure you've given it some thought at least. I have a Motorola Droid that's rooted and has Wifi tethering. It can create an ad-hoc network so I was just wondering how hard would it be to have the server connect to that?

Jeff Tchang said...

@Fho

Would definitely write the Android port but it wouldn't work right now. The base Eye-Fi card only works with infrastructure wireless networks.

Now if I got my hands on an Eye-Fi Pro card (the one that supports ad-hoc networks) then I could port it to Android.

Fho said...

I was wondering if it could be done with the regular card. That's what I have and don't see me paying $150 just for the "pro" version.
There isn't a way to "adjust" the firmware of regular cards to unlock ad-hoc networks?

Jeff Tchang said...

@Fho

Currently there is no way to hack the firmware. I tried a while back but my knowledge just isn't that deep when it comes to hardware reverse engineering.

Fho said...

Thanks for your responses. I've got 1 more question for you. I don't mean to pester you, Im just really excited for what you've done and its potential. Would there b a way to make an access point with my doid? I can set up an ad hoc network but if i can setup a wireless access point then i wouldn't need the pro card

Jeff Tchang said...

@Fho

There is currently no way to setup an access point with android. The reason is primarily that there has been no code written for the android for the wireless card to work in master (infrastructure) mode.

If you could push this enhancement to wifi-tether that would be best:

http://code.google.com/p/android-wifi-tether/issues/detail?id=11&q=master%20mode

Dutch said...

Jeff,
I thought it might be cool to use Ubuntu's notify-send command to Send a Desktop notification when an upload completes but when I try to put this as a command in the DefaultSettings.ini I get a series of python errors in the console. Any idea how this might be accomplished correctly?
example: ExecuteOnUpload=/usr/bin/notify-send "Image Uploaded" 2>&1

Thanks

Jeff Tchang said...

@Dutch

Try creating a simple shell script and using that as the command for ExecuteOnUpload.

The shell script needs to be prepared to accept as its first argument the file name of the image.

Inside that shell script run the send-notify.

Sai said...

Jeff,
I am trying to develop an embedded application based on the EyeFi Standalone Server v2.0. I am using the pro card and configuring it in AdHoc mode. I have tried the Eye-Fi card with your script in ad-hoc mode and it works perfectly.

I am able to receive the Start Session packets from the Eye-Fi card on my embedded platform and am replying to it with a Start Session response packets on the lines of what you have in your script. But I don't receive anything from the Eye-Fi card. I tried to sniff the packets and the data packets going out of the embedded application are exactly similar to the ones that the EyeFi Standalone Server v2.0 sends.

I am calculating the credentials as md5(macaddress, cnonce, uploadkey). I am keeping the snonce (1ab39d09d92a42af9cfa769c74ee74e9), transfermode (2), transfermodetimestamp (1230268824) constant. I hope this is correct.

My concern is with the date. Does it have to be correct? I think it should not matter. But I wanted to know if the Eyefi card expects a correct date.

Any advice will be really helpful and appreciated!

Jeff Tchang said...

@Sai

Are you still having problems? Please feel free to e-mail me directly.

I am not sure what the bug is with your program but I'd be welcome to take a look. I'd definitely try using a valid time stamp thtough.

chad said...
This comment has been removed by the author.
Daniel said...

Can I run the software directly on a wireless router with DD-WRT (Linux)? My goal is to send the pictures from the Eye-Fi card directly to a wireless router. The router has a USB port for an external drive. My goal is to get the pictures to the external drive without going through a computer.

Thanks,

Daniel

Jeff Tchang said...

@Daniel

Yes it is possible but you'll have to configure it in a specific way.

Daniel said...

Thanks Jeff,

Do you know of any hints or tips that would help me install it?

Thanks again for the quick response.

Daniel said...

Hi Jeff,

Can commands be used to send files from the server to the Eye-Fi cards?

Also, does the current version of software allow for several multiple simultaneous downloads?

We can test 100 cards, simultaneously, if we know that the code supports it.

Daniel

Glen said...

I am randomly getting a "Broken Pipe" error. My guess is a timing issue since my target folder in a CIFS share.

A while back, cochran242 asked about organizing files into folders based on timestamps. I hard coded a solution into the source on my machine (the card coding is the datetime format which, for me, is YYYYMMDD). For anyone interested. I'll try to post it somewhere (once I figure out how to add formatted code to a comment).

walter said...

hey - your download link for v2.0 zip doesnt work...it takes me to some christian book page or something...

walter said...
This comment has been removed by the author.
walter said...
This comment has been removed by the author.
walter said...

the eye-fi card key has been moved...it's no longer stored in settings.xml. it is now stored in:

C:\Documents and Settings\userid\Application Data\fi.eye.center.some-really-long-hex-string.1\Local Store\Eye-Fi Center.log

look for something like this;

2010-04-10 22:06:23-04:00 LOG login _deviceMovement undefined Eye-Fi Card 7d5a73a***YOUR-EYE-FI-CARD-HEX-STRING***7055ff0e 4.1012 1 1 0 0 0 1 1 1 0 1 0 1 1 1 eyefi false undefined undefined undefined

Peter said...

Hi!

Great stuff!

Did you ever try to use the ability run a command on upload to automatically geotag each image? Performance?

Thanks
Peter

Corey said...

Did anyone verify if this works for iphone? Please let me know.

Brian said...

I translated the Python into some Objective-C for my ShutterSnitch app for the iPad/iPhone/iPod Touch, and that works. Thanks Jeff - You're the man :)

speed121 said...

@ Brian
I'm a bit of a newbee at this. I'm using Shuttersnitch also. Can you tell me what "translated the Python into some Objective-C" means and how you did it?
Thanks

Jason Faraone said...

I currently use about 20 EyeFi cards. Right now I'm using the official software, but it is extremely unreliable. I schedule the XP machines that run the software to reboot 4 times daily, as an automatic fix of sorts.

This seems like it would be much more stable, but I have a few things that are extremely critical in my environment.

1) The server needs to be able to support multiple cards. This doesn't look like an issue based on what I've read.

2) I need to be able to have different cards deliver to different folders. Preferably I would have, for example, my Cleveland EyeFi cards deliver to C:\Images\CLV\Sales\05-13-10\, and my Nashville cards deliver to C:\Images\NVL\Quality\05-13-10\.

3) I have a routed LAN network. The EyeFi cards will run on a different VLAN than the server itself, which means that broadcasting to find the server probably won't work. I set up the first version of the standalone server, and if I recall, I had to add a DNS entry for api.eye.fi pointing to my standalone. This solution won't work if I plan on using multiple servers (which is dependent on whether I can have different cards on the same server point to different folders).

Hope that all made sense.

You have no idea how much easier my job would be if I had a more robust EyeFi system, and I can tell you that there is certainly a market for a business solution.

I can't believe how EyeFi is ignoring that entire market segment.

Jason Faraone said...

I'm getting the following in my EyeFi launch window, and no image ever uploads. The camera is actively trying to transfer, though.

Any ideas?

http://pastebin.com/NpTFV4BY

Jeff Tchang said...

@Jason

What is this transfermode 34? Use the official eye fi software to make sure that shows 2. I think that is where the problem is. There is a setting inside Eye-Fi about where to upload files.

Jason Faraone said...

I have relayed transfer disabled, and here is the "selective transfer" dialog. Not sure what to enter here...

http://imgur.com/EtHcg.png

Jason Faraone said...

So I poked around for a bit, and by default uploading video is enabled. I disabled this, and now my transfer mode is "2", but my camera just hangs while sending a picture. Here is the console debug output:

http://pastebin.com/diu8AZxs

CBailey said...

Well, I installed the server, and I have to say I'm very happy with it's functionality, and it's a LOT more stable than the Eye-Fi software. One little problem though. When I try to transfer a movie, I get this error message:
error: [Errno 10055] An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full

I googled this, and found a registry hack that allows high number ports on Server 2003 (What I'm running). Before I applied the hack, the error message occurred on every transfer (Pictures too), but now it's only happening with movies. Any ideas?

Jason Faraone said...
This comment has been removed by the author.
Jason Faraone said...

@ Andrew / Jeff:

Would it be possible to add in the option of having a different DownloadLocation based on the card?

It would seem trivial since you provide the same functionality with the UploadKey setting, but I'm not really a developer and can't seem to figure out how to do it myself.

Also, when using Andrews modifications to support multiple cards, I get the following in my log; any ideas?:

Exception happened during processing of request from ('10.1.23.42', 52354)
Traceback (most recent call last):
File "C:\Python26\lib\SocketServer.py", line 558, in process_request_thread
self.finish_request(request, client_address)
File "C:\EyeFi\EyeFiServer.py", line 177, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\EyeFi\EyeFiServer.py", line 193, in __init__
BaseHTTPRequestHandler.__init__(self, request, client_address, server)
File "C:\Python26\lib\SocketServer.py", line 615, in __init__
self.handle()
File "C:\Python26\lib\BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "C:\Python26\lib\BaseHTTPServer.py", line 323, in handle_one_request
method()
File "C:\EyeFi\EyeFiServer.py", line 256, in do_POST
response = self.startSession(postData)
File "C:\EyeFi\EyeFiServer.py", line 534, in startSession
eyeFiUploadKey = self.server.eyeFiConfiguration['Card'][handler.extractedEle
ments["macaddress"]]['UploadKey']
File "C:\EyeFi\configobj.py", line 580, in __getitem__
val = dict.__getitem__(self, key)
KeyError: u'0018562268ac'

Marc said...

Hey guys. I've got the "DownloadLocation=.\\pictures" uncommented, but it is not placing the pictures there. Any idea what I'm doing wrong?

Thanks

miguelo said...

Hi, for some strange reason it seems to transfer only two pictures over and over, am I the only one with this problem? Mac OS X 10.6.2 and Python 2.6.1

Unstill Editor said...

Thanks for writing this!

I'd like to add some code to do more processing with the download location - how much of the images metadata is available to the script before it downloads the image? Can I get the filename? filedate? Any EXIF data?

nick_fankhauser said...

The Server works well, thanks a lot!
But there is one bug I discovered.
After downloading about 1000 images, the thread limit of the OS is exceeded. I am getting this error: "error: can't start new thread"
Could it be that the hook child-threads are not correctly terminated?

Pieter Viljoen said...

Hi, happy to find this post, disappointed with eye-fi that you had to write it, direct upload to a local file server using SMB/CIFS/FTP seems like such a basic requirement.

I want to configure the card on a physical machine, but run the standalone server on a virtual machine hosted on a server.

How does the eye-fi card know the FQDN/IP of the local server it should connect to?

Andrew said...

Pieter Viljoen: The eyefi card looks for a running server on the subnet that the card is on. It will attempt to send to the first server it finds.

Pieter Viljoen said...

Andrew, ok, thanks.

That seems very inefficient, imagine I run a private class A 10.255.255.255 subnet, 16 million possible hosts...

What if I'm in a shared environment, like in an enterprise or a university dorm, multiple eye-fi card owners, multiple servers, all on the same subnet, my card may end up talking to somebody else's server, does the card validate the server, and move on if validation fails?

Andrew said...

Pieter Viljoen: Yes, there is verification, which is why the uploadKey is important.

Pieter Viljoen said...

I am having a problem running the server. I know nothing of Python, so please excuse my lack of knowledge.

I installed "Python 3.1.2 Windows X86-64 MSI Installer" from python.org, on Windows 7 Ultimate x64.

I open a command prompt, cd to the server folder, and run:

-------------
C:\Users\User Name\Downloads\EyeFiServer-v2.0>EyeFiServer.py -h
File "C:\Users\User Name\Downloads\EyeFiServer-v2.0\EyeFiServer.py", line 678
print "Warning: No configuration file specified! Run this server with the -h command."
^
SyntaxError: invalid syntax

C:\Users\User Name\Downloads\EyeFiServer-v2.0>EyeFiServer.py -c DebugSettings.ini
File "C:\Users\User Name\Downloads\EyeFiServer-v2.0\EyeFiServer.py", line 678
print "Warning: No configuration file specified! Run this server with the -h command."
^
SyntaxError: invalid syntax
-------------

Any ideas?

Jeff Tchang said...

Make sure you use Python 2.6 (not 3.0).

Pieter Viljoen said...

Jeff, thank you, v2.6.5 works :)

CBailey said...

I know this isn't directly related to this fantastic Python server, but does anyone have any ideas how to change the address the Eye-Fi card connects to? If we could change that, we could get it to connect directly to our own Python server, bypassing Eye-Fi's servers. Is it stored in the setup? Or does the firmware have to be hacked?

Andrew said...

CBailey: Short of rewriting the card's firmware, it isn't possible. Just be sure to only have one server running on the subnet. (Perhaps set up a subnet just for the card and server.)

tedder said...

Mostly for the search engines, any idea why EyeFiServer needs access to X?

import: unable to open X server `' @ import.c/ImportImageCommand/361.


other errors:
from: can't read /var/mail/xml.sax.handler
from: can't read /var/mail/BaseHTTPServer

Jeff Tchang said...

@tedder

It doesn't require X. Are you using python 2.6? Did you somehow compile it with X or something and it needs to start it all the time?

tedder said...

$ python -V
Python 2.6.5

A simple hello world works properly:

$ ./hello.py
Hello, World!


That makes me think there is a library dependency in there somewhere. Do you have a 'DISPLAY' set in your env? If so, what is it?

tedder said...

okay, this was caused by a simple stupid. I was executing "./EyeFiServer.py" and should have executed it as "python EyeFiServer.py".

The former clearly doesn't work, as the first line of the file shows.

info said...

Great work!
I really love your python script and already implemented it as windows service.
Only one thing:
there is alwas a .log file created together with the image. I assume this .log is inside the TAR file you extract. Is there a way only to extract the JPG files out od the TAR file?

kpaskert said...

Hi Jeff,

Awesome job, works great!

Is there a way to store the photos by either upload or photo date in a folder Eye Fi creates?

KP

mlt said...

Hi!
Thank you very much for writing this server!
I'm trying to use it on a small laptop acting as my media center (actually an olpc...). But I think I am having memory problems. It seems that when many pictures are sent, they are not saved to a file before the whole "roll" is finished. When the camera has many pictures on it, my small machine runs out of memory and takes forever to save the pictures. Is it possible to process the pictures one by one - save one, get next, and so on?

HerryDB said...

Hi Jeff.. Your work is awesome. Just one question though, about the ad hoc feature. Can I buy a basic Eye-Fi (not the pro Eye-Fi), use your software, and the card can directly transmit the photos directly to PC without a wireless router? Really thank for your answer. Herry.

Obscura said...

I'm confident it's configured correctly, yet it's refusing to upload.

Can I get another set of eyes on my log and config files to see if I'm doing it right?

http://obscura.us/eyefi/eyefi.log
http://obscura.us/eyefi/DefaultSettings.ini

Jeff Tchang said...

@Obscura

The transfermode is incorrect. You need to get it so the card sends "2". I haven't had a chance to look into what other transfer modes eyefi uses nowadays.

Obscura said...

Uh oh. I've enabled RAW transfers?

That is all I shoot. My camera stores a full size jpeg preview inside each raw file. I was planning on using the post-transfer script function to run an extractor.

If it is RAW transfer that is messing things up, is there anything I can do to help get it working?

Jeff Tchang said...

I am pretty sure you can still transfer raw. Might have to edit the code...I had a bug in it that caused it to always send tranfermode 2 instead of reading what the card sent.

Obscura said...

What do I need to change? The files are sigma .x3f format.

Having fun with this.

Obscura said...

Did some more troubleshooting tonight. Switched the camera to jpeg instead of RAW and the pictures uploaded to flickr but failed to copy to my Linux machine.

How is this possible? If we can solve it my RAW images may start working.

Latest log file:
http://obscura.us/eyefi/eyefi-02.log

dev said...

Has anyone published a Java port of this server? We need to embed it in our Android App. Didnt want to reinvent the wheel if we didnt have to.

Thanks

dev said...

Has anyone published a Java port of this server? We need to embed it in our Android App. Didnt want to reinvent the wheel if we didnt have to.

Thanks

Nerd Progre said...

Eye-Fi should have made their software with Java in the first place.

I imagine something simple that can be run via

java -jar EyeFiServer.jar

And it´d run on Linux, Windows, Mac OS-X, you name it.

But no, the idiots at EyeFi had to do things with Adobe "Hot" Air....

Anyway, thanks for your python server, will try it soon.
FC

RevK said...

The eye-fi works nicely with a mifi allowing upload via cellular while out and about :-)

Is there a way to set up relayed upload that goes to a configured server (running this stand alone server) via the internet rather than to the eye-fi server?

It works nicely (it ftp's the image to my photo site) but I would rather the images do not go via their server first.

This is for when on the move, using hotspots or mifi, and so the server is not on the same LAN.

Alternatively I'll have to do some DNS hacks...

snowyhands said...

Jeff! I have to say thanks a million! Your python script has added the functionality to my eye-fi card that I wanted when I originally purchased this card. It was frustrating to be tied to the eye-fi servers (though to their credit, they did a bang up job making this product in the first place); it was weird they added a limitation that the card has to check registration everytime over the internet when it wants to start an upload. I have a mifi unit without service and was struggling with this frustrating implementation. I don't understand [yet] python coding or any other language (it's never been my field of study] so I had to take a crash course in trying to get this setup. I don't know why, but this is restricted to the c: directory. I have a thinkpad laptop with two harddrives and the cmd line was giving me errors and failures when I tried using d [even with changing the directory correctly].

I suppose for simple instructions for the uninitiated: Download the zip file from Jeff. Extract into the c:\ directory. Obtain your uploadkey from the settings.xml file as the document states (note, I did find something in the area walter was talking about and I fiddled with that but never got that working. There were so many variables that I just stuck with what was in the settings.xml since it was available to me). later you can change the directory but it is not necessary. Change the uploadkey in defaultsettings.ini in the c: directory where you extracted the files. Save and exit. Open cmd window. change directory using 'cd' to the extracted folder in c: (so probably C:\EyeFiServer-v2.0) then type eyefiserver.py -c defaultsettings.ini and hit enter.

activate your camera and take pictures. the pictures should transfer over to the already extracted folder in c: but with a new pictures directory, so: C:\EyeFiServer-v2.0\pictures. Now you are good to go.
Took several hours to get this configured. I needed to take a crash course in python and sort through what was mixed information and no clear cut method - to a newbie- as to how to go about activating this server either through IDLE the gui or a python command prompt.

Again thanks A LOT for creating this!

snowyhands said...

I keep getting an error when I run this server related to the upload key. Strangely, it worked for a moment, now the server is back to giving me complaints about it.

In settings.xml the key is listed as 19169f45da9945f29e86b86c2007b3de

but I have noticed on this site that the keys appear to be different, many beginning with the letter c. What might be the difference? I plugged the card back into my computer and reran the eyefi main program to check to see if something got changed randomly but the key still remains

19169f45da9945f29e86b86c2007b3de.

Any idea how to fix?

Jonathan said...

Hi have used this software successfully with Eye.fi cards. Much thanks.

How about the new X2 cards. Any word as to whether this scrip will work with these?

Thanks again.
Jonathan

Jon Schneider said...

Just bought a £20 4GB "Share Video" card. Found settings.xml in ~/Library/Eye-Fi on OS X. It works thanks.

Ataa said...

There is an Android Server out which works with both Wifi and Android AP. It's free and it's features are great :

- Preview while upload
- Geo Tag
- Resize & Rotate
- Share to every possible service on Android.
- Notification of successful uploads (Toast / Sound / Vibrate)

I tested it on my Galaxy is and it worked very well.

It is available in the market.

Enjoy.

Darren Stuart Embry said...

Hi. I have an Eye-Fi Pro X2 (8GB) card and I've gotten your software *almost* working on a netbook running Debian.

Almost, in that your software does see the Eye-Fi card connecting to it when I click "add network to card" in the Eye-Fi Center, but after a minute I see the "Unable to connect to Eye-Fi server" message.

The cause appears to have something to do with the "Received and expected server credentials don't match" errors I see when I get an Eye-Fi card log.

I've uploaded logs and details and such here because it's too much to post here.

You'll note that I've found two different upload keys in two different places, and neither of them work.

Darren Stuart Embry said...

Help, anyone? Has this software even been tested with a Pro X2? Still stumped. :/

Peter Jr. said...
This comment has been removed by the author.
Peter Jr. said...

Will you do the hack for FW 4.2120?

Peter Jr. said...

Or is there a way to downgrade the firmware?

Corey said...

I modified the v2.0 server to support multiple cards. Instead of a [Card] section, I have n many [MAC] sections that define the key and directory.

A diff can be found here:

http://www.darkeneddesire.com/EyeFiServer/2.0/EyeFiServer-v2.0.zip

Corey said...

Ooops, Slight glitch on my clipboard. The patch is here:

http://schuhen.net/~corey/eyefi.diff

Mark said...

This is very useful, however, there is a problem with calculateIntegrityDigest when I run it on my QNAP device - it fails silently at this point. I have had to remove this verification code to get it to work. I've tried to debug the problem, but it works fine on my Windows setup.

Josh said...

The uploadkey is unique to each card, correct? If so, then it doesn't look like this will support multiple cards in its current form.

Is it possible to add that functionality? A typical use case for some of my clients involves multiple cards being used simultaneously.

TheOtherSlash said...

Great job Jeff with the python. Good language selection. At last not perl nor ruby - haha. BTW - the adroid app in the market - will NOT run properly on my rooted evo. Is it OK with you if I port this to the Android Jeff?

Jeff Tchang said...

Of course you can try and port it. I thought about it but just never got around to it. It would only work for Eye Fi Pro cards though because of the ad-hoc nature of the connection.

Hodiana said...

Jeff,

Android app works with normal cards (I have an old 2GB regular card) as well. You need Android 2.2 with Mobile AP.

My phone is rooted Galaxy S (I9000).

Mikolaj Habryn said...

Which Android app do you mean? There's two - do neither of them work on your Evo?

My Blogger @ google said...

I just brought the eye fi explore X2 (http://www.eye.fi/products/explorex2)

Will the eyefi server work for geotagging?

boddiesdrinker said...

Jeff, great info - i'm trying a Java port (using Apache HttpCore) and am having an issue - when i turn on the camera it seems to fire 2 request (within a few miliseconds of each other) and then pauses for a second or two and then retries; the first is a StartSession but i cant get the second - when i try and read the seconds header i timeout? Have you seen this?
Thanks
Martin

UsPlusOne said...

I am thinking about trying to get your server to work on a wireless router with DD-WRT running on it and a USB drive attached. My thought is that I can have it dump the images straight to the hard drive on the router. Any thought on this? Do you think it is doable?

Fred said...

Hi,
since it's a python server (isn't it?), anybody to make the synology package ? the guide is there : http://www.synology.com/enu/support/3rd-party_application_integration.php
Regards,
Fred

Kevin said...

@boddiesdrinker: I have written a Java version of this server for Android. I was seeing something similar before, but I had to enable the connection re-use feature to get it working. When creating the socket server:

// Set up the HTTP service
this.httpService = new HttpService(httpproc, new DefaultConnectionReuseStrategy(), new DefaultHttpResponseFactory());

I used the apache http server classes as well...made it much easier.

Jonathan said...

Great to hear there are some Java ports working.

I am looking at doing the same.

Is anyone planning on sharing an implementation at some stage?

Mikolaj Habryn said...

https://github.com/dichro/Fe-Fi is one.

Andreas said...

michaelo commented:
for some strange reason it seems to transfer only two pictures over and over, am I the only one with this problem?

i see the same. anyone has an idea why this could be?

ctaloi said...

Running into the same problem Mark had on his QNAP (I'm on a DLink DNS323). I have Python configured and everything starts up fine, the images just appear to fail the transfer (but silently, no error messages in console). Mark (or anyone) what did you remove from the code to comment out calculateIntegrityDigest ?

Thanks

Maurice Perry said...

@dev @Nerd Progre there is a Java standalone server here: http://code.google.com/p/sceye-fi/

Mark said...

Is it currently possible to send audio files from a wireless network directly to the Eye-fi card?

Thanks,
Mark

Aman Gupta said...

Hi,

I am lolooking for Eye Fi standone server to be used with Eye Fi card in a portable scanner.

I want to send the image to a predeifned server once it is scanned.

Let me know if this is possible.

Thanks,
Anky

Randy said...

I'm trying to run this on a Ubiquity routerstation with a USB hard drive attached. I've installed openwrt-backfire-10.03.1-rc5 with the python libraries.

The server will run, but gives exceptions when it receives a request from the eye-fi. Can you help me understand what EyeFiServer is looking for?

console messages:

Exception happened during processing of request from ('10.0.0.141', 65311)
Traceback (most recent call last):
File "/usr/lib/python2.6/SocketServer.py", line 558, in process_request_thread
self.finish_request(request, client_address)
File "EyeFiServer.py", line 177, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "EyeFiServer.py", line 193, in __init__
BaseHTTPRequestHandler.__init__(self, request, client_address, server)
File "/usr/lib/python2.6/SocketServer.py", line 615, in __init__
self.handle()
File "/usr/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/usr/lib/python2.6/BaseHTTPServer.py", line 323, in handle_one_request
method()
File "EyeFiServer.py", line 256, in do_POST
response = self.startSession(postData)
File "EyeFiServer.py", line 529, in startSession
parser = xml.sax.parseString(postData,handler)
File "/usr/lib/python2.6/xml/sax/__init__.py", line 43, in parseString
parser = make_parser()
File "/usr/lib/python2.6/xml/sax/__init__.py", line 93, in make_parser
raise SAXReaderNotAvailable("No parsers found", None)
SAXReaderNotAvailable: No parsers found

I'm not a python program, but it appears to me that OpenWrt is missing a SOAP parser perhaps?

Jeff Tchang said...

@Randy

What python version are you running? 2.6?

Unknown said...

My laptop is running Fedora 15 (python 2.7.1) and will work, though not with the regularity that inspires confidence. I'm still trying to track down the issue as there are many variables involved.

I was hoping that the Routerstation would solve some of those issues. It's running Python 2.6.4. Because of the small memory footprint, developers tend to compile programs sans "un-important" features to save space, so I suspect something is missing from the OpenWrt install of Python.

Matt said...

Hi Jeff,

I have got the program running and the Eye-Fi card is associated with the AP but the program does not download any images.

Any pointers or tips would be appreciated.

Matt

Ecommerce said...

Your blog accommodation are actually arresting and additionally adequate looking. i actually enjoyed to saw your blog. so acceptance for accoutrement the adequate brawl blog..

Android app developer

CaptainRewind said...

I bought an Eye-Fi Connect X2 card without even considering that my NAS is a Linux server, and I don't leave a Windoze or Mac running at all times like I do with the NAS. This looks like a VERY promising workaround to the lack of Linux support for the card.
Thanks for thinking of the community! I'll be sure to post with any suggestions/questions once I get this running on my server.
THANKS!

delete said...

Thanks for a really cool solution to using my new Eye-Fi Mobile X2 card with my Linux server!

Has anyone tried using this with the Eye-Fi app for iOS? I thought it might be as easy as using corey's diff patch for multiple cards and just putting in the MAC address and UploadKey for my iPhone and iPad into my DefaultSettings.ini file.

The app connects to the server, but then blows up on the SOAP envelope:

Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "./EyeFiServer.py", line 179, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "./EyeFiServer.py", line 195, in __init__
BaseHTTPRequestHandler.__init__(self, request, client_address, server)
File "/usr/lib/python2.7/SocketServer.py", line 639, in __init__
self.handle()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 343, in handle
self.handle_one_request()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 331, in handle_one_request
method()
File "./EyeFiServer.py", line 300, in do_POST
response = self.uploadPhoto(postData)
File "./EyeFiServer.py", line 383, in uploadPhoto
soapEnvelope = form['SOAPENVELOPE'][0]
KeyError: 'SOAPENVELOPE'

The only strange thing I can see is that, when getPhotoStatus lists out the extracted elements, the MAC address has a 'b' at the end (only when connecting from iOS, it works fine from the Eye-Fi card itself).

Any ideas?

windracer said...

This is the error that occurs right before the SOAP one I posted above:

Exception happened during processing of request from ('192.168.1.123', 53444)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "/usr/local/eyefi/EyeFiServer.py", line 179, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/eyefi/EyeFiServer.py", line 195, in __init__
BaseHTTPRequestHandler.__init__(self, request, client_address, server)
File "/usr/lib/python2.7/SocketServer.py", line 639, in __init__
self.handle()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 343, in handle
self.handle_one_request()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 331, in handle_one_request
method()
File "/usr/local/eyefi/EyeFiServer.py", line 280, in do_POST
response = self.getPhotoStatus(postData)
File "/usr/local/eyefi/EyeFiServer.py", line 492, in getPhotoStatus
credentialString = handler.extractedElements["macaddress"] + self.server.eyeFiConfiguration[macAddress]['UploadKey'] + self.server.serverNonce;
File "/usr/local/eyefi/configobj.py", line 580, in __getitem__
val = dict.__getitem__(self, key)
KeyError: u'XXXXXXXXXXXXb'

I replaced my MAC address with Xs, but I think it's that "b" at the end that's causing the problem?

windracer said...

Ok, I figured it out and got EyeFiServer to talk to the iOS app on my iPad and iPhone, pretty cool!

I had to make two changes to the code:

1. truncate the macAddress to 12 characters (to eliminate the extra character being returned by the iOS app for some reason)

2. strip the "charset=utf-8;" out of the contentTypeHeader (again, something being added by the iOS app that the code was not expecting)

I'm not saying this is the perfect way, but it worked for me! I'm able to send photos from my Eye-Fi Mobile|X2 card, my iPad, and my iPhone to my Ubuntu server.

Here's my code diff, which assumes you already added corey's changes for multiple MACs in your DefaultSettings.ini file.

http://www.windracer.net/outgoing/tc/windracer-ios-patch-eyefiserver.diff

You'll need to add new entries to your DefaultSettings.ini file with the MAC address and upload key for each of your iOS devices (which you should be able to get out of the Eye-Fi Manager's settings.xml file.

Justin said...

Running this on Ubuntu Linux, I can't get it fully working. I take a photo and see log chatter (so something is working). I get a StartSession followed by StartSessionResponse in the log, but then that's all.

If I fire up my Windows laptop (from the same network) it works just fine.

Here's a log pastebin:
http://pastebin.com/jq0wajkY

(MAC address and Upload Key replaced with "--???--")

I've triple checked the Upload key is correct. Anyone have any ideas?

Sylvain Patry said...

Quick patch to add support for more than 1 eye-fi card.

--- EyeFiServer.py.org 2012-10-31 23:23:18.032307000 -0400
+++ EyeFiServer.py.new 2012-10-31 23:23:16.497093700 -0400
@@ -393,7 +393,7 @@
# Perform an integrity check on the file before writing it out
eyeFiCrypto = EyeFiCrypto.EyeFiCrypto()
verifiedDigest = eyeFiCrypto.calculateIntegrityDigest(untrustedFile.getvalue(),
- self.server.eyeFiConfiguration['Card']['UploadKey'])
+ self.server.eyeFiConfiguration['Card'][handler.extractedElements["macaddress"]]['UploadKey'])
unverifiedDigest = form['INTEGRITYDIGEST'][0]

# Continue only if the digests match
@@ -479,7 +479,7 @@
eyeFiLogger.debug("Extracted elements: " + str(handler.extractedElements))

# Calculate the credential string that I am expecting the card to send to me
- credentialString = handler.extractedElements["macaddress"] + self.server.eyeFiConfiguration['Card']['UploadKey'] + self.server.serverNonce;
+ credentialString = handler.extractedElements["macaddress"] + self.server.eyeFiConfiguration['Card'][handler.extractedElements["macaddress"]]['UploadKey'] + self.server.serverNonce;
eyeFiLogger.debug("Concatenated credential string (pre MD5): " + credentialString)

binaryCredentialString = binascii.unhexlify(credentialString)
@@ -531,7 +531,7 @@
eyeFiLogger.debug("Extracted elements: " + str(handler.extractedElements))

# Retrieve it from C:\Documents and Settings\\Application Data\Eye-Fi\Settings.xml
- eyeFiUploadKey = self.server.eyeFiConfiguration['Card']['UploadKey']
+ eyeFiUploadKey = self.server.eyeFiConfiguration['Card'][handler.extractedElements["macaddress"]]['UploadKey']
eyeFiLogger.debug("Setting Eye-Fi upload key to " + eyeFiUploadKey)

credentialString = handler.extractedElements["macaddress"] + handler.extractedElements["cnonce"] + eyeFiUploadKey;
@@ -644,7 +644,8 @@
def emit(self, record):
pass
eyeFiLogger.addHandler(NullHandler())
-
+
+


def commandLineOptions():


configuration file looks like this:

[card]
    [[033648569560]]
    UploadKey=

Glenn J. Schworak said...

It seems that the file servers are not working. I have tried several times to get the standalone server and even view the source but no luck. I keep getting "connection reset by peer" when trying to get the zip file.

If there is an issue with the host, I would be happy to donate some bandwith to house the zip file for you.

I just want a copy for myself for now if someone can help me get it.

http://www.darkeneddesire.com/EyeFiServer/2.0/EyeFiServer-v2.0.zip

Thijs Elenbaas said...

Hi. Thanks for your great work! I had some trouble in setting the server up, but with a little playing around, I got everything running. To help others on their way, I wrote a little installer script, based on your Eye-Fi server, and a fairly extensive installation how-to, see http://thijs.elenbaas.net/2013/03/installing-an-eye-fi-server-on-a-synology-nas/.
Perhaps you could have a look at it. I would be very interested to hear if it fully complete and correct