How to connect to a Sony camera via Wifi from Linux

19,820

You might want to check out this Playmemories Alternative project. One outstanding developer has reverse-engineered the proprietary parts of Sony's modified PTP/IP protocol, and managed to get it working with a combination of a custom Python script & GPhoto2.

The way Sony transfers pictures is via PTP/IP (Picture Transfer Protocol over Internet Protocol). The moment you enable the 'Send to Computer' option from the Camera it starts broadcasting UPNP UDP packets across the network to multicast address (239.255.255.250:1900). This is also known as Simple Service Discovery Protocol (SSDP). At the same time the camera starts up A PTP/IP server on port 15740. The UPNP packets contain all the connection details. The Playmemories app (or sony-pm-alt.py) see these packets and then turn around an hit the PTP/IP servers and transfer the pictures.

Sony requires some non-standard packets to display the 'Sending...' on the camera. This also goes for the automatic shut down feature when done. Without this you have about 2 minutes to transfer the picture before the camera stops and you have no confirmation that it worked. Also, the camera will remain on so you can't walk away or else your battery will continue to drain. I was hoping there would be one magic packet to turn these options on, but this doesn't seem to be the case. Doing a series of tcpdumps I was able to determine what packets make it work. I started off with over a 100 packets being needed and have finally narrowed it down to 23 packets (update: 4 packets to start and 3 packets to end). I was also hoping I could send these packets directly from python using a different tcp session than gphoto, but no luck. So, I ended up really hacking up the libgphoto code to make this work. The developer of libgphoto was then kind enough to work with me and incorporate changes to make things work without the hacking.

I haven't tested it myself, but it looks like @falk0069 has done yeoman's work providing a starting point for connecting to Sony wifi-enabled cameras.

Share:
19,820

Related videos on Youtube

Cyril Graze
Author by

Cyril Graze

Updated on September 18, 2022

Comments

  • Cyril Graze
    Cyril Graze over 1 year

    Sony cameras come with Wifi connectivity, but their software is only distributed for Mac and Windows. (www.sony.net/pm/)

    How can I connect to it from Linux? (Specifically, Fedora 22 <--> DSC-HX60)

    When I enable the Wifi push, the camera tells me I need to first add the device information via USB. This seems to only be possible with PlayMemories software mentioned above.

    Has anyone figured out how to do the same in Linux?

    Ironically, it seems the camera itself runs on BusyBox :/ http://oss.sony.net/Products/Linux/DI/DSC-HX60V.html

    p.s. I'd rather not use Wine, or a VM in order to run Windows software.

  • Cyril Graze
    Cyril Graze over 3 years
    Hey @bjmc, thanks for the answer, sorry I didn't reply in time, as the response came in a couple years after the question so I lost track. I ended up using their app for Android. Did you ever get a chance to test this? Or any updates?