Search:  
Gentoo Wiki

Gphoto2

This article is still a Stub. You can help Gentoo-Wiki by expanding it.

Wikipedia has an article on:
Gphoto

Contents

Introduction

This article will show you how to access photos of your digital camera with gphoto2. Note that gphoto2 is used for cameras that primarily (or only!) use the PTP standard. If your camera supports USB mass storage only, gphoto2 is not what you need, you better check out this article instead.

Installation

Camera example: Canon Powershot S230 (=IXUS v3)

First you will need to emerged gphoto2:

Code: get gphoto2
# emerge gphoto2

Then switch on your camera and check if it is autodetected:

Code: detect camera
# gphoto2 --auto-detect 

[...]         
Canon Digital IXUS v3 (normal mode) usb:003,011   

If you see output like this, it obviously worked.


However, if it doesn't, you might still be able to try your luck with the following:

Code: cross your fingers...
# gphoto2 --get-all-files


Assuming the auto-detect worked fine, add the user to the groups plugdev,usb. That will make it unnecessary to grab photos as user root. The group can also be changed in /etc/hotplug/usb/usbcam.

Code: add user to plugdev and usb groups
# gpasswd -a your_user_name plugdev
# gpasswd -a your_user_name usb

Now, create a new directory:

Code: create new directory
# mkdir photos
# cd photos

Finally, you can transfer all files from your camera:

Code: grab photos
# gphoto2 --get-all-files

Capturing

Capturing is the ability of gphoto to instruct your camera to take pictures and to download them from the camera's memory instantly.

Have a look at the table of supported cameras at gphoto's homepage (link at the bottom of this article).

Note: Even if your camera is listed as supported, it might not be supported by the version you just installed.

If things don't work you might have to upgrade.

Assuming that your camera is supported, issue the following command in directory writable for your user:

Code: Capture images from camera

$ gphoto2 -F <count> -I <interval> --filename="%f".jpg

count is the number of pictures you want to take (0 for infinite) and interval is the time gphoto will idle between two pictures in seconds.

Automount with gphotofs and autofs

It is possible to have an automatic mount for the camera by combining autofs and gphotofs. The tricky part is to setup the map for autofs and to get an ebuild for gphotofs for use in an overlay.

First, make sure your kernel supports FUSE. If it doesn't, you obviously have to recompile and reboot before continuing.

Linux Kernel Configuration: Required Kernel options for FUSE support
File systems
 <*> Filesystem in Userspace support


Add gphotofs. Unfortunately it hasn't made its way to the portage tree yet but you can download an ebuild from here. You need to know how to add an ebuild to a local overlay.

After you added the gphotofs ebuild to your local tree, emerge both autofs and gphotofs:

Code: get autofs and gphotosfs
# emerge autofs gphotofs


Configure autofs by editing auto.master. Enter mountpoint, map and options:

File: /etc/autofs/auto.master
 
    # Format of this file:
    # mountpoint   map                     options
    /mnt           /etc/autofs/auto.mnt    --timeout=5 --ghost
  


Edit the map, auto.mnt in this case. A directory photos is automatically created by autofs with gphotosfs's fuse filesystem type The syntax is weird, but it works:

File: /etc/autofs/auto.mnt
 
  cdrom           -fstype=iso9660,ro              :/dev/cdrom
  photos          -fstype=fuse,ro,allow_other     :gphotofs
  


Add autofs to the collection of automatically started init scripts and launch it:

Code: Code Title

$ rc-update add autofs default

$ /etc/init.d/autofs start

Now just plug your camera and go to /mnt/photos, you should be able to access all pictures automatically now.

Notes

If you have set the CAMERA= environment variable in /etc/make.conf to your camera's manufacturer, make sure that your camera model is actually supported under said flag. For example, many cameras (such as the Canon Powershot S3 IS, S5 IS, Canon Powershot A590 IS, A540) are only accessible through PTP mode. These cameras must have "ptp2" set in CAMERA= rather than the brand-specific driver, such as "canon".

Canon Powershot G9

To use Canon Powershot G9 you need to edit the /etc/hotplug/usb/usbcam.usermap and add the following line

Code: /etc/hotplug/usb/usbcam.usermap
 #Canon Powershot G9 (PTP mode)

usbcam 0x0003 0x04a9 0x315a 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000

Links

Retrieved from "http://www.gentoo-wiki.info/Gphoto2"

Last modified: Sun, 28 Sep 2008 09:12:00 +0000 Hits: 18,241