use libmegapixels_get_model in find_calibration

This commit is contained in:
Egor Shestakov
2025-03-12 12:06:38 +00:00
parent dc60446c15
commit ae48e07f84

View File

@@ -1,6 +1,7 @@
#include "dcp.h"
#include <libdng.h>
#include <libmegapixels.h>
#include <malloc.h>
#include <stdbool.h>
#include <stdio.h>
@@ -42,30 +43,12 @@ bool
find_calibration(char *conffile, const char *sensor)
{
char model[512];
FILE *fp;
if (access("/proc/device-tree/compatible", F_OK) == -1) {
int model_found = libmegapixels_get_model(sizeof(model), model);
if (!model_found)
return false;
}
fp = fopen("/proc/device-tree/compatible", "r");
char *modelptr = model;
while (1) {
int c = fgetc(fp);
if (c == EOF) {
*(modelptr) = '\0';
return find_calibration_by_model(conffile, model, sensor);
}
*(modelptr++) = (char)c;
if (c == 0) {
bool res =
find_calibration_by_model(conffile, model, sensor);
if (res) {
return true;
}
modelptr = model;
}
}
}
struct MPCameraCalibration
parse_calibration_file(const char *path)
{