colacat4
Posts: 5
Joined: Wed Aug 14, 2013 12:58 pm

Gphoto2 Error (-60: 'Could not lock the device')-Canon700D

Thu Feb 20, 2014 12:00 pm

Dear all:

I'm desperately in need of help with building a connection on my Rpi between
My SLRs (Canon EOS 700D and 300D) and Gphoto2. I need to use it as my major
experimental monitoring method. I installed Gphoto2 from apt-get, I can
auto-detect my cameras but can't do any further.

*pi@... ~ $ gphoto2 --auto-detect*

Code: Select all

Model                          Port                                            
----------------------------------------------------------
USB PTP Class Camera           usb:001,013  

*pi@... ~ $ gphoto2 --summary*

Code: Select all

*** Error ***              
An error occurred in the io-library ('Could not lock the device'): Camera is
already in use.
*** Error (-60: 'Could not lock the device') ***       

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list <gphoto-devel@...>, please run
gphoto2 as follows:

    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --summary

Please make sure there is sufficient quoting around the arguments.

pi@... ~ $ gphoto2 --capture-image*

Code: Select all

*** Error ***              
An error occurred in the io-library ('Could not lock the device'): Camera is
already in use.
ERROR: Could not capture image.
*** Error (-60: 'Could not lock the device') ***       

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list <gphoto-devel@...>, please run
gphoto2 as follows:

    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt
gphoto2 --capture-image

Code: Select all

Please make sure there is sufficient quoting around the arguments.

*pi@... ~ $ gphoto2 --debug*
0.000878 main(2): ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG
MESSAGES TO THE MAILING LIST:
0.002577 main(2): gphoto2 2.4.14
0.003870 main(2): gphoto2 has been compiled with the following options:
0.005329 main(2):  + gcc (C compiler used)
0.006623 main(2):  + popt (mandatory, for handling command-line parameters)
0.008435 main(2):  + exif (for displaying EXIF information)
0.009599 main(2):  + cdk (for accessing configuration options)
0.009790 main(2):  + no aa (for displaying live previews)
0.010329 main(2):  + jpeg (for displaying live previews in JPEG format)
0.010508 main(2):  + readline (for easy navigation in the shell)
0.011089 main(2): libgphoto2 2.4.14
0.011385 main(2): libgphoto2 has been compiled with the following options:
0.011950 main(2):  + gcc (C compiler used)
0.012505 main(2):  + ltdl (for portable loading of camlibs)
0.012715 main(2):  + EXIF (for special handling of EXIF files)
0.012915 main(2): libgphoto2_port 0.8.0
0.015690 main(2): libgphoto2_port has been compiled with the following
options:
0.015893 main(2):  + gcc (C compiler used)
0.016048 main(2):  + ltdl (for portable loading of camlibs)
0.016202 main(2):  + USB (libusb, for USB cameras)
0.016409 main(2):  + serial (for serial cameras)
0.016575 main(2):  + no resmgr (serial port access and locking)
0.016788 main(2):  + no ttylock (serial port locking)
0.016955 main(2):  + no lockdev (serial port locking)
0.017128 main(2): CAMLIBS env var not set, using compile-time default
instead
0.017295 main(2): IOLIBS env var not set, using compile-time default instead
0.017689 setting/gphoto2-setting.c(2): Creating $HOME/.gphoto
0.025769 setting/gphoto2-setting.c(2): Loading settings from file
"/home/pi/.gphoto/settings"
0.027204 gp-camera(2): Freeing camera...
0.027555 gphoto2-port(2): Freeing port...
0.027822 gphoto2-filesystem(2): resetting filesystem
0.028040 libgphoto2/gphoto2-filesys.c(2): Clearing fscache LRU list...
0.028211 libgphoto2/gphoto2-filesys.c(2): fscache LRU list already empty
0.028378 gphoto2-filesystem(2): Internally deleting all folders from '/'...
0.028566 gphoto2-filesystem(2): Lookup folder '/'...
0.028741 gphoto2-filesystem(2): Found! / is 0x1a89b18
0.028908 gphoto2-filesystem(2): Recurse delete folder 0x1a89b18//

Please help me to solve it. I found there are many people who had my problem
as well but couldn't find a solution. THank you very much for helping in
advance.

Sincerely, Simiao

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Gphoto2 Error (-60: 'Could not lock the device')-Canon70

Thu Feb 20, 2014 3:47 pm

This is only a guess - I am in the process of installing gphoto2 to check...

Is there any reason to believe that gphoto2 remembers the status of the camera between one command-line invocation and the next?

So although gphoto2 --auto-detect can find your connected camera, maybe gphoto2 --summary and gphoto2 --capture-image don't know which camera they are supposed to be operating on?

Maybe configuring the camera prior to asking for some action would do the trick - perhaps -

Code: Select all

gphoto2 --auto-detect --capture-image
?
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Gphoto2 Error (-60: 'Could not lock the device')-Canon70

Thu Feb 20, 2014 5:11 pm

My guess was wrong.

This worked for me -

Code: Select all

pi@raspberrypi ~ $ gphoto2 --auto-detect
Model                          Port
----------------------------------------------------------
Canon EOS 450D (PTP mode)      usb:001,014
pi@raspberrypi ~ $ gphoto2 --capture-image
New file is in location /capt0000.jpg on the camera
pi@raspberrypi ~ $ 
But what this does not show you is that the camera seems to drop out of usb-remotely-controlable mode after each run of gphoto2. It seems the LCD screen on the back must be showing BUSY for gphoto2 to be able to communicate with it. This can be toggled by setting the camera to OFF then to ON again.


I assume there must be some simple way of modifying this behaviour, but I can't see anything in the online docs.
http://www.gphoto.org/doc/manual/ref-gphoto2-cli.html

