I'm trying to get gphoto working and build a personal webgui for it.
Everything seems to work (detected camera, capture working, properties aquired...)
The only thing I'm not being able to do is to keep the photos on the camera SD.
I'm using the commands without any errors
gphoto2 --capture-image
gphoto2 --capture-image-and-download --filename=/store_00010001/DCIM/100D5000/DSC0001.JPG
gphoto2 --capture-image --keep
none of those work.
Any hint to get this working ?
Nikon DSC D5000 (PTP mode) usb:001,020
gphoto2 2.5.6
libgphoto2 2.5.7
libgphoto2_port 0.12.0
--set-config /main/settings/capturetarget=1 seems to fix it on terminal but not using webgui.
Always: Current: Internal RAM
should be a permissions issue, but no idea where.
Last edit: Luis Miguel 2015-06-28
the capturetarget setting is saved in .gphoto/settings and should be stick
pretty sure the problem is in ~/Users/USERNAME/.gphoto/settings since the user is www-data. any way to point the settings to a folder with rw permissions ?
you can copy a premade settings file to the ~wwwrun/.gphoto/settings home of wwwrun user ...
(just 1 line with:
ptp2=capturetarget=card
inside to switch to card capture)
You can set the HOME environment variable before calling libgphoto2 if you need another directory for $HOME/.gphoto/settings
Thank you for your message.
I have tried it and those where the steps made:
mkdir /var/www/.gphoto
nano /var/www./.gphoto/settings
ptp2=capturetarget=card
chmod -R 777 /var/www/.gphoto
but in the debug messages I still receiving:
0.011423 main (2): invoked with following arguments:
0.011517 main (2): --set-config
0.011611 main (2): /main/settings/capturetarget=1
0.011705 main (2): --debug
0.012033 load_settings (2): Creating $HOME/.gphoto
0.014347 verify_settings gphoto2-setting.c:136: Can't open settings file for reading.
0.015158 load_settings (2): Loading settings from file '/var/www/.gphoto/settings'.
0.015927 load_settings (2): Can't open settings file for reading.
0.016096 load_settings (2): Creating $HOME/.gphoto
0.016306 verify_settings gphoto2-setting.c:136: Can't open settings file for reading.
0.017281 load_settings (2): Loading settings from file '/var/www/.gphoto/settings'.
0.017511 load_settings (2): Can't open settings file for reading.
0.018688 main (2): The user has not specified both a mode l and a port. Try to figure them out.
(...)
So I know I have the settings file, the user www-data can read and write the file, but ghoto can't read the settings file.
Since I'm not a Linux Expert something should be wrong with my settings.
messing around with folders and permissions it's even worst:
0.003744 verify_settings gphoto2-setting.c:136: Can't open settings file for reading.
0.003848 load_settings (2): Loading settings from file '(null)/.gphoto/settings'.
0.003963 load_settings (2): Can't open settings file for reading.
0.004049 load_settings (2): Creating $HOME/.gphoto
0.004188 verify_settings gphoto2-setting.c:136: Can't open settings file for reading.
0.004276 load_settings (2): Loading settings from file '(null)/.gphoto/settings'.
that means the HOME environment variable is not set at all. if you set it in
your script,
export HOME=/var/www/
or similar before calling gphoto2
you were right.
This were the changes to python script
import os
os.environ['HOME']='/var/www'