ArduCAM / MIPI_Camera

235 stars 109 forks source link

OV9281 segmentation fault on arducam_close_camera #93

Open andigandi opened 3 years ago

andigandi commented 3 years ago

arducam_close_camera fails with a segmentation fault. I have stripped down my program to near trivial state to show you the error.

#include <cstdio>
#include <stdexcept>
#include "arducam_mipicamera.h"

int main(int argc, char *argv[])
{
    int ret;

    CAMERA_INSTANCE cameraInstance;

    ret = arducam_init_camera(&cameraInstance);
    if (ret) {
        fprintf(stderr, "arducam_init_camera status = %i", ret);
    }

    ret = arducam_set_mode(cameraInstance, 12);
    if (ret) {
        fprintf(stderr, "arducam_set_mode status = %i", ret);
    }

    ret = arducam_close_camera(cameraInstance);
    if (ret) {
        fprintf(stderr, "arducam_close_camera status = %i", ret);
    }

    return EXIT_SUCCESS;
}
marcin-sielski commented 3 years ago

I have also experienced segfaults with this function but most recently I see hangups. Below is a output from strace:

futex(0x179eca8, FUTEX_WAKE_PRIVATE, 2147483647) = 0 futex(0x179eca8, FUTEX_WAKE_PRIVATE, 2147483647) = 0 ioctl(3, _IOC(_IOC_WRITE, 0xc4, 0x4, 0xc), 0xbea3e6fc) = 0 futex(0xb62303c4, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, FUTEX_BITSET_MATCH_ANY) = 0 futex(0x15fb078, FUTEX_WAKE_PRIVATE, 1) = 1 ioctl(22, DMA_BUF_IOCTL_SYNC, 0xbea3e820) = 0 munmap(0xa8623000, 385024) = 0 close(22) = 0 ioctl(23, DMA_BUF_IOCTL_SYNC, 0xbea3e820) = 0 munmap(0xa629e000, 385024) = 0 close(23) = 0 ioctl(24, DMA_BUF_IOCTL_SYNC, 0xbea3e820) = 0 munmap(0xa6240000, 385024) = 0 close(24) = 0 ioctl(25, DMA_BUF_IOCTL_SYNC, 0xbea3e820) = 0 munmap(0xa50a0000, 385024) = 0 close(25) = 0 futex(0x1606da8, FUTEX_WAIT_PRIVATE, 2, NULL