dgrant / eyefiserver2

A standalone Eye-Fi server in Python, for Linux
GNU General Public License v3.0
140 stars 40 forks source link

Latest eye-fi firmware doesn't play nice with eyefiserver2? #3

Closed dgrant closed 9 years ago

dgrant commented 10 years ago

See this bug on eyefiserver project:

https://code.google.com/p/eyefiserver/issues/detail?id=8

dgrant commented 10 years ago

It looks like the earliest firmware version where this occurs is 5.0009. I have 5.0001 eye-fi card apparently... It looks like transfermode in the response should match what is in the request. And upsyncallowed should maybe be true instead of false? But according to this comment: https://code.google.com/p/eyefiserver/issues/detail?id=8#c4 he tried setting these values differently and had no differenc.e

dgrant commented 10 years ago

This lines of code of interest:

    transfermodeElement = doc.createElement("transfermode")
    transfermodeElementText = doc.createTextNode("2")
    transfermodeElement.appendChild(transfermodeElementText)

and upsyncallowedElement = doc.createElement("upsyncallowed") upsyncallowedElementText = doc.createTextNode("false") upsyncallowedElement.appendChild(upsyncallowedElementText)

dgrant commented 10 years ago

I posted the following over at: https://code.google.com/p/eyefiserver/issues/detail?id=8. Duplicating here for reference. I was looking at the code that is used here: http://bazaar.launchpad.net/~jordens/eyefi/trunk/view/head:/eyefi/server.py

nymph, did you try setting transfermodetimestamp to be equal to the request?

Also, did anyone check this project to see if it works for them? https://launchpad.net/eyefi

If that works we can do what they do... They generate snonce every time using "random.getrandbits(128)", copy transfermode of client, copy transfermodetimestamp of client, and upsyncallowed to false.

darkseer commented 10 years ago

I got it to work with the following changes:


918c918
<        snonceElementText = doc.createTextNode("99208c155fc1883579cf0812ec0fe6d2")
---
>         snonceElementText = doc.createTextNode("69804285196b055a5540f9b7f0cd1211")
922c922
<         transfermodeElementText = doc.createTextNode("2")
---
>         transfermodeElementText = doc.createTextNode("33282")
930c930
<         upsyncallowedElementText = doc.createTextNode("false")
---
>         upsyncallowedElementText = doc.createTextNode("true")

This transfer mode allows both .NEF and .jpeg to be downloaded. Not sure if this helps or not. It works for me, YMMV. For just jpeg transfermode 32770. This worked with the latest firmware as of 11/04/2013.

-Glenn

dgrant commented 10 years ago

I need to test this to confirm it doesn't break my firmware. Can anyone else test and post your firmware version?

dukesrg commented 10 years ago

I have 5.2006, but will be able to test only on the next tuesday.

dgrant commented 10 years ago

ok, thanks

dgrant commented 10 years ago

I'm having second thoughts about these changes. I looked at two other eye-fi server implementations (https://code.google.com/p/sceye-fi/wiki/UploadProtocol and http://bazaar.launchpad.net/~jordens/eyefi/trunk/view/head:/eyefi/server.py) and they both do things a bit differently than we do. Here is my proposed patch:

diff --git a/usr/local/bin/eyefiserver.py b/usr/local/bin/eyefiserver.py
index c5b38ff..2a886d6 100755
--- a/usr/local/bin/eyefiserver.py
+++ b/usr/local/bin/eyefiserver.py
@@ -23,6 +23,7 @@ import cgi
 import time
 from datetime import timedelta

+import random
 import sys
 import os
 import socket
@@ -915,22 +916,21 @@ class EyeFiRequestHandler(BaseHTTPRequestHandler):
         credentialElement.appendChild(credentialElementText)

         snonceElement = doc.createElement("snonce")
-        snonceElementText = doc.createTextNode("99208c155fc1883579cf0812ec0fe6d2")
+        snonceElementText = doc.createTextNode("%x" % random.getrandbits(128))
         snonceElement.appendChild(snonceElementText)

         transfermodeElement = doc.createElement("transfermode")
-        transfermodeElementText = doc.createTextNode("2")
+        transfermodeElementText = doc.createTextNode(handler.extractedElements["transfermode"])
         transfermodeElement.appendChild(transfermodeElementText)

         transfermodetimestampElement = doc.createElement("transfermodetimestamp")
-        transfermodetimestampElementText = doc.createTextNode("1230268824")
+        transfermodetimestampElementText = doc.createTextNode(handler.extractedElements["transfermodetimestamp"])
         transfermodetimestampElement.appendChild(transfermodetimestampElementText)

         upsyncallowedElement = doc.createElement("upsyncallowed")
         upsyncallowedElementText = doc.createTextNode("false")
         upsyncallowedElement.appendChild(upsyncallowedElementText)

-
         startSessionResponseElement.appendChild(credentialElement)
         startSessionResponseElement.appendChild(snonceElement)
         startSessionResponseElement.appendChild(transfermodeElement)

It's based on what is done in the other two code-bases I've provided URLs to. I've tested that it works for me. If anyone else can test it that would be great.

dgrant commented 10 years ago

Hopefully fixed by commit bd2e23b4a815d3d79c9f1e1fa3656b2cbd0747a7

leshus commented 10 years ago

Additional changes has been required for my configuration (Eye-Fi Card/5.0019)... Now it works. Thx...

$ diff orig/eyefiserver.py eyefiserver.py
928c928,929
<         upsyncallowedElementText = doc.createTextNode("false")
---
>         # upsyncallowedElementText = doc.createTextNode("false")
>         upsyncallowedElementText = doc.createTextNode("true")
dgrant commented 10 years ago

Can anyone else test to confirm that changing upsyncallowed to true does not break things? I will test soon on my two eye-fi cards. Thanks.

dukesrg commented 9 years ago

Just checked, my Pro X2 fw 5.2010 works both fine with upsyncallowed true false.

dgrant commented 9 years ago

Awesome, ok, I'll do a test soon and commit!

dgrant commented 9 years ago

Ok, I've tested it and it works. I also noticed 2 comments from WAY back on this thread: https://code.google.com/p/eyefiserver/issues/detail?id=8 where setting this to true works.