So this fall I’ve been getting into photography and with my super small new camera (Lumix GM1) I’m looking forward to taking horrendous photos of unexpecting people.
As the nerd I am, however, I deem that no tasks should be done repeatedly and manually. This is also true for transferring photos from camera to safety. Ideally, you would only power on the camera and the photos would just sync to your computer and/or cloud service. As the year is 2015 you would expect a pretty much seamless (and wireless) user experience for scenarios like this, but alas, that is not the case. At least on this Lumix 2013 model the WiFi is dog-slow and stubborn, and photos can not be mass-transferred. I mean, what the hell?
I came up with a better plan. Why not just plug in the camera to my always-online Raspberry Pi USB hub and let some UNIX magic take care of the photo backup and upload? This seems so much more straight-forward than interacting with the camera’s user interface. Plus, the data transfer is much faster through USB compared to the camera’s WiFi.
So let’s get started. Connect your camera to the USB port and pick out the vendor and product ID’s:
Add a hook to your
/etc/udev/rules.d/ so that a script gets run every time the camera gets connected:
Pay attention to the manpages of udev where it is stated that RUN “can only be used for very short running tasks.” Long running processes are encouraged to “immediately detach from the event process itself.”
Thus we’ll spawn of a background process inside our scripts to not block udev’s execution. We’ll also use
rsync for intelligent backing up of the photos:
And there we go, everytime you plug in your camera to the USB hub, the photos are automatically backed up.
If you do decide to go by the wireless approach, just run a Samba service on your Linux machine and save the camera’s connection for fast access.
In the next post, we’ll automate sending the photos to a cloud service for easy access.