gphoto / libgphoto2

The libgphoto2 camera access and control library.
GNU Lesser General Public License v2.1
1.06k stars 325 forks source link

Reset camera status after preview capture #168

Open irieger opened 7 years ago

irieger commented 7 years ago

Hello,

I'm working on a small tool to control DSLR via a small Qt application. The basics are working well with different (Canon) cameras. Mostly I'm working and testing with the 5D mk III and the 5Ds.

Besides the basics like setting image format, shutter speed, aperture etc. and capturing, which are all working, I try to get a live view. The code is oriented at the workings of capture-movie in gphoto and just pushes frames from capture_preview into a fifo. That works at first start, but after I start my preview once and stop it then, the camera blocks ("busy") and I can't control anything (no capture, no new preview etc. Only the basic setting of config parameters works) either with libgphoto or on the body unless I power cycle it or at least unplug the USB.

So any idea why the camera blocks after this? Also the mirror will flip away but isn't switching back in (which kind of makes sense as it would have to switch after any call of capture_preview in the loop ...).

P.S. Is there a way to get a crop-in preview for focus check? Couldn't find anything with my searches.

mickeprag commented 7 years ago

I have experienced the same as you. My workaround is to capture a real image after I am done with preview. This resets the mirror. It works with Nikon D5000. Not pretty but works in my case.

galazzo commented 6 years ago

I experience the same problem with Canon 5D mark IV and it's really annoying. I see this bug is open since 16 May, any chance to have a fix?

TermanEmil commented 5 years ago

I have the same problem as well. In my case, it's a django application. If I kill the application while it's doing a preview, then I can't find any way to control the camera afterwards. The only 'solution' is to manually restart the camera. But this is not an option for me.

elijahparker commented 5 years ago

With most cameras you can reset the liveview mode and bring the mirror back down by setting viewfinder=0

On Mon, Jul 15, 2019 at 10:07 AM Emil Terman notifications@github.com wrote:

I have the same problem as well

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gphoto/libgphoto2/issues/168?email_source=notifications&email_token=AAJXATTTTBAGMTJ7S6JQ26LP7SHCTA5CNFSM4DLRB7P2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ57U3A#issuecomment-511441516, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJXATUL4HMJMO6GJ3LBNZLP7SHCTANCNFSM4DLRB7PQ .

TermanEmil commented 5 years ago

I'm using Nikon Z6. I managed to reproduce the problem both on a mac and on centOS. What I'm trying to do is similar to this:

while :
do
    gphoto2 --capture-preview --stdout > /dev/null;
done

Sometimes (quite often), if I stop this process and then run it again, the access to the camera is blocked. Even if I run gphoto2 --set-config-value viewfinder=0;, the connection is still blocked, meaning that this command doesn't end.

Do you have any more hints?

After I got into a situation where the camera was blocked, I run this:

