Skip to content

fix: Camera USB stack crash after second capture#122

Open
fzorbach wants to merge 1 commit into
mathisloge:mainfrom
fzorbach:fix/camera-usb-stack-crash
Open

fix: Camera USB stack crash after second capture#122
fzorbach wants to merge 1 commit into
mathisloge:mainfrom
fzorbach:fix/camera-usb-stack-crash

Conversation

@fzorbach

@fzorbach fzorbach commented Mar 26, 2026

Copy link
Copy Markdown

I am using the Sony Alpha 7s.
I experienced an issue when taking a picture. gp_camera_capture returned GP_ERROR_IO when taking the second picture (after start of the app). Retrying will then return GP_ERROR_IO_USB_FIND. The photobox app now hangs in a loop right here.

                       | exec::repeat_effect_until(); // todo: this now retries forever to capture a image.
                                                      // maybe retry_n times and emit an error?

In the mean time, the camera will disappear from the USB devices. I guess the USB stack in the camera errored out.

The camera does not recover unless restarted.

After fiddling around, i noticed that nothing calls gp_camera_wait_for_event. So I had a feeling that the camera had some pending events it wanted to process before taking another picture. Calling gp_camera_wait_for_event until GP_EVENT_TIMEOUT occurs does fix it.

The way I implemented it should wait for the event while the captured image is shown. So no preview frames are lost and no further delay should occur. Right now, 6 events occur before timeout (1x file added, 2x capture complete, 3x unknown).

Due to not having more cameras, I can only test it with the Alpha 7s, which works fine.

Open for discussion on how to integrate that properly. I've never worked with stdexec before.

@fzorbach fzorbach force-pushed the fix/camera-usb-stack-crash branch from 7612089 to 2414df7 Compare March 26, 2026 21:33
Fixes the bug by calling gp_camera_wait_for_event until timeout.
@fzorbach fzorbach force-pushed the fix/camera-usb-stack-crash branch from 2414df7 to 87c1027 Compare March 26, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant