jim-easterbrook / python-gphoto2

Python interface to libgphoto2
GNU Lesser General Public License v3.0
359 stars 59 forks source link

Canon custom functions set_config #71

Closed mihailtudoran closed 5 years ago

mihailtudoran commented 5 years ago

Hi,

Is setting canon custom functions supported ? I'am interested in setting mirror lock-up on Canon cameras, by gphoto2 command line it can be done with: gphoto2 --set-config customfuncex=20,1,3,14,1,60f,1,1

But I could't find a way to use the python bindings to perform the same operation, some help or guidance will be greatly appreciated! Thanks!

I did some tries but failed to get_child or set_child on customfuncex.

jim-easterbrook commented 5 years ago

The camera-config-gui.py example shows the name and label of all the config items known to the Python interface. If customfuncex isn't there then maybe it's unique to the gphoto2 command line program. The source code is public so it might be worth exploring.

Another possibility is that the gphoto2 command and the Python bindings are using different versions of libgphoto2. You could try the ldd command on the gphoto2 binary and on one of the Python binding .so files to check they're using the same files.

mihailtudoran commented 5 years ago

I will post the solution below, thanks!

child = config.get_child_by_name("customfuncex")

to-enable:

child.set_value("20,1,3,14,1,60f,1,1")

to-disable:

child.set_value("20,1,3,14,1,60f,1,0")

camera.set_single_config("customfuncex", child)`