Skip to content

Commit

Permalink
sensor: add additional omnivision/superpix sensors (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorxda committed Nov 19, 2023
1 parent 0dc9cb4 commit 3eff09c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/hal/sstar.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@
#include "hal/sstar.h"
#include "tools.h"

static unsigned char onsemi_addrs[] = {0x20, 0};
static unsigned char sony_addrs[] = {0x34, 0};
static unsigned char gc_addrs[] = {0x42, 0x52, 0x6E, 0};
static unsigned char ssens_addrs[] = {0x60, 0};
static unsigned char superpix_addrs[] = {0x78, 0};
static unsigned char omni_addrs[] = {0x6C, 0};
static unsigned char gc_addrs[] = {0x42, 0x52, 0x6E, 0};
static unsigned char onsemi_addrs[] = {0x20, 0};

static sensor_addr_t sstar_possible_i2c_addrs[] = {
{SENSOR_ONSEMI, onsemi_addrs},
{SENSOR_SONY, sony_addrs},
{SENSOR_GALAXYCORE, gc_addrs},
{SENSOR_SMARTSENS, ssens_addrs},
{SENSOR_SUPERPIX, superpix_addrs},
{SENSOR_OMNIVISION, omni_addrs},
{SENSOR_GALAXYCORE, gc_addrs},
{SENSOR_ONSEMI, onsemi_addrs},
{0, NULL},
};

Expand Down
16 changes: 12 additions & 4 deletions src/sensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,16 +758,23 @@ static int detect_superpix_sensor(sensor_ctx_t *ctx, int fd,
return false;

int res = prod_msb << 8 | prod_lsb;

if (!res)
return false;

switch (res) {
// Omnivision-SuperPix OV2735
case 0x2735:
sprintf(ctx->sensor_id, "OV%04x", res);
return res;
break;
return true;
case 0x4308:
sprintf(ctx->sensor_id, "OS04B10");
return true;
case 0x5303:
sprintf(ctx->sensor_id, "OS03B10");
return true;
case 0x5602:
sprintf(ctx->sensor_id, "OS02G10");
return true;
}

prod_msb = i2c_read_register(fd, i2c_addr, 0xfa, 1, 1);
Expand All @@ -778,8 +785,8 @@ static int detect_superpix_sensor(sensor_ctx_t *ctx, int fd,
prod_lsb = i2c_read_register(fd, i2c_addr, 0xfb, 1, 1);
if (prod_lsb == -1)
return false;
res = prod_msb << 8 | prod_lsb;

res = prod_msb << 8 | prod_lsb;
if (!res)
return false;

Expand All @@ -800,6 +807,7 @@ static int detect_superpix_sensor(sensor_ctx_t *ctx, int fd,
if (res) {
sprintf(ctx->sensor_id, "SP%04x", res);
}

return res;
}

Expand Down

0 comments on commit 3eff09c

Please sign in to comment.