Sunday, January 4, 2009

Eye Fi Standalone Server

Eye Fi Linux Hacking

So I spent some time over my vacation learning a bit more about Python. What better way to learn a language than to implement something you want or need, right?

I am releasing a standalone Eye-Fi server written in Python. Basically I saw Dave Hansen's post (http://dave-hansen.blogspot.com/2008/12/freestanding-server.html) and went ahead and did it. This software works on Windows with Python 2.6. I have not tested it on Linux/Unix yet but I assume it will work seeing as how it is written in Python. Please let me know if you try this software out and it works or doesn't. I personally would love any comments!

Python script is here: http://www.darkeneddesire.com/EyeFiServer/EyeFiServer.py

General Architecture Notes

This is a standalone Eye-Fi Server that is designed to take the place of the Eye-Fi Manager.

Starting this server creates a listener on port 59278. I use the BaseHTTPServer class included with Python. I look for specific POST/GET request URLs and execute functions based on those
URLs.

Currently all files are downloaded to the directory in which this script is run.

To use this script you need to have your Eye-Fi upload key.
It is in C:\Documents and Settings\[User]\Application Data\Eye-Fi\Settings.xml

Simple search for "eyeFiUploadKey" and replace it with your key.

--

Update (4/4/09) - http://returnbooleantrue.blogspot.com/2009/04/eye-fi-standalone-server-version-20.html

110 comments:

Unknown said...

Jeff,

Great work, and I have two pieces of feedback:

1) I would advise strongly that you add code to your GetPhotoStatus handler to validate the credential returned by the card. You are clearly doing the right thing in StartSession to validate the server to the card, but if you don't also check that the card is validated, you're opening a port into your computer for anyone to inject photos by spoofing the behavior of an Eye-Fi Card.

2) You'll see that "modern" Eye-Fi Card firmware (version 2.0001 onward) have an INTEGRITYDIGEST field in the main upload POST. You should use this to validate the integrity of the upload. Checking that integrity digest also protects against man-in-the-middle photo injection attacks. It looks like you had no trouble coming up with the authentication handling for StartSession, so, for now, I'll leave the specifics as an "exercise for the reader".

Take care,

Berend

Michael said...

I fixed up the previous perl server (eyefitools) a few days ago and got it working with the newer firmware.

It's linked off http://randomtechmakings.blogspot.com/2009/01/i-bought-eye-fi-sd-card-few-weeks-ago.html

The perl one I fixed does the card credential validation. The key point is that the card credentials have a slightly different way of being calculated.

The 60 seconds I spent poking at the INTEGRITYDIGEST didn't lead me to seeing how it was calculated, so anything you find in that area would be great.

Andrew Welker said...

Thanks! It works great under windows with python 2.6, 3.0 did not work for me.

ThatCloud said...

GREAT JOB~~ I LOVE IT
I gave it a try and it worked except for a small hickup with my version of Python (2.5.1). it complains when creating the log file and when extracting the tar back

Still, this gives me alot of ability when downloading photos directly/keep a copy on my home server. who knows, maybe i can even put it on my N800 and view them directly when I am out taking photos.. (that is if i have a mobile AP with me.. don't think N800 can act as an AP)..
but yeah, this is a great script!

John said...

Tried running it in Ubuntu Linux, doesn't appear to be working. First I was getting an unexpected argument 'delay' on line 75. I removed that argument and the script ran, but when I powered on my camera and took I picture I got the following:


http://pastebin.com/mfff9eba


It hung there for several minutes until I stopped it. I'm going to poke around in it later, but I don't know python so it'll likely take me awhile just to understand what you're doing before I make any progress.

Jeff Tchang said...

Hi John. Have you tried upgrading your firmware? There is a 'bug' in the firmware in which the Eye-Fi card provides the incorrect Content-Length. I believe it is off by 1 so when you are expecting 100 bytes but the Eye-Fi card only sends 99 you are just sitting there waiting for that last byte.

I believe the newer firmware fixed it. I should add a little check for that. Let me know.

Jeff Tchang said...

Another thing you might want to double check is the UploadKey. It looks like from the log that the card isn't accepting the startSession. That is why it tries again. If the key is wrong the card just silently keeps trying.

John said...

Jeff,

It's strange. I verified I had the correct upload key, then booted into windows to check the firmware. I didn't do anything to update the firmware, but when I tried it again just now it worked! I'm going to deploy it on my main server now and see how my luck runs. But consider this a tentative confirmation that your script works in linux!

John said...

Jeff,

Maybe this is a python question. But when I start the EyeFiServer.py script, it prompts me to hit return to stop the script. How do I disable this? I am trying to get the script to run constantly in the background without my having to have a terminal window open.

Any ideas?

Jeff Tchang said...

Hi John. I couldn't find any contact information on your blog. Feel free to e-mail me.

In general the python program will run until it receives input. Did you try to daemonize it using an ampersand? You can also just redirect all output to /dev/null

Wesha the Leopard said...

I had some problems with python versions, but I confirm it works OK with Python 2.6.1 on FreeBSD. Thank you so much, you gave me a reason to buy the eyefi card finally!!!

Unknown said...

This would be great if you could add Geotagging with a Eye-Fi Explorer card to the server.

That's the reason I bought the card in the first place. When you're out of the country, you want to know where you took your picture and this option only works when sending your picture with Wifi and an internet connection.

MGDC said...

Fantastic work. It's always annoying when a hardware vendor chooses to hide the details of using their hardware and releases only proprietary Windows software.

I saw one of these cards once at a Best Buy, and hadn't looked closely at it. All I saw was 'SD' and 'wifi'. I didnt buy one, but I had been thinking a good use of it would be to install it in a digital photo frame, in order to be able to load pictures to the frame without having to physically fuss around with moving SD cards around. I had since done some more research, and realized that wasn't supported.

Do you know if there is any way to transfer files from PC *to* the card, or do you think it could be possible?

Matt said...

I bought an eyefi, and I couldn't activate it for a day because their servers were down. I wasted an hour troubleshooting before calling them and finding the problem was on their end. That scared me into returning it.

Do you still have to activate it before you can use it? I want to cut the eyefi company out of the loop completely. I hate to buy something that's usefulness depends on a startup company.

John said...

Matt,

I did an initial install on a windows machine to get the values from my card needed to run Jeff's server. Now that I'm running his server I have no interaction with the company's servers whatsoever. I have no distrust toward the company, but like you, I prefer to be able to run everything stand-alone in case they were to ever go out of business, and Jeff's server suits me for this purpose.

Unknown said...

I can't test this because I have to wait until my fiance opens her birthday gift.

But does this work with files other than .jpg - IE RAW?

Jeff Tchang said...

The EyeFi firmware only allows JPG uploads. This is a limitation of the EyeFi firmware and not the standalone code. If the EyeFi firmware sent a RAW the code would happily receive it.

Unknown said...

Jeff,

Congratulations on making it to Slashdot! With the publicity you're getting, I would strongly encourage you to follow Chris Davies' work to fully authenticate and validate incoming uploads. Otherwise your server is effectively opening an arbitrary JPEG-injection service on your users' computers.

Berend

Unknown said...

Yeah, what Berend said.

If people are really going to be using this, you need to:

a) Start generating nonces from a secure random source.
b) Start verifying card's credentials.
c) Verify the integrity digest field too, if you're feeling enthusiastic.