Hope that helps a bit. Good luck with your project.

[A little later: ] I've just found this, which seems directly related to my experience and perhaps explains yours?
https://github.com/raspberrypi/linux/issues/218
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Gphoto2 Error (-60: 'Could not lock the device')-Canon70

Fri Feb 21, 2014 11:00 am

An update.

Everything seems to work as expected using gphoto2 v2.5.3 built using libgphoto2 v2.5.3.1

The BUSY indicator on the LCD screen was a diversion - I think that is probably ON while the camera is reading the contents of the SD card.
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

cfreyberg
Posts: 4
Joined: Sat Jun 15, 2013 2:46 am

Re: Gphoto2 Error (-60: 'Could not lock the device')-Canon70

Wed Mar 05, 2014 4:21 am

Post by DeeJay » Fri Feb 21, 2014 12:00 pm
An update.

Everything seems to work as expected using gphoto2 v2.5.3 built using libgphoto2 v2.5.3.1
How did you install v2.5.3, DeeJay?

(apt-get upgrade returns v2.4.14 for me on Raspbian 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l)

Thanks Chris

User avatar
DeeJay
Posts: 2027
Joined: Tue Jan 01, 2013 9:33 pm
Location: East Midlands, UK

Re: Gphoto2 Error (-60: 'Could not lock the device')-Canon70

Thu Mar 06, 2014 11:18 am

cfreyberg wrote: How did you install v2.5.3
Build from source.

Download libgphoto2-2.5.3.1.tar.gz from http://sourceforge.net/projects/gphoto/ ... o/2.5.3.1/

Download gphoto2-2.5.3.tar.gz from http://sourceforge.net/projects/gphoto/ ... oto/2.5.3/

Remove the 'official' version installed from the Rasbian repository -

Code: Select all

sudo apt-get purge gphoto2
Install a few development libraries as pre-requisites -

Code: Select all

sudo apt-get install libpopt-dev -y
sudo apt-get install libltdl-dev -y
sudo apt-get install libusb-dev -y
sudo apt-get install libusb-1.0-0-dev -y
(I'm not sure if you need both versions of libusb ?)

Then it's just a 'standard' configure - make - make install sequence for each of the downloads, as documented in their own INSTALL files -

Code: Select all

cd ~
tar zxvf libgphoto2-2.5.3.1.tar.gz
cd libgphoto2-2.5.3.1/
./configure --prefix=/usr
make
sudo make install

cd ~
tar zvxf gphoto2-2.5.3.tar.gz
cd gphoto2-2.5.3/
./configure --prefix=/usr
make
sudo make install
That should result in version gphoto2 version 2.5.3 being installed on your RPi. Checking -

Code: Select all

cd ~
which gphoto2
gphoto2
gphoto2 --auto-detect
gphoto2 --summary
gphoto2 --capture-image
How To Ask Questions The Smart Way: http://www.catb.org/~esr/faqs/smart-questions.html
How to Report Bugs Effectively: http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

bartzak
Posts: 1
Joined: Mon Jul 28, 2014 3:43 am

Re: Gphoto2 Error (-60: 'Could not lock the device')-Canon70

Mon Jul 28, 2014 3:51 am

I've had the same problem with a Canon 7D and building it from source fixed it.

Thanks for taking the time to document it.

AMikeM
Posts: 2
Joined: Sun Jan 04, 2015 11:40 am

Re: Gphoto2 Error (-60: 'Could not lock the device')-Canon70

Sun Jan 04, 2015 3:36 pm

I had the same problem with a Nikon D40 - "gphoto2 --auto-detect" would correctly identify the camera, but any other call to gphoto2's functions produced the -60 error.

I followed Deejay's instructions and installed the new versions of libgphoto2 and gphoto2 2.5.3, but the problem persisted. It seems that even when the camera is set to USB=PTP mode, the RPi insists on treating it as a mass storage device. The ‘Eject’ and ‘Umount’ functions did not cure this.

However, I found a suggestion on another thread that the problem was caused by gphoto2 itself, starting gvfs daemons that lock the camera into mass storage mode. By removing (or, preferably, renaming) certain files, this behaviour can be stopped.

This worked for me, and I can now use gphoto2 to drive the camera. I renamed the following files (by simply adding an arbitrary prefix to the filename):

/usr/share/dbus1/services/org.gtk.Private.GPhoto2VolumeMonitor.service
/usr/share/gvfs/mounts/gphoto2.mount
/usr/share/gvfs/remote-volume-monitors/gphoto2.monitor
/usr/lib/gvfs/gvfs-gphoto2-volume-monitor

NB: I had to reboot after renaming the files, otherwise the old daemons still ran. Obviously the whole thing can be reversed by changing the files back to their original names and rebooting again.

Edit 10 Jan 2015: Since the previous post I've had to restore my RPi a couple of times, and in re-building gphoto2 I found that the errors mentioned above only occur when the old version of gphoto2 has previously been installed. I guess the 'purge' command doesn't remove the gvfs files, so they're still there after the new version is installed. Once those files are removed, however, a new installation of v.2.5.3 doesn't replace them, so everything works fine.

This might explain why some people found that v2.5.3 cured the problem, and some didn't.

jimsmith93
Posts: 20
Joined: Mon Mar 23, 2015 5:46 pm

Re: Gphoto2 Error (-60: 'Could not lock the device')-Canon70

Fri May 01, 2015 3:22 pm

I had the same problem with an EOS 350D.
I followed your file renaming advice, rebooted, and the problem has gone. I can now capture and download images.
Thank you! :D

Return to “Troubleshooting”

Who is online

Users browsing this forum: No registered users and 73 guests