gphoto2 --debug --set-config-value viewfinder=0;
0.000081 main                        (2): ALWAYS INCLUDE THE FOLLOWING LINES WHEN SENDING DEBUG MESSAGES TO THE MAILING LIST:
0.000190 main                        (2): gphoto2 2.5.23
0.000232 main                        (2): gphoto2 has been compiled with the following options:
0.000257 main                        (2):  + gcc (C compiler used)
0.000295 main                        (2):  + popt (mandatory, for handling command-line parameters)
0.000343 main                        (2):  + exif (for displaying EXIF information)
0.000379 main                        (2):  + no cdk (for accessing configuration options)
0.000422 main                        (2):  + no aa (for displaying live previews)
0.000453 main                        (2):  + jpeg (for displaying live previews in JPEG format)
0.000486 main                        (2):  + readline (for easy navigation in the shell)
0.000528 main                        (2): libgphoto2 2.5.23
0.000562 main                        (2): libgphoto2 has been compiled with the following options:
0.000587 main                        (2):  + all camlibs
0.000616 main                        (2):  + gcc (C compiler used)
0.000649 main                        (2):  + ltdl (for portable loading of camlibs)
0.000672 main                        (2):  + EXIF (for special handling of EXIF files)
0.000700 main                        (2): libgphoto2_port 0.12.0
0.000734 main                        (2): libgphoto2_port has been compiled with the following options:
0.000756 main                        (2):  + iolibs: disk ptpip serial usb usbdiskdirect usbscsi
0.000785 main                        (2):  + gcc (C compiler used)
0.000807 main                        (2):  + ltdl (for portable loading of iolibs)
0.000838 main                        (2):  + USB (libusb0, for USB cameras)
0.000860 main                        (2):  + serial (for serial cameras)
0.000882 main                        (2):  + no resmgr (serial port access and locking)
0.000913 main                        (2):  + no ttylock (serial port locking)
0.000936 main                        (2):  + no lockdev (serial port locking)
0.000963 main                        (2): CAMLIBS env var not set, using compile-time default instead
0.000985 main                        (2): IOLIBS env var not set, using compile-time default instead
0.001013 main                        (2): invoked with following arguments:
0.001036 main                        (2):   --debug
0.001057 main                        (2):   --set-config-value
0.001079 main                        (2):   viewfinder=0
0.001139 load_settings               (2): Creating gphoto config directory ('/root/.gphoto')
0.001341 load_settings               (2): Loading settings from file '/root/.gphoto/settings'.
0.001827 main                        (2): The user has not specified both a model and a port. Try to figure them out.
0.001913 gp_port_info_list_load      (2): Using ltdl to load io-drivers from '/usr/local/lib/libgphoto2_port/0.12.0'...
0.002281 foreach_func                (2): Called for filename '/usr/local/lib/libgphoto2_port/0.12.0/disk'.
0.003033 gp_port_library_list        (2): found mtab fsname rootfs
0.003170 gp_port_library_list        (2): found mtab fsname overlay
0.003234 gp_port_library_list        (2): found mtab fsname proc
0.003280 gp_port_library_list        (2): found mtab fsname tmpfs
0.003365 gp_port_library_list        (2): found mtab fsname devpts
0.003385 gp_port_library_list        (2): found mtab fsname sysfs
0.003405 gp_port_library_list        (2): found mtab fsname tmpfs
0.003446 gp_port_library_list        (2): found mtab fsname cgroup
0.003459 gp_port_library_list        (2): found mtab fsname cgroup
0.003470 gp_port_library_list        (2): found mtab fsname cgroup
0.003483 gp_port_library_list        (2): found mtab fsname cgroup
0.003498 gp_port_library_list        (2): found mtab fsname cgroup
0.003550 gp_port_library_list        (2): found mtab fsname cgroup
0.003583 gp_port_library_list        (2): found mtab fsname cgroup
0.003604 gp_port_library_list        (2): found mtab fsname cgroup
0.003621 gp_port_library_list        (2): found mtab fsname cgroup
0.003632 gp_port_library_list        (2): found mtab fsname cgroup
0.003645 gp_port_library_list        (2): found mtab fsname cgroup
0.003667 gp_port_library_list        (2): found mtab fsname mqueue
0.003684 gp_port_library_list        (2): found mtab fsname /dev/sda3
0.003723 gp_port_library_list        (2): found mtab fsname tmpfs
0.003754 gp_port_library_list        (2): found mtab fsname /dev/sda4
0.003783 gp_port_library_list        (2): found mtab fsname /dev/sda4
0.003806 gp_port_library_list        (2): found mtab fsname /dev/sda4
0.003837 gp_port_library_list        (2): found mtab fsname shm
0.003868 gp_port_library_list        (2): found mtab fsname devtmpfs
0.003891 gp_port_library_list        (2): found mtab fsname devpts
0.003960 foreach_func                (2): Loaded '' ('^disk:') from '/usr/local/lib/libgphoto2_port/0.12.0/disk'.
0.003980 foreach_func                (2): Called for filename '/usr/local/lib/libgphoto2_port/0.12.0/ptpip'.
0.004158 foreach_func                (2): Loaded 'PTP/IP Connection' ('ptpip:') from '/usr/local/lib/libgphoto2_port/0.12.0/ptpip'.
0.004174 foreach_func                (2): Loaded '' ('^ptpip:') from '/usr/local/lib/libgphoto2_port/0.12.0/ptpip'.
0.004183 foreach_func                (2): Called for filename '/usr/local/lib/libgphoto2_port/0.12.0/serial'.
0.004437 foreach_func                (2): Loaded 'Serial Port 0' ('serial:/dev/ttyS0') from '/usr/local/lib/libgphoto2_port/0.12.0/serial'.
0.004454 foreach_func                (2): Loaded 'Serial Port 1' ('serial:/dev/ttyS1') from '/usr/local/lib/libgphoto2_port/0.12.0/serial'.
0.004463 foreach_func                (2): Loaded 'Serial Port 2' ('serial:/dev/ttyS2') from '/usr/local/lib/libgphoto2_port/0.12.0/serial'.
0.004477 foreach_func                (2): Loaded 'Serial Port 3' ('serial:/dev/ttyS3') from '/usr/local/lib/libgphoto2_port/0.12.0/serial'.
0.004497 foreach_func                (2): Loaded 'Serial Port Device' ('serial:') from '/usr/local/lib/libgphoto2_port/0.12.0/serial'.
0.004518 foreach_func                (2): Loaded '' ('^serial:') from '/usr/local/lib/libgphoto2_port/0.12.0/serial'.
0.004535 foreach_func                (2): Called for filename '/usr/local/lib/libgphoto2_port/0.12.0/usb'.
0.063670 foreach_func                (2): Loaded '' ('^usb:') from '/usr/local/lib/libgphoto2_port/0.12.0/usb'.
0.063681 foreach_func                (2): Loaded 'Universal Serial Bus' ('usb:002,051') from '/usr/local/lib/libgphoto2_port/0.12.0/usb'.
0.063685 foreach_func                (2): Loaded 'Universal Serial Bus' ('usb:002,004') from '/usr/local/lib/libgphoto2_port/0.12.0/usb'.
0.063689 foreach_func                (2): Called for filename '/usr/local/lib/libgphoto2_port/0.12.0/usbdiskdirect'.
0.063890 foreach_func                (2): Called for filename '/usr/local/lib/libgphoto2_port/0.12.0/usbscsi'.
0.064094 gp_port_info_list_count     (2): Counting entries (12 available)...
0.064100 gp_port_info_list_count     (2): 8 regular entries available.
0.064119 gp_abilities_list_load_dir  (2): Using ltdl to load camera libraries from '/usr/local/lib/libgphoto2/2.5.23'...
0.064189 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/ax203'.
0.064196 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/canon'.
0.064199 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/digigr8'.
0.064202 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/dimagev'.
0.064205 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/directory'.
0.064208 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/jl2005a'.
0.064211 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/jl2005c'.
0.064214 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/kodak_dc240'.
0.064217 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/mars'.
0.064220 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/pentax'.
0.064223 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/ptp2'.
0.064226 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/sierra'.
0.064229 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/sonix'.
0.064232 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/sq905'.
0.064235 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/st2205'.
0.064238 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/topfield'.
0.064241 foreach_func                (2): Found '/usr/local/lib/libgphoto2/2.5.23/tp6801'.
0.064247 gp_abilities_list_load_dir  (2): Found 17 camera drivers.
0.079388 gp_port_info_list_count     (2): Counting entries (12 available)...   
0.079432 gp_port_info_list_count     (2): 8 regular entries available.
0.079444 gp_port_new                 (2): Creating new device...
0.079484 gp_port_info_list_get_info  (2): Getting info of entry 0 (12 available)...
0.079695 gp_port_set_settings        (2): Setting settings...
0.079711 gp_port_info_list_get_info  (2): Getting info of entry 1 (12 available)...
0.079815 gp_port_set_timeout         (2): Setting port timeout to 500 milliseconds.
0.079836 gp_port_set_settings        (2): Setting settings...
0.079854 gp_port_info_list_get_info  (2): Getting info of entry 2 (12 available)...
0.079985 gp_port_set_timeout         (2): Setting port timeout to 500 milliseconds.
0.080006 gp_port_set_settings        (2): Setting settings...
0.080019 gp_port_info_list_get_info  (2): Getting info of entry 3 (12 available)...
0.080132 gp_port_set_timeout         (2): Setting port timeout to 500 milliseconds.
0.080154 gp_port_set_settings        (2): Setting settings...
0.080170 gp_port_info_list_get_info  (2): Getting info of entry 4 (12 available)...
0.080286 gp_port_set_timeout         (2): Setting port timeout to 500 milliseconds.
0.080315 gp_port_set_settings        (2): Setting settings...
0.080327 gp_port_info_list_get_info  (2): Getting info of entry 5 (12 available)...
0.080442 gp_port_set_timeout         (2): Setting port timeout to 500 milliseconds.
0.080455 gp_port_set_settings        (2): Setting settings...
0.080463 gp_port_info_list_get_info  (2): Getting info of entry 6 (12 available)...
0.254383 gp_port_set_timeout         (2): Setting port timeout to 5000 milliseconds.
0.254392 gp_port_set_settings        (2): Setting settings...
0.254402 gp_port_usb_update          (2): gp_port_usb_update(old int=0, conf=-1, alt=-1) port usb:002,051, (new int=0, conf=-1, alt=-1), port usb:002,051
0.254407 gp_abilities_list_detect_usb(2): Auto-detecting USB cameras...
0.254628 gp_port_usb_find_device_by_class_lib(2): Looking for USB device (class 0x29a, subclass, 0xffffffff, protocol 0xffffffff)...
0.254663 gp_port_usb_find_device_lib (2): Looking for USB device (vendor 0x4b0, product 0x442)... found.
0.254667 gp_port_usb_find_device_lib (2): inep to look for is 81
0.254672 gp_port_usb_find_device_lib (2): Detected defaults: config 1, interface 0, altsetting 0, inep 81, outep 02, intep 83, class 06, subclass 01
0.254676 gp_abilities_list_detect_usb(2): Found 'Nikon Z7' (0x4b0,0x442)
0.254681 gp_port_info_list_get_info  (2): Getting info of entry 7 (12 available)...
0.443916 gp_port_set_timeout         (2): Setting port timeout to 5000 milliseconds.
0.443945 gp_port_set_settings        (2): Setting settings...
0.443975 gp_port_usb_update          (2): gp_port_usb_update(old int=0, conf=-1, alt=-1) port usb:002,004, (new int=0, conf=-1, alt=-1), port usb:002,004
0.443997 gp_abilities_list_detect_usb(2): Auto-detecting USB cameras...
0.444357 gp_port_usb_find_device_by_class_lib(2): Looking for USB device (class 0x29a, subclass, 0xffffffff, protocol 0xffffffff)...
0.444624 gp_port_usb_find_device_by_class_lib(2): Looking for USB device (class 0x6, subclass, 0x1, protocol 0x1)...
0.444666 gp_port_free                (2): Freeing port...
0.444684 gp_port_close               (2): Closing port...
0.444716 gp_port_usb_close [libusb.c:325](0): Invalid parameters: 'port && port->pl->dh' is NULL/FALSE.
0.444900 gp_camera_set_abilities     (2): Setting abilities ('Nikon Z7')...
0.444940 gp_setting_set              (2): Setting key 'model' to value 'Nikon Z7' (gphoto2)
0.444963 save_settings               (2): Saving 2 setting(s) to file "/root/.gphoto/settings"
0.445152 gp_port_info_list_lookup_path(2): Looking for path 'usb:002,051' (12 entries available)...
0.445184 gp_port_info_list_get_info  (2): Getting info of entry 6 (12 available)...
0.445202 gp_camera_set_port_info     (2): Setting port info for port 'Universal Serial Bus' at 'usb:002,051'...
0.629901 gp_port_set_timeout         (2): Setting port timeout to 5000 milliseconds.
0.629925 gp_port_set_settings        (2): Setting settings...
0.629945 gp_port_usb_update          (2): gp_port_usb_update(old int=0, conf=-1, alt=-1) port usb:002,051, (new int=0, conf=-1, alt=-1), port usb:002,051
0.629958 gp_setting_set              (2): Setting key 'port' to value 'usb:002,051' (gphoto2)
0.629970 save_settings               (2): Saving 2 setting(s) to file "/root/.gphoto/settings"
0.630163 gp_camera_init              (2): Initializing camera...
0.630192 gp_port_usb_find_device_lib (2): Looking for USB device (vendor 0x4b0, product 0x442)... found.
0.630207 gp_port_usb_find_device_lib (2): inep to look for is 81
0.630231 gp_port_usb_find_device_lib (2): Detected defaults: config 1, interface 0, altsetting 0, inep 81, outep 02, intep 83, class 06, subclass 01
0.630253 gp_camera_init              (2): Loading '/usr/local/lib/libgphoto2/2.5.23/ptp2'...
0.632104 gp_port_open                (2): Opening USB port...
0.632128 gp_port_usb_open            (2): gp_port_usb_open(0x5568915b1170)
0.632166 gp_port_usb_open            (2): claiming interface 0
0.632224 camera_init                 (2): maxpacketsize 512
0.632240 gp_port_set_timeout         (2): Setting port timeout to 8000 milliseconds.
0.632257 ptp                         (2): PTP: Opening session
0.632296 ptp_usb_sendreq             (2): Sending PTP_OC 0x1002 (Open session) (0x1) request...
0.632316 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
8.632838 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
8.632858 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
8.632863 ptp_usb_sendreq             (2): Clearing halt on OUT EP and retrying once.
8.632868 gp_port_usb_clear_halt      (2): Clear USB halt...
8.635881 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
16.636310 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
16.636326 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
16.636345 camera_init [library.c:8474](0): 'ptp_opensession (params, sessionid)' failed: PTP General Error (0x2002)
16.636349 ptp                         (2): PTP: Opening session
16.636355 ptp_usb_sendreq             (2): Sending PTP_OC 0x1002 (Open session) (0x1) request...
16.636359 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
24.636892 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
24.636921 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
24.636930 ptp_usb_sendreq             (2): Clearing halt on OUT EP and retrying once.
24.636938 gp_port_usb_clear_halt      (2): Clear USB halt...
24.637220 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
32.637811 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
32.637840 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
32.637852 camera_init [library.c:8474](0): 'ptp_opensession (params, sessionid)' failed: PTP General Error (0x2002)
32.637861 ptp                         (2): PTP: Opening session
32.637882 ptp_usb_sendreq             (2): Sending PTP_OC 0x1002 (Open session) (0x1) request...
32.637903 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
40.638107 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
40.638125 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
40.638129 ptp_usb_sendreq             (2): Clearing halt on OUT EP and retrying once.
40.638132 gp_port_usb_clear_halt      (2): Clear USB halt...
40.638440 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
48.638957 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
48.638985 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
48.638997 camera_init [library.c:8474](0): 'ptp_opensession (params, sessionid)' failed: PTP General Error (0x2002)
48.639007 camera_init [library.c:8502](0): 'ret' failed: 'PTP General Error' (0x2002)
48.639020 gp_context_error            (0): PTP General Error