I've supplied all the information you need to do these things and clumped it all together on the eye-fi forums.

Jeff Tchang said...

As this first release was really intended as a proof of concept I plan to incorporate a bit more error and integrity checking on subsequent releases. Thanks for all Berend and Chris!

Unknown said...

Hey, this is great. But i would request a noob guide. I have never played around with Python, but managed to install it on my nas box (DNS-323, Python 2.5.2-2 - http://81.216.140.39/dns-323/denyhosts/) and trying to get the server to run (but it says):

: File name too long
: not founder.py: line 66:
: not founder.py: line 67:
: not founder.py: line 68:
: not founder.py: line 69:
./EyeFiServer.py: line 71: syntax error: "(" unexpected

I have inserted correct UploadKey in the script. What have i missed?

One thing that i dont get at all - how should i tell my eyefi card to connect to my server ? (i have dyndns activated and opend correct ports in router (59278)

Regards,
Martin

Unknown said...

Thanks Jeff!

I know this is proof of concept and all (and it works like a charm!) but it's never too early to start piling on feature requests.

1) It would be nice to have some sort of sorting to different folders based on the eyeFiUpload key. We have multiple cards for different employees, and if I could sort images based on this then it would be easier for each employee go directly to their photos.

2) The ability to run this as a service would be nice.

3) I suppose I was just having a slow morning since nobody else had trouble with this, but I didn't see in the documentation that I had to alter my DNS so that api.eye.fi pointed to the server the python script was running on. It made sense, I just didn't see it in the documentation.

On a side note, thanks a TON! This actually appears to work on our enterprise wireless network MUCH better than EyeFi manager.

Thanks,

Jason

Unknown said...

@jason

Does this below mean, that i cant use eyefi to connect to my server direct when im out photographing and connect to dirrefent open wi-fi networks (as i dont have control over any DNS server, and i will get settings as DHCP)


3) I suppose I was just having a slow morning since nobody else had trouble with this, but I didn't see in the documentation that I had to alter my DNS so that api.eye.fi pointed to the server the python script was running on. It made sense, I just didn't see it in the documentation.

John said...

@Martin

For what it's worth, I didn't have to make any changes to my DNS on my home LAN for the standalone server to work with my eye-fi card.

Jeff Tchang said...

@Martin

This works only with Python 2.6. I haven't had a chance to backport it to 2.5.

Feel free to e-mail me directly if you are still having issues!

-Jeff

Unknown said...

@John / Martin:

Given John's comment, I'd assume you're fine; I've been experiencing a lot of connectivity issues with my wireless and have been troubleshooting this all at once.

John, out of curiosity is your image collecting PC and wireless network on the same subnet?

Also, anyone familiar with wireless error 6?

[03:54] Disconnected from WLAN (reason = 6).
[03:54] Connection dropped (previous state is 1)

John said...

@Jason

On my ride home it occurred to me that the model of Eye-Fi card might be significant. I'm using the Eye-Fi Home, which (I belive) by design don't communicate with the Eye-Fi servers.

The image collecting PC and the WAP are both on the same subnet in my home LAN, behind the same switch.

Unknown said...

@ Jeff/Jason

Thanks, i know can get the server to run.

Will it be possible for me to use my server from remote locations somehow. I guess the EyeFi client defaults to "api.eye.fi" so i need to control teh DNS (so i can use open DNS and forward to my own server).

Is it possible to hardcode DNS but recieve IP, GW via DHCP ? or will i be limited to use a mobile 3g router?

See all i want to do is upload pictures straight to my own controlled FTP server..

Thanks,
Martin

Jeff Tchang said...

@Martin

This server will receive EyeFi pictures if the EyeFi card is able to connect to it. How to connect to the server is up to the EyeFi card itself.

Currently the EyeFi card attempts to associate to the preprogrammed wireless networks. It then tries to obtain an IP via DHCP and then scans the local subnet for the server. One use case that I've implemented is using a MSI Wind laptop in access point mode with a cellular card. My EyeFi card associates to my mobile access point and uploads photos to wherever I want. It is a bit contrived but I thought it was pretty cool.

