diff --git a/camlibs/agfa-cl18/agfa.c b/camlibs/agfa-cl18/agfa.c index 7b41b99be..5e27dacca 100644 --- a/camlibs/agfa-cl18/agfa.c +++ b/camlibs/agfa-cl18/agfa.c @@ -65,7 +65,7 @@ int camera_abilities(CameraAbilitiesList *list) { a->port = GP_PORT_USB; a->usb_vendor = models[i].idVendor; a->usb_product= models[i].idProduct; - a->operations = GP_OPERATION_NONE; + a->operations = GP_OPERATION_CAPTURE_IMAGE; a->folder_operations = GP_FOLDER_OPERATION_NONE; a->file_operations = GP_FILE_OPERATION_PREVIEW | GP_FILE_OPERATION_DELETE; @@ -95,8 +95,9 @@ int camera_init(Camera *camera) { camera->functions->summary = camera_summary; camera->functions->manual = camera_manual; camera->functions->about = camera_about; - camera->functions->file_delete = camera_file_delete; - + camera->functions->file_delete = camera_file_delete; + camera->functions->capture = camera_capture; + gp_debug_printf (GP_DEBUG_LOW, "agfa", "Initializing the camera\n"); dev = malloc(sizeof(*dev)); @@ -313,6 +314,19 @@ int camera_about(Camera *camera, CameraText *about) { } + /* Below contributed by Ben Hague */ +int camera_capture (Camera *camera, int capture_type, CameraFilePath *path) +{ + struct agfa_device *dev=camera->camlib_data; + + /* Capture image/preview/video and return it in 'file'. Don't store it + anywhere on your camera! If your camera does store the image, + delete it manually here. */ + + return (agfa_capture(dev,path)); +} + + int camera_file_delete (Camera *camera, const char *folder, const char *filename) { diff --git a/camlibs/agfa-cl18/agfa.h b/camlibs/agfa-cl18/agfa.h index acf9d7e61..5718572fc 100644 --- a/camlibs/agfa-cl18/agfa.h +++ b/camlibs/agfa-cl18/agfa.h @@ -66,6 +66,7 @@ int agfa_get_thumb(struct agfa_device *dev, const char *filename, int agfa_get_pic_size(struct agfa_device *dev, const char *filename); int agfa_get_pic(struct agfa_device *dev, const char *filename, unsigned char *data,int size); +int agfa_capture(struct agfa_device *dev, const char *path); /* usb.c */ diff --git a/camlibs/agfa-cl18/commands.c b/camlibs/agfa-cl18/commands.c index 28f19aa8d..9a8025060 100644 --- a/camlibs/agfa-cl18/commands.c +++ b/camlibs/agfa-cl18/commands.c @@ -71,6 +71,38 @@ int agfa_get_status(struct agfa_device *dev, int *taken, return 0; } + /* Below contributed by Ben Hague */ + +int agfa_capture(struct agfa_device *dev, const char *path) { + /*FIXME: Not fully implemented according to the gphoto2 spec.*/ + /*Should also save taken picture, and then delete it from the camera*/ + /*but when I try to do that it just hangs*/ + + struct agfa_command cmd; + int ret,taken; + + printf("Agfa take a picture\n"); + build_command(&cmd, AGFA_TAKEPIC2,0); + ret = agfa_send(dev, &cmd, sizeof(cmd)); + build_command(&cmd, AGFA_TAKEPIC1,0); + ret = agfa_send(dev, &cmd, sizeof(cmd)); + build_command(&cmd, AGFA_TAKEPIC3,0); + ret = agfa_send(dev, &cmd, sizeof(cmd)); + build_command(&cmd, AGFA_TAKEPIC2,0); + ret = agfa_send(dev, &cmd, sizeof(cmd)); + + /*Not sure if this delay is necessary, but it was used in the windows driver*/ + /*delay(20); */ + /*Again, three times in windows driver*/ + ret = agfa_photos_taken(dev,&taken); + ret = agfa_photos_taken(dev,&taken); + ret = agfa_photos_taken(dev,&taken); + /*This seems to do some kind of reset, but does cause the camera to start responding again*/ + build_command(&cmd,AGFA_GET_NAMES, 0); + ret = agfa_send(dev, &cmd, sizeof(cmd)); + return 0; +} + int agfa_photos_taken(struct agfa_device *dev, int *taken) {