Open tmandys opened 1 month ago
Switch off camera when running USB preview
2024-07-14 15:38:03,447: root: preview: DEBUG: camera_file.get_data_and_size() 2024-07-14 15:38:03,447: root: preview: DEBUG: capture_lock.release() 4823 2024-07-14 15:38:03,548: root: preview: DEBUG: capture_lock.acquire() 4823 2024-07-14 15:38:03,548: root: preview: DEBUG: gp.gp_camera_capture_preview() 2024-07-14 15:38:03,909: root: preview: ERROR: Failed to capture preview: -7: I/O problem 2024-07-14 15:38:03,909: root: preview: DEBUG: Reinitializing: usb:002,011|Nikon DSC D850 2024-07-14 15:38:03,910: root: preview: DEBUG: gp.Camera.autodetect() 2024-07-14 15:38:04,008: root: preview: DEBUG: Reinit #0 2024-07-14 15:38:04,209: root: preview: DEBUG: gp.Camera.autodetect() 2024-07-14 15:38:04,255: root: preview: DEBUG: Reinit #1 2024-07-14 15:38:04,656: root: preview: DEBUG: gp.Camera.autodetect() 2024-07-14 15:38:04,699: root: preview: DEBUG: Reinit #2 2024-07-14 15:38:05,299: root: preview: DEBUG: gp.Camera.autodetect() 2024-07-14 15:38:05,343: root: preview: DEBUG: Reinit #3 2024-07-14 15:38:06,143: root: preview: DEBUG: gp.Camera.autodetect() 2024-07-14 15:38:06,187: root: preview: DEBUG: Reinit #4 2024-07-14 15:38:07,187: root: preview: DEBUG: gp.Camera.autodetect() 2024-07-14 15:38:07,231: root: preview: DEBUG: Reinit #5 2024-07-14 15:38:08,432: root: preview: DEBUG: gp.Camera.autodetect() 2024-07-14 15:38:08,475: root: preview: DEBUG: Reinit #6 2024-07-14 15:38:09,876: root: preview: DEBUG: gp.Camera.autodetect() 2024-07-14 15:38:09,951: root: preview: DEBUG: Reinit #7 2024-07-14 15:38:11,551: root: preview: DEBUG: gp.Camera.autodetect() 2024-07-14 15:38:11,595: root: preview: DEBUG: Reinit #8 2024-07-14 15:38:13,395: root: preview: DEBUG: gp.Camera.autodetect() 2024-07-14 15:38:13,439: root: preview: DEBUG: Reinit #9 2024-07-14 15:38:15,439: root: preview: DEBUG: gp.Camera.autodetect() 2024-07-14 15:38:15,536: root: preview: DEBUG: Reinit #10 2024-07-14 15:38:15,536: root: preview: DEBUG: capture_lock.release() 4823 2024-07-14 15:38:15,537: root: preview: DEBUG: camera exit Exception in thread preview: Traceback (most recent call last): File "/home/pi/work/digie35-python/digie35/./digie35_server.py", line 631, in _do_preview self._reinit_camera() File "/home/pi/work/digie35-python/digie35/./digie35_server.py", line 227, in _reinit_camera raise CameraControlError(f"Cannot reinit camera: %s" % model) CameraControlError: Cannot reinit camera: Nikon DSC D850
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner self.run() File "/usr/lib/python3.11/threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "/home/pi/work/digie35-python/digie35/./digie35_server.py", line 671, in _do_preview self._close_camera() File "/home/pi/work/digie35-python/digie35/./digie35_server.py", line 292, in _close_camera gp.check_result(gp.gp_camera_exit(self._camera)) File "/home/pi/.local/lib/python3.11/site-packages/gphoto2/result.py", line 52, in check_result raise GPhoto2Error(error) gphoto2.GPhoto2Error: [-52] Could not find the requested device on the USB port
After camera restart 2024-07-14 15:39:51,742: websockets.server: MainThread: DEBUG: < TEXT 'START_PREVIEW:{"camera_id":"usb:002,012|Nikon DSC D850"}' [56 bytes] 2024-07-14 15:39:51,742: root: MainThread: DEBUG: ws: START_PREVIEW:{"camera_id":"usb:002,012|Nikon DSC D850"} 2024-07-14 15:39:51,742: root: MainThread: DEBUG: ws.send: {"cmd": "START_PREVIEW", "payload": {"camera_id": "usb:002,012|Nikon DSC D850", "usbpreview": true}} 2024-07-14 15:39:51,742: websockets.server: MainThread: DEBUG: > TEXT '{"cmd": "START_PREVIEW", "payload": {"camera_id...", "usbpreview": true}}' [100 bytes] 2024-07-14 15:39:51,761: websockets.server: MainThread: DEBUG: < TEXT 'SET_BACKLIGHT:{"color":"white","intensity":60}' [46 bytes] 2024-07-14 15:39:51,761: root: MainThread: DEBUG: ws: SET_BACKLIGHT:{"color":"white","intensity":60} 2024-07-14 15:39:51,762: root: MainThread: DEBUG: Set PWM(0, 0, 5000)
When USB preview is stopped because USB cable is unplugged then USB preview won't start again and reboot is needed. Seems it is issue with Nikon 810 and 850. Typically: everything switch on, connect, focus via magnifier in camera menu requires disconnect USB cable, when reconnect then no more USB preview, reboot