If we ever manage to hack the firmware then the possibilities are all open. Right now though buying an EyeFi card with HotSpot access is probably your best bet. Obviously the firmware is preprogrammed to associate (and authenticate) to Wayport wireless networks. What's interesting is how EyeFi is keeping track of your subscription. Technically I could purchase EyeFi hotspot access for $14.99/year and use it without the EyeFi card.

Unknown said...

@jeff

i see. Well im living in Sweden and i want to find a cheaper solution that the professional solution with using Canons DLSR and their wi-fi transmitters to send to our ftp.

Very strange that eye-fi has looked the features.

murvel said...

Hi Jeff,
I managed to get the server running with Python 2.6.1 on my laptop with 3G. But how do I configure the laptop so my eye-fi-card can connect?

Jeff Tchang said...

@Rolf

The laptop's wireless card must be put into access point or master mode. Your laptop must look like a wireless access point. The EyeFi card must then be configured to connect to it.

murvel said...

@Jeff
Ok, I see. Then this will not solve the built-in ad-hoc-block as I was hoping for a minute. My wireless card doesn´t allow infrastructure. The case you describe with your MSI Wind laptop is what I´m aiming for. Then I would use freeware ftp program Fling to watch my download folder and automatically send all incoming pictures to my ftp-server. I´ll just have to wait and see if there will be a new firmware that allows ad-hoc connections.

Unknown said...

Thanks a million, Tchang. Exactly what I was looking for. Getting it to work with Python 2.5 is only 1 argument in the logging call.

I rewrote things a bit, so it can run as a debian deamon on my nas-like machine here. It now
- reads an external config file, containing oa the uploadkey and an uploadpath that understands %Y%m%d-like dateformats
- starts and stops from /etc/init.d
- logs in /var/log/..
- runs like under a different user/group

Since your script has 'all rights reserved', I can't redistribute this (or at least, you don't specify *how* the rights are reserved). But I'm sure if someone would package this properly, it would run fine on a lot of NAS devices and on Ubuntu - pretty usefull :-) Drop me a note if you want to see my version .. it's only a few changes.

thanks!
*-pike

Unknown said...

@jason


>t I didn't see in the documentation that I had to alter
>my DNS so that api.eye.fi pointed to the server the
>python script was running on.

I'm using the 'home' card, it seems to connect to every machine on the network on the port 59278 to see if there's anything responding there.

I was confused too, because I *expected* to need to reconfigure the card to send the pictures to a different machine, but I didn't - it just worked.

$2c,
*-pike

Unknown said...

@john

>when I start the EyeFiServer.py script, it prompts me
>to hit return to stop the script. How do I disable this?

In the code, at the bottom, in the method name(), this script spawns a new thread and the original thread waits for input before it kills the new thread. This is a design choice.

If you replace that code with "eyeFiServer.serve_forever()", the whole script will hang on (and work fine) until you kill it. This sounds more like what you'd like. You can use the start-stop-deamon to properly start and stop it.

$2c,
*-pike

Unknown said...

@Martin

> trying to get the server to run (but it says):
>
>: File name too long
>: not founder.py: line 66:
>: not founder.py: line 67:

:-) seen that. "not founder.py" is actually "EyeFiServer.py" overwritten with the words "not found" by bash. I'm guessing you didn't invoke python but bash (or sh) to run the script.

Interestingly, I'm also (like you, I think?) aiming to eventually create a WIFI accesspoint on my phone (or laptop), so I can take pictures "in the field". Theoretically, that could work. But I have a long way to go.

$2c,
*-pike

Jeff Tchang said...

@Pieter

Awesome work! Would love to see the version that you wrote. I am trying to figure out what open source license to release under. I might just release it under multiple ones and be done with it.

I am actually working on the next version. Cleaning up a bit of the logging and maybe adding some tests. Feel free to e-mail me directly Pieter. My e-mail is available if you click my blogger profile.

-Jeff

Unknown said...

Hey,

Everything seems to be working but i dont get any pictures. Please see the log file here: http://www.levy.se/EyeFiServer.log

The upload key is correct, and when enabling the EyE-Fi manager on the local PC the pictures gets transferred to the default folder.

Jeff Tchang said...

@Martin

Double check your upload key. The error is that the card does not trust the server (either because the upload key is wrong or something else). Try updating your firmware. There was a bug in one of the firmwares that forgot to put the correct # of bytes to transfer in a request.

Unknown said...

hi jeff,

Great work.If you guys can port the "python script" to C it will be helpful for us to use it on some embedded system.

I really appreciate the work.

Regards,
rohit

firefly said...

Jeff,
Sorry for the very newbie question but, when you write:
"search for "eyeFiUploadKey" and replace it with your key"
do you mean that I should replace the words "eyeFiUploadKey" or replace the actual number found where it reads
eyeFiUploadKey = "c686e547e3728c63a8f78729c1592757"

Thanks,
rufus

Jeff Tchang said...

@rufus t firefly

You should replace the actual number.

Anonymous said...

Hello Jeff,
Great stuff! For some reason, which includes the possibility of me being an idiot, I am not able to find the eyefiupload key. I found the settings.xml file, but it contains about 8 lines without a key. I have installed and checked on XP and Vista. Also, I have installed the manager first... Thanks, Kevin

Paul Bailey said...

Ok i've got the script to work on Ubuntu with one caveat. If I'm connected to the internet it works fine. However, if i unplug my router from the internet it does not work. I'm guessing from earlier comments it is because of the DNS lookup of api.eye.fi.

The normal Eye-Fi manager does not have this problem. So is there any script fixes for this problem. I can set the DNS look up on my laptop but not my router. Is there anyway to get around this?

I'm trying to integrate the script into a small application I wrote for creating events photos (adding background to photo and then automatically printing the picture). See my site Phoevento. The Eye-Fi card is great because now I can automatically transfer pics to the program. I would like to integrate this python script so i don't have to have a separate program running for the pic download. Right now i'm just using the Eye-Fi manager in a VM and then my program in Ubuntu automatically gets the photos and processes them.

Obviously, when I'm onsite with the app, internet connectivity is not always possible.

Jeff Tchang said...

@Paul Bailey

This script does not need internet connectivity. Did you make sure you shut down the original Eye-Fi manager before starting my script? The new version of my script I am planning to release will have the ability to execute an arbitrary command on the photographs being uploaded.

Jeff Tchang said...

@kevin

Getting the original Eye-Fi manager software to generate the UploadKey is a bit tricky. You have to make sure you add a network and set it to upload photos somewhere. Once this is done the Eye-Fi manager will write the key to the Settings.xml file. I am still trying to figure out how the UploadKey is calculated so that we can break away from using the original software completely.

Paul Bailey said...

Yes, I shutdown the other eye-fi manager. And when I run the python server with no internet I see the output from the server seeing the eye-fi card connect but it never uploads any photos.

I'm guessing it has to do with DNS because of the earlier comment had to alter my DNS so that api.eye.fi pointed to the server.

Unknown said...

That was an incorrect assumption on my part; sorry for any confusion!

Paul Bailey said...

@Jason Faraone and @Jeff Tchang

Ok if it is not DNS then what could it be? Just to reiterate, with internet connectivity it works great! Unplug my router's internet cable and no workie no more. :-(

Jeff Tchang said...

@Paul Bailey

Can you post the log somewhere? Maybe at http://pastebin.com/?

If you are seeing the Eye-Fi card connect to the server it means there is a problem with authentication (the card does not trust the server). The primary reason this happens is because the UploadKey is incorrect. Either you copy and pasted the wrong one or you mistyped it or something along those lines. Another possibility is that you are not running the latest firmware. There is a bug in one of the older firmwares that might cause it to hang.

Jeff Tchang said...

@Paul Bailey

Feel free to e-mail me directly if you want some help. I also tried adding your Yahoo account.

alanv73 said...

@Martin

That's awesome that you've got it running on the DNS-323. I have fun_plug enabled on mine, do you have somewhere a guide on getting first python running and then this Eye-Fi server?

Great Work to both you and Jeff!

Unknown said...

@AlanV

Hey,

