Skip to content

Commit

Permalink
Fix problem configuring USB cams
Browse files Browse the repository at this point in the history
Be really sure that we never ask such cameras for a raw stream, as it
will fail.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
  • Loading branch information
davidplowman committed Jul 18, 2023
1 parent ea2fdb4 commit e236032
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions picamera2/picamera2.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ def __init__(self, camera_num=0, verbose_console=None, tuning=None):
# We deliberately make raw streams with no size so that it will be filled in
# later once the main stream size has been set.
self.preview_configuration = self.create_preview_configuration()
self.preview_configuration.enable_raw()
self.preview_configuration.enable_raw() # causes the size to be reset to None
self.still_configuration = self.create_still_configuration()
self.still_configuration.enable_raw()
self.still_configuration.enable_raw() # ditto
self.video_configuration = self.create_video_configuration()
self.video_configuration.enable_raw()
self.video_configuration.enable_raw() # ditto
except Exception:
_log.error("Camera __init__ sequence did not complete.")
raise RuntimeError("Camera __init__ sequence did not complete.")
Expand Down Expand Up @@ -918,6 +918,9 @@ def configure_(self, camera_config="preview") -> None:
camera_config = camera_config.make_dict()
if camera_config is None:
camera_config = self.create_preview_configuration()
# Be 100% sure that non-Pi cameras aren't asking for a raw stream.
if not self._is_rpi_camera():
camera_config['raw'] = None

# Mark ourselves as unconfigured.
self.libcamera_config = None
Expand Down

0 comments on commit e236032

Please sign in to comment.