How to connect a digital camera by USB to Ubuntu/Linux

; Date: Wed Oct 12 2022

Tags: Linux »»»» Linux Photography

Connecting to digital cameras via USB lets you easily browse the images or videos like any other disc. Installing a couple things we can do this as easily on Linux as on Mac or Windows.

On my macOS laptop I grew accustomed to retrieving pictures from the camera via the USB cable. You simply attach the cable between camera and computer, and voila the camera's SD card appears in the Finder for macOS, or in the Explorer on Windows. It's very quick, and much easier than fumbling with the SD card, and finding the SD card adapter to attach it to your computer.

But, on Ubuntu 22.04 the out of the box experience is that nothing happens after attaching the USB cord between camera and laptop.

I have a Panasonic Lumix ZS-35 -- an excellent pocket-sized camera. The official Panasonic documentation for connecting Lumix camera's to computers says the supported operating systems are various releases of Windows and macOS, with nary a peep about Linux support. Another official Panasonic page does describe (support-uk.panasonic.eu) Linux support, saying that their cameras "install as a 'Mass Storage' device" and that such support is generally bundled with the Linux operating system distro's.

I'm assuming the same is true for digital cameras from other manufacturers.

In my case, connecting the camera via USB to my laptop did not result in Ubuntu automatically recognizing and mounting the SD card.

It turns out that support for digital cameras is baked into the libgphoto2 library, and that there are several projects under the (www.gphoto.org) gPhoto umbrella. This library contains support for digital camera's, and there are some very interesting capabilities to explore. For example, one of the applications, Entangle, says it supports "tethered shooting" which is about remotely controlling a camera.

For the purpose here, of mounting a digital camera over USB on a Linux system, the solution is (www.gphoto.org) gphotofs. This is a FUSE filesystem for mounting a digital camera, specifically its storage medium, on a Linux computer.

Installing this is trivial:

$ sudo apt-get install gphotofs

Once that's done connecting the camera via USB to Ubuntu results in this:

This shows the LUMIX camera mounted as a file system, and I can easily browse all the files as normal.

Since there are other applications listed on the gPhoto website, let's try with those as well.

This is DigiKam browsing the files on my camera. The file browser at the bottom shows a nice view of some pictures I've recently taken.

In Shotwell, the camera showed up as a Mass Storage device just as Panasonic suggested it was. It lets us browse the same pictures.

And here we have Darktable in the add to library page. Emily Dickinson must work on the Darktable team because everything is in lower case. In any case, you can see the file names of files on the SD card inside the camera.

GIMP is also listed on the gPhoto website, but I did not see how to browse the camera or import from the camera in GIMP.

This was about as far as I could get with Entangle. Entangle says it interfaces with cameras in PTP mode. Therefore, when connecting the cable, on the Lumix display tell it to connect in PTP, after which you run Entangle. Linux will have mounted the camera's file system, and Entangle shows a dialog box asking if it should unmount the camera. Tell it to do so, and then Entangle will be able to interact with the camera. Unfortunately, the Lumix ZS-35 camera I have doesn't support enough stuff for Entangle to do image capture.

Summary

A few years ago I wrote an outline of how to transition from macOS to Linux, see: How to replace macOS with a fully open source Linux system. This issue is just one item, how to interface with digital cameras.

Fortunately this particular need, accessing the storage device inside a digital camera, is very easy to resolve.

About the Author(s)

(davidherron.com) David Herron : David Herron is a writer and software engineer focusing on the wise use of technology. He is especially interested in clean energy technologies like solar power, wind power, and electric cars. David worked for nearly 30 years in Silicon Valley on software ranging from electronic mail systems, to video streaming, to the Java programming language, and has published several books on Node.js programming and electric vehicles.