jim-easterbrook / python-gphoto2

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

Missing bindings for gp_port_new, gp_port_open, and gp_port_reset? #162

Closed erdmann closed 8 months ago

erdmann commented 10 months ago

Hi, I'm trying to use the python-gphoto2 bindings to implement gphoto2's gphoto2 --reset port reset option for when things go pear-shaped with my camera. The gphoto2 source for that is here.

Basically, it goes through a sequence of steps to do this:

  1. exit the camera;
  2. allocate a new port with gp_port_new;
  3. get info about the existing camera's port;
  4. set the new port with that info;
  5. open the new port with gp_port_open; and finally
  6. reset the port with gp_port_reset.

I couldn't find a high-level reset functionality in python-gphoto2 so I thought I'd just roll my own since it's only a few lines. However, I didn't find any bindings for these three functions there. In README.md you mention that

The Python interface to libgphoto2 should allow you to do anything you could do in a C program. However, there are still bits missing and functions that cannot be called from Python. Let me know if you run into any problems.

Is this an intentional omission or just something that hasn't been implemented yet? Is there a better way to reset the port that doesn't involve these functions?

Many thanks in advance.

jim-easterbrook commented 10 months ago

I'd assumed those functions were "internal", for example gp_port_open is called by camera functions. http://www.gphoto.org/doc/api/gphoto2-port_8h.html#a976f2b7d7c2bd3f5399a6f5829044957

However, you've got a good example of using them from Python so I'll add them in the next release of python-gphoto2.

jim-easterbrook commented 10 months ago

I've just released v2.5.0 which includes the gp_port functions.