converted more camlibs to fsfuncs.

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@8700 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Marcus Meissner
2006-03-31 21:45:16 +00:00
parent 22ce3b452b
commit 3dcdaabb24
4 changed files with 28 additions and 24 deletions

View File

@@ -433,6 +433,13 @@ static int delete_file_func(CameraFilesystem *fs, const char *folder,
return digita_file_delete(camera, folder, filename, context);
}
static CameraFilesystemFuncs fsfuncs = {
.file_list_func = file_list_func,
.folder_list_func = folder_list_func,
.get_file_func = get_file_func,
.del_file_func = delete_file_func
};
int camera_init(Camera *camera, GPContext *context)
{
int ret = 0;
@@ -446,10 +453,7 @@ int camera_init(Camera *camera, GPContext *context)
camera->functions->about = camera_about;
/* Set up the CameraFilesystem */
gp_filesystem_set_list_funcs(camera->fs, file_list_func,
folder_list_func, camera);
gp_filesystem_set_file_funcs(camera->fs, get_file_func,
delete_file_func, camera);
gp_filesystem_set_funcs(camera->fs, &fsfuncs, camera);
GP_DEBUG( "Initializing the camera");

View File

@@ -416,6 +416,12 @@ camera_id (CameraText *id)
return (GP_OK);
}
static CameraFilesystemFuncs fsfuncs = {
.file_list_func = file_list_func,
.get_file_func = get_file_func,
.delete_all_func = enigma13_flash_delete_all
};
int
camera_init (Camera *camera, GPContext *context)
{
@@ -423,14 +429,7 @@ camera_init (Camera *camera, GPContext *context)
camera->functions->about = enigma13_about;
CHECK(gp_filesystem_set_list_funcs
(camera->fs, file_list_func, NULL, camera));
CHECK(gp_filesystem_set_file_funcs
(camera->fs, get_file_func, NULL, camera));
CHECK(gp_filesystem_set_folder_funcs
(camera->fs,NULL, enigma13_flash_delete_all , NULL, NULL, camera));
CHECK(gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera));
CHECK(gp_port_get_settings( camera->port, &settings));
settings.usb.inep = 0x82;
settings.usb.outep = 0x03;
@@ -439,7 +438,6 @@ camera_init (Camera *camera, GPContext *context)
settings.usb.altsetting = 0;
CHECK(gp_port_set_timeout (camera->port, ENIGMA13_USB_TIMEOUT_MS));
CHECK(gp_port_set_settings( camera->port, settings));
return GP_OK;

View File

@@ -324,6 +324,11 @@ camera_exit (Camera *camera, GPContext *context)
return GP_OK;
}
static CameraFilesystemFuncs fsfuncs = {
.file_list_func = file_list_func,
.get_file_func = get_file_func
};
int
camera_init(Camera *camera, GPContext *context)
{
@@ -345,11 +350,7 @@ camera_init(Camera *camera, GPContext *context)
if (ret < 0) return ret;
/* Tell the CameraFilesystem where to get lists from */
gp_filesystem_set_list_funcs (camera->fs, file_list_func,
NULL, camera);
gp_filesystem_set_file_funcs (camera->fs, get_file_func, NULL, camera);
gp_filesystem_set_folder_funcs (camera->fs, NULL, NULL,
NULL, NULL, camera);
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
camera->pl = malloc (sizeof (CameraPrivateLibrary));
if (!camera->pl) return GP_ERROR_NO_MEMORY;
@@ -363,8 +364,6 @@ camera_init(Camera *camera, GPContext *context)
if (ret != GP_OK) {
free(camera->pl);
return ret;
};
}
return GP_OK;
}

View File

@@ -179,6 +179,11 @@ camera_exit (Camera *camera, GPContext *context)
return GP_OK;
}
static CameraFilesystemFuncs fsfuncs = {
.file_list_func = file_list_func,
.get_file_func = get_file_func
};
int
camera_init(Camera *camera, GPContext *context)
{
@@ -218,8 +223,7 @@ camera_init(Camera *camera, GPContext *context)
GP_DEBUG("outep = %x\n", settings.usb.outep);
/* Tell the CameraFilesystem where to get lists from */
gp_filesystem_set_list_funcs (camera->fs, file_list_func, NULL, camera);
gp_filesystem_set_file_funcs (camera->fs, get_file_func, NULL, camera);
gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera);
camera->pl = malloc (sizeof (CameraPrivateLibrary));
if (!camera->pl)
@@ -228,6 +232,5 @@ camera_init(Camera *camera, GPContext *context)
/* Connect to the camera */
lg_gsm_init (camera->port, &camera->pl->model, camera->pl->info);
return GP_OK;
}