First i followed this guide (http://81.216.140.39/dns-323/denyhosts/) - but only installed Python 5.

Then i managed to setup Optware via this guide: http://wiki.dns323.info/howto:optware

And succeed to get Python installed.

/m

Paul Bailey said...

Ok i lied a little. I actually wasn't unplugging the internet cable. I was in reality switching from one router to another in order to simulate the no internet connectivity. So i switched the role and found it wasn't the internet that was the problem it was the router.

My Linksys router works great with the python script. My DLink router does not, no matter internet or not. The normal Eye-Fi manager works through the DLink though just not the python script.

It could also be some kind of firewall/router issue. Because it looks like the camera is trying to send the pic to the server but it never makes it. So anybody have any ideas on settings for the d-link? I have all firewall settings off I know of.

alanv73 said...

@Martin

That got me going, thanks!

I'm still having a bit of trouble. The photos are uploading to flickr as requested, but they aren't getting saved locally. I've looked everywhere I can think of that they might be, but can't locate them.

tBal said...

I am attempting this on a Mac - anyone need to know where to find my upload key? I have been searching for this for a while now. I would love to have this running instead of the new eye-fi manager.

When Eye-fi came out, I was pretty excited. I downloaded the software to see what it entailed before purchasing a card. By the time I finally bought one, they went silly with the software to what it is today. It is an awesome product that seems to have lost itself in desperate attempts to force itself into the life of the consumer who purchased their product. They are trying to make razorblades for a razor that never gets dull.

Jeff Tchang said...

It will probably work on mac. I would try shelling out to a terminal and doing a ls -al on your home directory. Something like "cd ~" and look for any hidden directories. I am not sure what the standard place to store configuration stuff like that is. If all else fails, look for Settings.xml somewhere in your entire system.

Lightcatcher said...

Trying to get this running on my OSX mac. python (2.5) is running and I created a config file as specified in the command.

Any thoughts on this output?

note: I changed the module and string tags to dashes in this comment so blogger would take them.


james:~ jhaney$ python efpython/EyeFiServer.py -c efpython/efpyconfig
Traceback (most recent call last):
File "efpython/EyeFiServer.py", line 737, in -module-
main()
File "efpython/EyeFiServer.py", line 712, in main
eyeFiServer = EyeFiServer(server_address, EyeFiRequestHandler, eyeFiConfiguration)
File "efpython/EyeFiServer.py", line 144, in __init__
BaseHTTPServer.HTTPServer.__init__(self,server_address, requestHandler)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py", line 330, in __init__
self.server_bind()
File "efpython/EyeFiServer.py", line 149, in server_bind
BaseHTTPServer.HTTPServer.server_bind(self)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/BaseHTTPServer.py", line 101, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py", line 341, in server_bind
self.socket.bind(self.server_address)
File "-string-", line 1, in bind
socket.error: (48, 'Address already in use')

Paul Bailey said...

@Lightcatcher "Socket already in use" means that something is already using the port 59278. So you need to kill the process using that port.

Enrique said...

Awesome work Jeff! And in Python, my favorite scripting language.

Jeff Tchang said...

@Lightcatcher

Make sure the official Eye-Fi manager is shut off. Also post your configuration file and make sure you are using the new version (v2.0):

http://returnbooleantrue.blogspot.com/2009/04/eye-fi-standalone-server-version-20.html

Lightcatcher said...

The eye-fi manager is not running, and I had just rebooted.

I am using version 2.

I had already issued the python command, so is the problem that I already called it once?

here is my config:

# Main configuration

[Global]

# The directives in this section affect the overall operation
# of the Eye-Fi server


#
# ListenPort: Allows you to bind the Eye-Fi server to a specific port.
#
ListenPort=59278

#
# ConsoleOutput: Logging can automatically be sent to the console.
# Set this to False if you don't want any console output. Console
# output is also considered stdout.
#
#ConsoleOutput=True


#
# LogFile: Controls where to write the Eye-Fi logs.
#
#LogFile=.\\efpylog.txt


#
# LogLevel: The level of verbosity in both the logs and the console
# output. From most verbose to lease verbose the settings are
# DEBUG, INFO, WARNING, ERROR or CRITICAL
#
#LogLevel=INFO

#
# DownloadLocation: The directory in which to put the incoming pictures. By
# default the pictures are put in a sub directory called "pictures" from where
# the script is originally started.
#
#On Windows:
# This would set the downloads to a directory called pictures.
#DownloadLocation=.\\pictures
#
#On Unix:
#DownloadLocation=/tmp
#
DownloadLocation=.\\pictures



#
# ExecuteOnUpload: This parameter is used to define an external program or script to
# execute after a file is uploaded. By nature this command is very dangerous and should
# be used carefully. Enabling this command can serve as a means of compromising a
# system or disclosing information via bugs in external programs or scripts.
#
# This parameter executes the specified command on each incoming file passing in the full
# file path as the first argument. There is no default for this command (nothing is executed
# if this parameter is left blank).
#
#On Windows:
#
#ExecuteOnUpload=C:\\Windows\\system32\\mspaint.exe


[Card]

# The directives in this section affect the physical card settings

#
# UploadKey: The Eye-Fi upload key. It is in C:\Documents and Settings\
# -User-\Application Data\Eye-Fi\Settings.xml. This needs to be set for
# the server to function correctly.
#
UploadKey=4ff0ce34fda3ea9724e86f2530b44b59

Jeff Tchang said...

Rebooting will probably cause the Eye-Fi manager to start up again so you need to make sure it is shut down. Mac OS X is a unix like system. Your config file may not be correct because a # (a pound sign) in front of a line means the line is commented and hence is not active. So the line

#LogFile=.\\efpylog.txt

is basically meaningless. You have to remove the # sign to get it to be read. I recommend you set the LogFile as:

LogFile=efpylog.txt

E-mail me directly if you want a bit more help getting it to work on Mac OS.

Unknown said...

tbal said "It is an awesome product that seems to have lost itself in desperate attempts to force itself into the life of the consumer who purchased their product."

tbal, could you explain in what way the current version of the Eye-Fi Manager software, running on Mac OS X, is deficient for your needs in a manner that Jeff's Python-based server fulfills them?

I understand the void that it fills for Linux users, but I would appreciate it very much if you could take a few moments to provide feedback as a Mac OS X user.

Thanks in advance,

Berend

tBal said...

Bernard,

My initial response should have read a little more like "... desperate attempt to remain relevant after the sale"

For me, Jeff's server does what I always wanted Eye-fi to do: get the photos off of my card into a directory on my computer when they are both connected to the same wireless network. To me, all of the other stuff is fluff.

I would like the firmware to be updated to allow for RAW files.

Unknown said...

tBal said "desperate attempt to remain relevant after the sale ... get the photos off of my card into a directory on my computer when they are both connected to the same wireless network."

What gives you the impression that the Eye-Fi Manager software does not do exactly that, in an entirely server-less and GUI-less manner (ignoring for one second the icon in the Finder menu bar), just like Jeff's server? Throw in "Folder Actions" and it's already ahead of where the Python server is (as far as executing a specific program for every photo delivered is concerned).

As far as the "desperate" comment goes, I'm not sure what's at the root of that judgment, but suffice it to say that we have a pretty good understanding that "wireless photo transfers" are relevant to a number of distinct user categories, each with different and sometimes non-overlapping needs.

Thank you for your feedback - I do appreciate it.

Berend

tBal said...

Berend,

On your own forums @ eye.fi you state that "We already have enough of a challenge in convincing people that when they configure only a desktop destination their photos remain completely within their networks without ever passing through Eye-Fi's servers"

You have this problem because
users must 'register' a card and set it up through a browser on your company's site to even work at all.

If I buy a wifi card, it will work without having to register it with the manufacturer. If I buy an SD card, I also don't have to register it with the manufacturer for it to work as advertised.

My suggestion for eye-fi would be the following:
Allow 'basic' transfer operations without having to register, or do anything through the browser. Additional functionality would understandably require a more committed relationship between the consumer and the manufacturer. My 'desperate' comment speaks to this.

I like the stand alone server because I love the concept. I don't want it to go away even if the company does.

Swing by your forums to see if you can help me out with my card specific issues.

Unknown said...

tBal said "You have this problem because users must 'register' a card and set it up through a browser on your company's site to even work at all."

Actually, no, very few of our users indicate this to be a problem. As expressed by them, the thing that gives them the mistaken impression of photos leaving their networks even when operating in desktop-only mode is the visualization of their photos within a web application. We may have pushed the envelope a bit far and a bit too soon in blending the desktop and online application aspects and we're working on that.

"If I buy an SD card, I also don't have to register it with the manufacturer for it to work as advertised."

Right. And an SD card is just that. A plain old SD card. We do a tad bit more... How many times in the lifetime of your SD cards have you had to update their firmware? How many times have you received new (free) features and or performance improvements? There are many reasons for which our being in-the-loop during the first-time registration provides a far better product to our users and many of our desktop-only users, don't ever hear from us ever again (or login to the web application for that matter).

I couldn't locate you as tBal on the Eye-Fi Forums, so please feel free to point me at a thread and I'll see if I can help out.

Thanks,

Berend

tBal said...

tysonb on your forum.

"Actually, no, very few of our........" - my "Allow 'basic' transfer operations without having to register, or do anything through the browser." hits that squarely on the head.

I love the product - I am not totally in favour of the current implementation. I look forward to see what future upgrades your company produces.

Another suggestion would be some sort of hardware hybrid of a microSD card and a MicroSD adapter. The actual storage portion would be on the 'any MicroSD card will do' and the Eye-Fi magic stuff would go into the 'adapter portion. This way Eye-Fi could concentrate on their magic and let storage companies do their thing. If you guys use this, I want free stuff ;)

firefly said...

tBal and Berend,
I do enjoy reading your exchange but, why not take this conversation to the eyefi forums and let Jeff has his thread back.
Thanks

Fred said...

hi,
any new version with the "selective upload" feature ?
regards

MacUser655321 said...

Mac OS X users, UploadKey is stored in the file

/Users/{Username}/Library/Eye-Fi/Settings.xml

Be sure to match the card ethernet address (aka Card MacAddress) with your SD card. There will be more than one entry if you also have the Eye-Fi iPhone app installed.

fred said...

Jeff,

Please can you have a look at this log and see what is going wrong? It seems like it is almost working.... with the server running, when I take a picture my router flashes for a wifi connection and the server generates the log. Just no pictures appear on the computer. (I have blanked out ip addresses, upload key etc).

http://pastebin.com/m255663f0

PS. To get the upload key I used dave hanson's config program that calls it the 'unique key'. I presume this is the same thing?

Regards,
Fred

Jeff Tchang said...

@Fred I don't think the key is the same. From the looks of the log the thing that is wrong is the uploadkey.

-Jeff

fred said...

The upload key is:

378fb34d6129f587a527cab2f470806

(I have changed a few digits but that is the length of key I am using).

If that is not right,do you know how I can get the upload key (it is not shown on eyefi manager or in the settings.xml which looks like http://pastebin.com/m13328355)?

Thanks

Jeff Tchang said...

@Fred Setup your card to transfer files to your desktop using the official Eye Fi Manager. You need to go into the web browser settings and make sure the card is set to upload files to a local location on your computer. This will cause the program to write the uploadkey to the settings.xml.

aslam said...

Hello,
Sir
I want know about
which software are use to auto save my photos through Usb
camera to P C
my camera is connected to pc with usb if i shot a new snap i want save this snap auto to my path (selected folder )

Unknown said...

Hi Jeff,

The code works great and is much appreciated your time and efforts for doing this.

I have a question or maybe 2.

I wish to use your script locally this is fine and no problems. As I understand the eye fi card will search the local subnet for the eye fi server. This is working well.

Do you have any suggestions for working cameras remote to our site at our branch offices. The network is routed with the branch offices on all different subnet. This means that say our head office is on LAN IP 172.16.16.0/24 with eye-fi python server on 172.16.16.1.

Our remote offices are on 172.16.17.0/24 and above. Is there a good way to get this working?

I think that I read somewhere the card will try to contact the eye.fi servers if no local server is found. Is this correct? Would hijacking the dns record work pointing to the 172.16.16.1 server? This is sloppy and wish to avoid if at all possible.

Proxying through the normal eye-fi servers using a protocol is not ideal due to security policies.

Hope this makes sense.

Regards,
Jeremy

tudza said...

I'm not clear on exactly how the WiFi card knows to send to my PC running this script instead of the Eye-Fi server it usually goes to, but it worked for me.

Also, I believe I'm seeing that if an image file gets sent to my PC it is not going to the Eye-Fi server, is that correct?

tudza said...

Okay, I think I understand now.

When I was running the Eye-Fi manager, my images weren't going out to any Eye-Fi company servers either, the manager that comes with the card does roughly what this Python script does.

A definite advantage for those running Linux I imagine, but what does this do for you if you were running Windows?

Unknown said...

I have set this up on my home linux server and it is working well. I have only one area that I feel it could be significantly improved.

Observationally from using the PC client it seems that the tool can process many images coming off of the eye-fi card in parallel, whereas the python script must queue each image or file sequentially.

This results in an archive of a few dozen images taking much longer to download with the python server.

I have experience writing perl scripts to fork and use parallel processing, but have much less python experience. I think that this addition would be worth the effort for me to try to add the feature myself, but it may be much slower going for me. I'd be happy to collaborate.

Also please let me know if you are aware of a technical difficulty, or believe my observations are flawed and think I would be wasting my time.

DC said...

I have a Win Mobile 6.1 device. I have PythonCE installed, my key set in the script. I run the script and I get an Input screen that says "Press to stop server.

No pictures transfer and there is nothing in the log file except an indication that it is listening on port 59278. Any ideas?

CBailey said...

I've just installed this script, and I have to say I'm quite happy. However, since I'm extremely new to Python, I'm not currently able to add any features I want (Saving pictures to a different directory/drive, organizing downloads by date, security measures, etc.) Does anyone have source code of their modified versions? Jeff, did you ever finish the latest version of this?

Elm said...

Does the Eye-Fi card depend on Internet access, even when using your python standalone server?

Your server works great on my laptop, and successfully receives images from my camera. However, if I unplug my ADSL-router from my wireless router (so the local WLAN is still up, but there is no connection to the Internet), then the Eye-Fi card suddenly won't transfer files anymore. The server prints "Incoming connection from ...", and "Start Session response" (so there is some sort of communication going on between the card and the laptop), but the process stops there - no image data transferred.

Thanks for writing a truly great program!

Best regards,
Eivind

Unknown said...

This may be from way out in left field, but do you know if you can run this on a jailbroken iPhone with Python libraries installed and wifi tethering enabled? I can see where this could save a lot of cellular bandwidth as the photos wouldn't have to go to the eye-fi servers and then downloaded to the phone before they can be posted by an app...

Nightbreederz Entertainment (Atlanta) said...

I know this post hasnt been messed with in a long time BUT, I am a total newb to Python, I read all your instructions and got it installed and now Im confused as to what to do after i open the actual eyefi app file, If there are some instructions on to set this up to work for me ID REALLY APPRECIATE IT. If anyone can help on this I thank you in advance all i need are some instructions on how to start the actual file (EyeFiServer) I get this error I think but unsure as to how to change or implement what its asking for

"Warning: No configuration file specified! Run this server with the -h command.
[04/11/11 06:30PM][main] - Eye-Fi server started listening on port 59278
[04/11/11 06:30PM][main] - Press +C to terminate."




I keep getting this when i launch the main eyefi file

Bentley said...

I just had a thought: For authentication purposes, the meta data on the jpegs could be parsed for the camera serial number. A failed check could report the mis-match and stop the python app, thus adding another layer of protection against a jpeg insertion attack.

blewis said...

Hi Jeff,

Just a quick note to say thanks for developing and maintaining the Eye-Fi server!

Works great here on Ubuntu 10.04.

Using it to consume the photos to local raid disk, which wife's Picasa picks up on network mount folder scan, and also scp-ed to my Mac Mini for iPhoto import.

-Brian

Roarkie said...

Hi jeff, can you tell me if your system alows the download of files other than photos / video etc.

I have a device that stores data on an SD card and this would be great if we could get the information downloaded using eye-fi

eamonn

Thanks for the great work

Tad Pole said...

I really am stumped. I have the server, I found my key and put it in the settings, I started the server with the Settings.ini paramater, and it runs. I am not getting any uploaded pictures though. :( I have no idea why either. Can someone look at a snapshot of my console and maybe point me in a direction to help fix this?
photo is under:
http://www.ihatemostofyou.org/wp-content/uploads/python_console.jpg

thanks!

LinuxFreaks said...

I am trying to integrate the Eyefi-Config utility provided by David Hansen with the EyeFiServer.But the unique card key given by eyeficonfig -k does not match the uploadkey in settings.xml. Is there a way to derive uploadkey from unique card key from eyeficonfig.

Dudedolf said...

Hi,

This looks very good, i am looking to do something using the EyeFi cards and DirectMode as i need to images to go straight to the app. I tried to find the python script to take a look at the code but the domain is 'up for sale'. Do you have this script or do you have any pointers as to where i could start my quest?

Thanks
Rudy

tudza said...

Send me your email address and I can send you a copy of the script that I have from a while ago.

Dudedolf said...

Thanks doing it now :)

Montzerin said...

The links to download/ view the files are broken

Andrew Welker said...

I uploaded a copy to http://reqw.com/eyefi/EyeFiServer-v2.0.zip

Unknown said...

link to script:
http://code.google.com/p/eyefiserver/

Unknown said...

link to script:
http://code.google.com/p/eyefiserver/

Unknown said...

link to script:
http://code.google.com/p/eyefiserver/

Unknown said...

I dont know who posted the last comments, but that is definitely NOT the link to the latest version of EyeFiServer. Its old, and its specifically for linux, and it has issues.

EnricF said...

Hi guys, you are doing a great job! I would like to transfer the photos to a Gumstix Overo Fire board using your python server but I obtain this error:

root@overo:~/workspace/EyeFiServer-master/Release 2.0# python EyeFiServer.py -c
DefaultSettings.ini
Traceback (most recent call last):
File "EyeFiServer.py", line 21, in
import string
ImportError: No module named string

Any idea of what I am doing wrong?

Unknown said...

Great work, Jeff!
I was looking over your code trying to add email-notification, but I don't know how to handle.
Does the eyefi card send any command to tell the server that all pictures have been uploaded? I want then the server to send an email to the user if completed, started or interrupted.

Unknown said...

Haha. After I committed my debian version to code.google.com, Matthias Wirtz created a version for NAS .. http://mwits.eu/blog/2012/08/16/eye-fi-server-auf-der-diskstation/

Upon which, Thijs Eijenbaas created a setup for Synology ... http://thijs.elenbaas.net/2013/03/installing-an-eye-fi-server-on-a-synology-nas/

I just bought a Synology disk to find your code had already found its way to my machine already. Cool !

*-pike

Unknown said...

I've got this running on OSX Mavericks. It required some modifications whihc I'll try to post.

Unknown said...

This works on OSX, but takes some modifications. This is what I did:

Ok, so here are my instructions to make create an eyefi server so that you can have images transfer to your computer from an eyefi card without needing to have a user logged into the computer. Thank you to LCC for helping me get launchd to work, Jeff Chang for providing the python code for this, and Thijs Elenbaas for providing the tutorial for setting this up on a synology NAS which inspired me to try this on OSX.

Step 1. Install the eyefi software. They put the software on the card, so you just need to look for it there and run the installer.

Step 2. Using the eye-fi helper software, setup the preferences for card as you like and add the wifi network you need. You need to do this on the computer that you will be using as the eyefi server because it stores the local hostname of the computer on the card. You also specify the directory here that you want photos and videos to be uploaded to. I turned off cloud uploads and directaccess, but did turn on neverending memory on the card so that images will autodelete from the card.

Then, turn off the eyefi helper app and tell it not to load with startup

Step 3. Find the upload key for your eyefi card by going to ~/Libary/Eye-Fi/Settings.xml. You are looking for something like this:

long string of about 30 letters and numbers

You can also find the MAC address for the card in that file which is nice to have, especially if you use MAC addresses to restrict access to your wifi network(s).

Step 4. Then, you need to download the eyefi server software from: http://thijs.elenbaas.net/files/eyefiserver.tar.gz

For simplicity, I just put the eyefiserver folder at the top level directory of my computer

Step 5. Then, you have modify these eyefiserver files:
eyefiserver.conf.
host_name: Goto system preferences/Sharing and find the .local name for your computer and insert it here
host_port: leave this alone
upload key: insert the value you found above
upload directory: this should match the upload directory you specified in the eye-fi setup (I suspect these must match)
S99EyeFiServer.sh
PIDFILE=/eyefiserver/eyefiserver.pid
DSTPATH=/eyefiserver
PYTHONPATH=/usr/bin there is a difference in where mac os keeps its python files. this is the location on mavericks, I have no idea if it is also the location on previous versions of OSX)

Step 6. Setup a global daemon to autostart the eyefi server whenever you boot the computer. You start by making a .plist. I called mine com.eyefi.load. Here it is:




Label
com.eyefi.load
ProgramArguments

/eyefiserver/bin/eyefiserver.py
/eyefiserver/etc/eyefiserver.conf
/eyefi/eyefiserver/var/eyefiserver.log

RunAtLoad




if you put your eyefiserver in a different directory, you will need to change this.

Step 7. Load the global daemon. I used LaunchControl, but you can also do this via command line.

Step 8. Start taking pictures!

Unknown said...

Revised OSX Instructions:

New Instructions:
Step 1. In OSX Server, turn on Python in Websites

Step 2. Install the eyefi software. They put the software on the card, so you just need to look for it there and run the installer.

Step 3. Using the eye-fi helper software, setup the preferences for card as you like and add the wifi network you need. You need to do this on the computer that you will be using as the eyefi server because it stores the local hostname of the computer on the card. You also specify the directory here that you want photos and videos to be uploaded to (not 100% sure that you need to do this). I turned off cloud uploads and directaccess, but did turn on neverending memory on the card so that images will autodelete from the card.

Then, turn off the eyefi helper app and tell it not to load with startup.

Step 4. Find the upload key for your eyefi card by going to ~/Libary/Eye-Fi/Settings.xml. Open it with Xcode if you can, much easier to find things. You are looking for something like this:

long string of about 30 letters and numbers

You can also find the MAC address for the card in that file which is nice to have, especially if you use MAC addresses to restrict access to your wifi network(s).

Step 5. Then, you need to download the eyefi server software from:http://thijs.elenbaas.net/files/eyefiserver.tar.gz

I put it into Applications.

Step 6. Then, you have modify install.sh before running it.

Install.sh:

SRCPATH=/Applications/eyefiserver/eyefiserver

DSTPATH=/Applications/eyefiserver/eyefiserver

PYTHONPATH=/usr/bin

RCDPATH=/Applications/eyefiserver/rc.d

S99EyeFiServer.sh:

PYTHONPATH=/usr/bin

if you put your eyefiserver in a different directory, you will need to change these paramaters.

Step 7. Run install.sh from terminal. It will ask you for your Upload key (the long 30 digit number) and the directory you want to save files to. I made mine a folder called “Pictures” that I shared in OSX Server.

install.sh may spit out some errors, BUT if you’ve got the important stuff right, it will say the eyefi server has started and you are in business.

At this point, your OSX Server is running an eyefi server. Try taking a few pictures with your camera. In a minute or two, they ought to show up in your designated folder.

However, you want this to be running headless, without a logged in user.

Step 8. Setup a global daemon to autostart the eyefi server whenever you boot the computer. You start by making a .plist. I called mine com.eyefi.load.

Here it is:



<plist version="1.0”>

<dict>

<key>Label</key>

<string>com.eyefi.load</string>

<key>ProgramArguments</key> <array>

<string>/Applications/eyefiserver/eyefiserver/bin/eyefiserver.py</string> <string>/Applications/eyefiserver/eyefiserver/etc/eyefiserver.conf</string> <string>/Applications/eyefiserver/eyefiserver/var/eyefiserver.log</string>

</array>

<key>RunAtLoad</key>

<true/>

</dict>

</plist>

if you put your eyefiserver in a different directory, you will need to change these paramaters.

chown this file to root:wheel

Step 9. Load the global daemon. I used LaunchControl, but you can also do this via command line.

Step 10. Start taking pictures!

Issues: The date/time stamping is way off. For me, they are stamped 8 hours behind when the picture was taken. I am in PST, which is GMT-8. I had my Nikon d3100 set to be in the Pacific Time Zone. If I change it to be in GMT, then the time stamping works out. I’m not sure what the implications are of having the camera set in the wrong time zone. I am not sure how else this could be fixed.

GigaGuy said...

Just curious. This only write the file to a local directory right? this doesnt handle smumug, facebook, etc? Can I run both this and the windows one at the same time if that's the case?

My issue with the windows version is I want to write to my NAS, and the directory isn't always mapped after windows reboots.

Unknown said...

Is there a way to instruct the Eye-Fi card to connect preferentially to the local server? Mine occasionally connects to the local server, but usually connects to the Eye-Fi Server first.

Unknown said...

The problem was I needed to turn off both:

a) uploading to EyeFi View
b) uploading to Flickr

After doing this, the card connects reliably to the local server.