diff options
-rw-r--r-- | src/cameras/ipe.c | 13 | ||||
-rw-r--r-- | test/grab-async.c | 11 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/cameras/ipe.c b/src/cameras/ipe.c index 103d333..ba7eb59 100644 --- a/src/cameras/ipe.c +++ b/src/cameras/ipe.c @@ -164,17 +164,21 @@ static int event_callback(pcilib_event_id_t event_id, pcilib_event_info_t *info, struct uca_camera_priv *cam = (struct uca_camera_priv *) user; pcilib_t *handle = GET_HANDLE(cam); size_t error = 0; + void *buffer = pcilib_get_data(handle, event_id, PCILIB_EVENT_DATA, &error); - if (buffer == NULL) - return UCA_ERR_CAMERA | UCA_ERR_CALLBACK; + if (buffer == NULL) { + pcilib_trigger(handle, PCILIB_EVENT0, 0, NULL); + return PCILIB_STREAMING_CONTINUE; + } - enum uca_buffer_status status = cam->callback(info->seqnum, buffer, NULL, cam->user); + enum uca_buffer_status status = cam->callback(info->seqnum, buffer, NULL, cam->callback_user); if (status == UCA_BUFFER_RELEASE) pcilib_return_data(handle, event_id, PCILIB_EVENT_DATA, buffer); - return UCA_NO_ERROR; + pcilib_trigger(handle, PCILIB_EVENT0, 0, NULL); + return PCILIB_STREAMING_CONTINUE; } static uint32_t uca_ipe_register_callback(struct uca_camera_priv *cam, uca_cam_grab_callback cb, void *user) @@ -182,6 +186,7 @@ static uint32_t uca_ipe_register_callback(struct uca_camera_priv *cam, uca_cam_g if (cam->callback == NULL) { cam->callback = cb; cam->callback_user = user; + pcilib_trigger(GET_HANDLE(cam), PCILIB_EVENT0, 0, NULL); pcilib_stream(GET_HANDLE(cam), &event_callback, cam); return UCA_NO_ERROR; } diff --git a/test/grab-async.c b/test/grab-async.c index 35ae5a4..7ce8b01 100644 --- a/test/grab-async.c +++ b/test/grab-async.c @@ -32,10 +32,10 @@ enum uca_buffer_status grab_callback(uint64_t image_number, void *buffer, void * const int pixel_size = props->bits == 8 ? 1 : 2; char filename[256]; - sprintf(filename, "out-%04i.raw", (int) image_number); - FILE *fp = fopen(filename, "wb"); - fwrite(buffer, props->width * props->height, pixel_size, fp); - fclose(fp); + /* sprintf(filename, "out-%04i.raw", (int) image_number); */ + /* FILE *fp = fopen(filename, "wb"); */ + /* fwrite(buffer, props->width * props->height, pixel_size, fp); */ + /* fclose(fp); */ printf("grabbed picture %i at %p (%ix%i @ %i bits)\n", (int) image_number, buffer, @@ -65,10 +65,11 @@ int main(int argc, char *argv[]) uca_cam_get_property(cam, UCA_PROP_HEIGHT, &props.height, 0); uca_cam_get_property(cam, UCA_PROP_BITDEPTH, &props.bits, 0); + printf("width=%i, height=%i, bits=%i\n", props.width, props.height, props.bits); uca_cam_alloc(cam, 10); - uca_cam_register_callback(cam, &grab_callback, &props); uca_cam_start_recording(cam); + uca_cam_register_callback(cam, &grab_callback, &props); printf("grabbing for 1 second ... "); fflush(stdout); sleep(1); |