int camera_init (Camera *camera, GPContext *context) { CameraAbilities a; int ret; char *dump, buf[256]; /* First, set up all the function pointers */ camera->functions->exit = camera_exit; camera->functions->summary = camera_summary; camera->functions->manual = camera_manual; camera->functions->about = camera_about; camera->functions->get_config = camera_get_config; camera->functions->set_config = camera_set_config; /* Tell the CameraFilesystem where to get lists from */ gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera); camera->pl = calloc (1, sizeof(CameraPrivateLibrary)); if (!camera->pl) return GP_ERROR_NO_MEMORY; ret = gp_setting_get("tp6801", "syncdatetime", buf); if (ret == GP_OK) camera->pl->syncdatetime = buf[0] == '1'; else camera->pl->syncdatetime = 1; CHECK (gp_camera_get_abilities(camera, &a)) dump = getenv("GP_TP6801_DUMP"); if (dump) ret = tp6801_open_dump (camera, dump); else ret = tp6801_open_device (camera); if (ret != GP_OK) { camera_exit (camera, context); return ret; } if (camera->pl->syncdatetime) { struct tm tm; time_t t; t = time (NULL); if (localtime_r (&t , &tm)) { ret = tp6801_set_time_and_date (camera, &tm); if (ret != GP_OK) { camera_exit (camera, context); return ret; } } } return GP_OK; }
static void __exit camera_module_exit(void) { u32 val; if(get_hw_config_int("camera/miniisp", &val, NULL) == true){ if(val == 1){ mini_isp_camera_exit(); }else{ camera_exit(); } } else{ camera_exit(); } }
static void exit_handler(void) { DEBUG("execute exit handler\n"); if (paddr_mem_tv != NULL) { munmap(paddr_mem_tv, size_mem); } if(fd_mem >= 0) { close(fd_mem); fd_mem = -1; } if (fd_i2c >= 0) { close(fd_i2c); fd_i2c = -1; } tvout_close(&config); camera_exit(&camera); }
int camera_init (Camera *camera, GPContext *context) { int i, j, ret; #ifdef HAVE_ICONV char *curloc; #endif char buf[256]; st2205_filename clean_name; /* First, set up all the function pointers */ camera->functions->exit = camera_exit; camera->functions->summary = camera_summary; camera->functions->manual = camera_manual; camera->functions->about = camera_about; camera->functions->get_config = camera_get_config; camera->functions->set_config = camera_set_config; /* FIXME add gp_camera_get_storageinfo support */ /* Tell the CameraFilesystem where to get lists from */ gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera); camera->pl = calloc (1, sizeof(CameraPrivateLibrary)); if (!camera->pl) return GP_ERROR_NO_MEMORY; ret = gp_setting_get("st2205", "syncdatetime", buf); if (ret == GP_OK) camera->pl->syncdatetime = buf[0] == '1'; else camera->pl->syncdatetime = 1; ret = gp_setting_get("st2205", "orientation", buf); if (ret == GP_OK) { ret = string_to_orientation (buf); if (ret >= 0) camera->pl->orientation = ret; } #ifdef HAVE_ICONV curloc = nl_langinfo (CODESET); if (!curloc) curloc="UTF-8"; camera->pl->cd = iconv_open("ASCII", curloc); if (camera->pl->cd == (iconv_t) -1) { gp_log (GP_LOG_ERROR, "iconv", "Failed to create iconv converter"); camera_exit (camera, context); return GP_ERROR_OS_FAILURE; } #endif #if 1 ret = st2205_open_device (camera); #else ret = st2205_open_dump (camera, "/home/hans/st2205tool/memdump.bin", 128, 128); #endif if (ret != GP_OK) { camera_exit (camera, context); return ret; } GP_DEBUG ("st2205 memory size: %d, free: %d", st2205_get_mem_size (camera), st2205_get_free_mem_size (camera)); /* Get the filenames from the picframe */ ret = st2205_get_filenames (camera, camera->pl->filenames); if (ret != GP_OK) { camera_exit (camera, context); return ret; } /* And clean them up and make them unique */ for (i = 0; i < ST2205_MAX_NO_FILES; i++) { if (!camera->pl->filenames[i][0]) continue; /* Filter out non ASCII chars (some frames ship with sample photo's with garbage in the names) */ for (j = 0; camera->pl->filenames[i][j]; j++) { if ((uint8_t)camera->pl->filenames[i][j] < 0x20 || (uint8_t)camera->pl->filenames[i][j] > 0x7E) clean_name[j] = '?'; else clean_name[j] = camera->pl->filenames[i][j]; } clean_name[j] = 0; ST2205_SET_FILENAME(camera->pl->filenames[i], clean_name, i); } /* Sync time if requested */ if (camera->pl->syncdatetime) { struct tm tm; time_t t; t = time (NULL); if (localtime_r (&t , &tm)) { ret = st2205_set_time_and_date (camera, &tm); if (ret != GP_OK) { camera_exit (camera, context); return ret; } } } return GP_OK; }
int camera_init (Camera *camera, GPContext *context) { CameraAbilities a; int i, ret; char *dump, buf[256]; /* First, set up all the function pointers */ camera->functions->exit = camera_exit; camera->functions->summary = camera_summary; camera->functions->manual = camera_manual; camera->functions->about = camera_about; camera->functions->get_config = camera_get_config; camera->functions->set_config = camera_set_config; /* Tell the CameraFilesystem where to get lists from */ gp_filesystem_set_funcs (camera->fs, &fsfuncs, camera); camera->pl = calloc (1, sizeof(CameraPrivateLibrary)); if (!camera->pl) return GP_ERROR_NO_MEMORY; ret = gp_setting_get("ax203", "syncdatetime", buf); if (ret == GP_OK) camera->pl->syncdatetime = buf[0] == '1'; else camera->pl->syncdatetime = 1; CHECK (gp_camera_get_abilities(camera, &a)) for (i = 0; ax203_devinfo[i].vendor_id; i++) { if ((a.usb_vendor == ax203_devinfo[i].vendor_id) && (a.usb_product == ax203_devinfo[i].product_id)) { camera->pl->frame_version = ax203_devinfo[i].frame_version; break; } } if (!ax203_devinfo[i].vendor_id) { gp_log (GP_LOG_ERROR, "ax203", "Unknown USB ID"); camera_exit (camera, context); return GP_ERROR_BAD_PARAMETERS; } dump = getenv("GP_AX203_DUMP"); if (dump) ret = ax203_open_dump (camera, dump); else ret = ax203_open_device (camera); if (ret != GP_OK) { camera_exit (camera, context); return ret; } GP_DEBUG ("ax203 memory size: %d, free: %d", ax203_get_mem_size (camera), ax203_get_free_mem_size (camera)); if (camera->pl->syncdatetime) { struct tm tm; time_t t; t = time (NULL); if (localtime_r (&t , &tm)) { ret = ax203_set_time_and_date (camera, &tm); if (ret != GP_OK) { camera_exit (camera, context); return ret; } } } return GP_OK; }