void camera_control_backup_system_settings(CameraControl* cc, const char* file) { int AutoAEC = 0; int AutoAGC = 0; int Gain = 0; int Exposure = 0; int Contrast = 0; int Brightness = 0; int fd = open_v4l2_device(cc->cameraID); if (fd != -1) { AutoAEC = v4l2_get_control(fd, V4L2_CID_EXPOSURE_AUTO); AutoAGC = v4l2_get_control(fd, V4L2_CID_AUTOGAIN); Gain = v4l2_get_control(fd, V4L2_CID_GAIN); Exposure = v4l2_get_control(fd, V4L2_CID_EXPOSURE); Contrast = v4l2_get_control(fd, V4L2_CID_CONTRAST); Brightness = v4l2_get_control(fd, V4L2_CID_BRIGHTNESS); v4l2_close(fd); dictionary* ini = dictionary_new(0); iniparser_set(ini, "PSEye", 0); iniparser_set_int(ini, "PSEye:AutoAEC", AutoAEC); iniparser_set_int(ini, "PSEye:AutoAGC", AutoAGC); iniparser_set_int(ini, "PSEye:Gain", Gain); iniparser_set_int(ini, "PSEye:Exposure", Exposure); iniparser_set_int(ini, "PSEye:Contrast", Contrast); iniparser_set_int(ini, "PSEye:Brightness", Brightness); iniparser_save_ini(ini, file); dictionary_del(ini); } }
void camera_control_backup_system_settings(CameraControl* cc, const char* file) { #if !defined(CAMERA_CONTROL_USE_CL_DRIVER) && !defined(CAMERA_CONTROL_USE_PS3EYE_DRIVER) && defined(PSMOVE_USE_PSEYE) HKEY hKey; DWORD l = sizeof(DWORD); DWORD AutoAEC = 0; DWORD AutoAGC = 0; DWORD AutoAWB = 0; DWORD Exposure = 0; DWORD Gain = 0; DWORD wbB = 0; DWORD wbG = 0; DWORD wbR = 0; char* PATH = CL_DRIVER_REG_PATH; int err = RegOpenKeyEx(HKEY_CURRENT_USER, PATH, 0, KEY_ALL_ACCESS, &hKey); if (err != ERROR_SUCCESS) { printf("Error: %d Unable to open reg-key: [HKCU]\\%s!", err, PATH); return; } RegQueryValueEx(hKey, "AutoAEC", NULL, NULL, (LPBYTE) &AutoAEC, &l); RegQueryValueEx(hKey, "AutoAGC", NULL, NULL, (LPBYTE) &AutoAGC, &l); RegQueryValueEx(hKey, "AutoAWB", NULL, NULL, (LPBYTE) &AutoAWB, &l); RegQueryValueEx(hKey, "Exposure", NULL, NULL, (LPBYTE) &Exposure, &l); RegQueryValueEx(hKey, "Gain", NULL, NULL, (LPBYTE) &Gain, &l); RegQueryValueEx(hKey, "WhiteBalanceB", NULL, NULL, (LPBYTE) &wbB, &l); RegQueryValueEx(hKey, "WhiteBalanceG", NULL, NULL, (LPBYTE) &wbG, &l); RegQueryValueEx(hKey, "WhiteBalanceR", NULL, NULL, (LPBYTE) &wbR, &l); dictionary* ini = dictionary_new(0); iniparser_set(ini, "PSEye", 0); iniparser_set_int(ini, "PSEye:AutoAEC", AutoAEC); iniparser_set_int(ini, "PSEye:AutoAGC", AutoAGC); iniparser_set_int(ini, "PSEye:AutoAWB", AutoAWB); iniparser_set_int(ini, "PSEye:Exposure", Exposure); iniparser_set_int(ini, "PSEye:Gain", Gain); iniparser_set_int(ini, "PSEye:WhiteBalanceB", wbB); iniparser_set_int(ini, "PSEye:WhiteBalanceG", wbG); iniparser_set_int(ini, "PSEye:WhiteBalanceR", wbG); iniparser_save_ini(ini, file); dictionary_del(ini); #endif }