RICOH THETA API Over USB Cable - (X, Z1, SC2, V, S, SC models)

Using gphoto2 on a Raspberry Pi to control the RICOH THETA Over a USB Cable

I have gphoto2 working on the Raspberry Pi. This is installable with apt and is easier to use than ptpcam.

In the example below, I set the shutter chirp to 30% of sound volume and then verify that the setting in correct.

pi@raspberrypi ~/Development/libptp2-1.2.0 $ gphoto2 --set-config=502c=30
pi@raspberrypi ~/Development/libptp2-1.2.0 $ gphoto2 --get-config=502c
Label: PTP Property 0x502c
Type: MENU
Current: 30
Choice: 0 0

In the next example, I download three files to my local disk

pi@raspberrypi ~/Development/gphoto2 $ gphoto2 --get-file 1-3
Downloading 'R0011757.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as R0011757.JPG
Downloading 'R0011758.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as R0011758.JPG
Downloading 'R0011759.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as R0011759.JPG
pi@raspberrypi ~/Development/gphoto2 $

Download thumbnails

pi@raspberrypi ~/Development/gphoto2 $ gphoto2 --get-thumbnail 4-6
Downloading 'R0011761.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as thumb_R0011761.jpg
Downloading 'R0011763.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as thumb_R0011763.jpg
Downloading 'R0011764.JPG' from folder '/store_00010001/DCIM/100RICOH'...
Saving file as thumb_R0011764.jpg
pi@raspberrypi ~/Development/gphoto2 $

Components I Used

  • Raspian Jessie
  • gphoto2
  • Raspberry Pi 2
  • THETA plugged into Raspberry Pi with USB cable

Versions

Showing installed gphoto2 version with apt-cache

pi@raspberrypi ~ $ apt-cache show gphoto2
Package: gphoto2
Version: 2.5.4-1
Architecture: armhf
Maintainer: Debian PhotoTools Maintainers <pkg-phototools-devel@lists.alioth.deb ian.org>
Installed-Size: 802
Depends: libaa1 (>= 1.4p5), libc6 (>= 2.4), libcdk5, libexif12, libgphoto2-6 (>= 2.5.2), libgphoto2-port10 (>= 2.5.2), libjpeg8 (>= 8c), libncurses5 (>= 5.5-5~) , libpopt0 (>= 1.14), libreadline6 (>= 6.0)
Suggests: gtkam, gthumb
Homepage: http://www.gphoto.org/proj/gphoto2/
Priority: extra
Section: utils
Filename: pool/main/g/gphoto2/gphoto2_2.5.4-1_armhf.deb
Size: 169204
SHA256: 71baeac776e762229ad31c550a493a82a8fd5f2a435dd65a674d0030d14f8991
SHA1: 7018ffe0a8432ffcfbb08887f27b2ae22224b2fd
MD5sum: a522290cef04bf1cf7c6cdb4d0cf37d5
Description: digital camera command-line client
The gphoto2 library can be used by applications to access various
digital camera models, via standard protocols such as USB Mass Storage
and PTP, or vendor-specific protocols.
.
This package provide the gphoto2 command-line frontend.

Showing installed OS on Raspberry Pi

pi@raspberrypi ~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian

Troubleshooting

Right now, I get this error when I first step the Raspberry Pi. I haven’t bothered to disable gvfs-gphoto2-volume-monitor at boot yet. I’ll figure this out in the future.

pi@raspberrypi ~ $ gphoto2 --about

*** Error ***
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (Device or resource busy). Make sure no other program (gvfs-gphoto2-volume-monitor) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device.
*** Error (-53: 'Could not claim the USB device') ***

It looks like I can prevent the daemon in /usr/lib/gvfs/gvfsd to run. In the meantime, I’m going to kill the processes before I start the tests.

You can find the process to kill with ps aux |grep gvfs

I also killed the spawner. In my test this morning, I needed to kill this in addition to gvfs-gphoto2-volume-monitor

Test it

pi@raspberrypi ~ $ gphoto2 --about
About the camera driver:
PTP2 driver
(c) 2001-2005 by Mariusz Woloszyn <emsi@ipartners.pl>.
(c) 2003-2014 by Marcus Meissner <marcus@jet.franken.de>.
This driver supports cameras that support PTP or PictBridge(tm), and
Media Players that support the Media Transfer Protocol (MTP).

Enjoy!

Remove gvfs-gphoto2-volume-monitor

As I do not plan to mount the THETA as a storage device from the Raspberry Pi, I removed gvfs virtual filesystem.

Remove gvfs-backends

pi@raspberrypi ~ $ sudo apt remove gvfs-backends
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  gvfs-backends

Test to make sure it still works.

pi@raspberrypi ~ $ gphoto2 -l
There is 1 folder in folder '/'.                                               
 - store_00010001
There is 1 folder in folder '/store_00010001'.

Reboot

gphoto2 now works after reboot without having to kill the processes.

pi@raspberrypi ~ $ gphoto2 -l
There is 1 folder in folder '/'.                                               
 - store_00010001
There is 1 folder in folder '/store_00010001'.
 - DCIM
There is 1 folder in folder '/store_00010001/DCIM'.
 - 100RICOH
There are 0 folders in folder '/store_00010001/DCIM/100RICOH'.