*** Error ***              
PTP General Error
48.639069 gp_port_close               (2): Closing port...
48.639407 gp_context_error            (0): An error occurred in the io-library ('Unspecified error'): No error description available

*** Error ***              
An error occurred in the io-library ('Unspecified error'): No error description available
48.639460 gp_camera_init              (2): Initializing camera...
48.639476 gp_port_usb_find_device_lib (2): Looking for USB device (vendor 0x4b0, product 0x442)... found.
48.639490 gp_port_usb_find_device_lib (2): inep to look for is 81
48.639500 gp_port_usb_find_device_lib (2): Detected defaults: config 1, interface 0, altsetting 0, inep 81, outep 02, intep 83, class 06, subclass 01
48.639512 gp_camera_init              (2): Loading '/usr/local/lib/libgphoto2/2.5.23/ptp2'...
48.641340 gp_port_open                (2): Opening USB port...
48.641363 gp_port_usb_open            (2): gp_port_usb_open(0x5568915b1170)
48.641393 gp_port_usb_open            (2): claiming interface 0
48.641451 camera_init                 (2): maxpacketsize 512
48.641466 gp_port_set_timeout         (2): Setting port timeout to 8000 milliseconds.
48.641480 ptp                         (2): PTP: Opening session
48.641497 ptp_usb_sendreq             (2): Sending PTP_OC 0x1002 (Open session) (0x1) request...
48.641511 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
56.641624 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
56.641661 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
56.641679 ptp_usb_sendreq             (2): Clearing halt on OUT EP and retrying once.
56.641692 gp_port_usb_clear_halt      (2): Clear USB halt...
56.651097 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
64.652022 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
64.652049 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
64.652073 camera_init [library.c:8474](0): 'ptp_opensession (params, sessionid)' failed: PTP General Error (0x2002)
64.652086 ptp                         (2): PTP: Opening session
64.652113 ptp_usb_sendreq             (2): Sending PTP_OC 0x1002 (Open session) (0x1) request...
64.652134 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
72.652248 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
72.652275 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
72.652284 ptp_usb_sendreq             (2): Clearing halt on OUT EP and retrying once.
72.652292 gp_port_usb_clear_halt      (2): Clear USB halt...
72.653183 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
80.653455 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
80.653473 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
80.653481 camera_init [library.c:8474](0): 'ptp_opensession (params, sessionid)' failed: PTP General Error (0x2002)
80.653485 ptp                         (2): PTP: Opening session
80.653491 ptp_usb_sendreq             (2): Sending PTP_OC 0x1002 (Open session) (0x1) request...
80.653495 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
88.654106 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
88.654134 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
88.654144 ptp_usb_sendreq             (2): Clearing halt on OUT EP and retrying once.
88.654153 gp_port_usb_clear_halt      (2): Clear USB halt...
88.658874 gp_port_write               (3): Writing 16 = 0x10 bytes to port...
^C
Cancelling...
96.659261 gp_port_write [gphoto2-port.c:406](0): Writing 16 = 0x10 bytes to port failed: Error writing to the port (-35)
96.659288 ptp_usb_sendreq [usb.c:109] (0): PTP_OC 0x1002 sending req failed: Error writing to the port (-35)
96.659313 camera_init [library.c:8474](0): 'ptp_opensession (params, sessionid)' failed: PTP General Error (0x2002)
96.659324 camera_init [library.c:8502](0): 'ret' failed: 'PTP General Error' (0x2002)
96.659337 gp_context_error            (0): PTP General Error

