Skip to content

Commit

Permalink
Refactor IMX664, IMX662, IMX675, IMX482 sensors detection
Browse files Browse the repository at this point in the history
  • Loading branch information
widgetii committed Jan 28, 2024
1 parent 1bab16f commit 4438c6e
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions src/sensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,28 +320,32 @@ static int detect_sony_sensor(sensor_ctx_t *ctx, int fd,
}

int r30A4 = READ(0xA4);
switch (r30A4 & 0xF0) {
case 0xA0:
if (READ(0xC44) == 6) {
sprintf(ctx->sensor_id, "IMX664");
return true;
}

if (((r30A4 & 0xF0) == 0xA0) && (READ(0xC44) == 6)) {
sprintf(ctx->sensor_id, "IMX664");
return true;
}

// TODO: not tested yet
if (((r30A4 & 0xF0) == 0xA0) && (READ(0xC40) == 5)) {
sprintf(ctx->sensor_id, "IMX662");
return true;
}
// TODO: not tested yet
if (READ(0xC40) == 5) {
sprintf(ctx->sensor_id, "IMX662");
return true;
}

// TODO: not tested yet
if (((r30A4 & 0xF0) == 0xA0) && (READ(0xC7C) == 0x16)) {
sprintf(ctx->sensor_id, "IMX675");
return true;
}
// TODO: not tested yet
if (READ(0xC7C) == 0x16) {
sprintf(ctx->sensor_id, "IMX675");
return true;
}
break;

// TODO: not tested yet
if (((r30A4 & 0xF0) == 0x20) && (READ(0x152) == 0x1E)) {
sprintf(ctx->sensor_id, "IMX482");
return true;
case 0x20:
// TODO: not tested yet
if (READ(0x152) == 0x1E) {
sprintf(ctx->sensor_id, "IMX482");
return true;
}
}

return false;
Expand Down

0 comments on commit 4438c6e

Please sign in to comment.