*** Error ***              
PTP General Error
96.659381 gp_port_close               (2): Closing port...
96.659667 gp_context_error            (0): An error occurred in the io-library ('Unspecified error'): No error description available

*** Error ***              
An error occurred in the io-library ('Unspecified error'): No error description available
*** Error (-1: 'Unspecified error') ***       

96.660372 gp_camera_free              (2): Freeing camera...
96.660392 gp_port_free                (2): Freeing port...
96.660400 gp_port_close               (2): Closing port...
96.660417 gp_port_usb_close [libusb.c:325](0): Invalid parameters: 'port && port->pl->dh' is NULL/FALSE.
96.660469 gp_filesystem_reset         (2): resetting filesystem
96.660482 gp_filesystem_lru_clear     (2): Clearing fscache LRU list...
96.660490 gp_filesystem_lru_clear     (2): fscache LRU list already empty
96.660498 delete_all_folders          (2): Internally deleting all folders from '/'...
96.660508 lookup_folder               (2): Lookup folder '/'...
96.660522 lookup_folder               (2): Found! / is 0x5568915b1120
96.660534 recurse_delete_folder       (2): Recurse delete folder 0x5568915b1120//
msmeissn commented 5 years ago

The Nikon Z6 issue is seperate from the Canon part.

Here you confuse the PTP communication where it cannot be picked up again. You should not abort the process, but perhaps use a trigger file to stop the loop or similar so it cleanly exits.

msmeissn commented 5 years ago

For the Canon users, did gphoto2 --set-config viewfinder=0 work for you?

andreakappa commented 4 years ago

I'm working with an EOS 5Ds, and I have this problem too by controlling it from python. I've managed to put an handler with atexitthat runs something like this:

def close(self): gp.check_result(gp.gp_camera_exit(self.camera))

after some time I start getting timeout errors, and even a gphoto2 --summary fails.

ttx commented 4 years ago

@msmeissn Just stumbled on this issue and I can confirm (EOD 6D) that 'gphoto2 --set-config viewfinder=0' works.