Skip to content

Commit f6e64a1

Browse files
widgetiiclaude
andauthored
sensor: label vendor by part number, not by which probe matched (#181)
detect_superpix_sensor() does not probe a vendor, it probes a register family: 0xFD-paged, 8-bit registers, id at 0x02/0x03. The WillSemi group (OmniVision + SuperPix since 2018-19) ships that same design under both SP and OV/OS part numbers, so the probe matches parts from two brands — but get_sensor_id_i2c() stamped every hit "SuperPix" because the label was attached to the probe rather than to the id it matched. Five of the eight ids this function recognises are OmniVision part numbers, so ipctool emitted self-contradictory output: vendor: SuperPix model: OS04B10 That YAML is what `ipctool upload` ships to the OpenIPC cloud, so each affected camera contributed a wrong vendor/model pairing to the collected hardware data. Set the vendor per matched id instead. The rule: the brand that owns the part number we print — SP numbers are SuperPix, OV/OS numbers are OmniVision — which is the only assignment that keeps the two fields consistent with each other. This also un-comments, legitimately, the override the OS04D10 case already wanted ("Need to overwrite vendor somehow or move this to OV detect function") — with the vendor set inside the probe there is now somewhere to put it that the caller does not clobber. Model strings are deliberately unchanged; see #180 for the separate question of whether 0x2735 should print OV2735 or SP2305. Nothing consumes the sensor vendor field programmatically (getsensoridentity() and getsensorshort() return the model alone, `ipcinfo -v` is the chip vendor), so this is output-only and cannot affect firmware sensor-loading scripts. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent b528231 commit f6e64a1

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

src/sensors.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -900,34 +900,44 @@ static int detect_superpix_sensor(sensor_ctx_t *ctx, int fd,
900900
if (!res)
901901
return false;
902902

903+
// This probe matches a register family (0xFD-paged, id at 0x02/0x03) that
904+
// the WillSemi group ships under both SuperPix (SP) and OmniVision (OV/OS)
905+
// part numbers, so the vendor follows the id we matched, not the probe that
906+
// found it. Every branch sets it; get_sensor_id_i2c() does not override.
903907
switch (res) {
904908
case 0x140a:
909+
strcpy(ctx->vendor, "SuperPix");
905910
sprintf(ctx->sensor_id, "SP%04x", res);
906911
return true;
907-
// Omnivision-SuperPix OV2735
912+
// OmniVision OV2735. SuperPix ships the same die as SP2305 — identical
913+
// paged register map and the same 0x2735 id, so the two labels cannot be
914+
// told apart by detection alone
908915
case 0x2735:
916+
strcpy(ctx->vendor, "OmniVision");
909917
sprintf(ctx->sensor_id, "OV%04x", res);
910918
return true;
911919
case 0x4308:
920+
strcpy(ctx->vendor, "OmniVision");
912921
sprintf(ctx->sensor_id, "OS04B10");
913922
return true;
914923
case 0x5302:
915-
sprintf(ctx->sensor_id, "SP2308"); // or OS02M10
924+
strcpy(ctx->vendor, "SuperPix");
925+
sprintf(ctx->sensor_id, "SP2308"); // or OmniVision OS02M10
916926
return true;
917927
case 0x5303:
928+
strcpy(ctx->vendor, "OmniVision");
918929
sprintf(ctx->sensor_id, "OS03B10");
919930
return true;
920931
case 0x5602:
932+
strcpy(ctx->vendor, "OmniVision");
921933
sprintf(ctx->sensor_id, "OS02G10");
922934
return true;
923935
}
924936

925937
switch (res2) {
926-
// It's very hard to tell if this is original OmniVision or SuperPix...
927-
// Need to overwrite vendor somehow or move this to OV detect function
928938
case 0x530444:
939+
strcpy(ctx->vendor, "OmniVision");
929940
sprintf(ctx->sensor_id, "OS04D10");
930-
// strcpy(ctx->vendor, "OmniVision");
931941
return true;
932942
}
933943

@@ -959,6 +969,7 @@ static int detect_superpix_sensor(sensor_ctx_t *ctx, int fd,
959969
}
960970

961971
if (res) {
972+
strcpy(ctx->vendor, "SuperPix");
962973
sprintf(ctx->sensor_id, "SP%04x", res);
963974
}
964975

@@ -1130,7 +1141,8 @@ static bool get_sensor_id_i2c(sensor_ctx_t *ctx) {
11301141
detected = true;
11311142
} else if (detect_possible_sensors(ctx, fd, detect_superpix_sensor,
11321143
SENSOR_SUPERPIX)) {
1133-
strcpy(ctx->vendor, "SuperPix");
1144+
// vendor is set by the probe itself: this register family carries both
1145+
// SuperPix and OmniVision part numbers
11341146
ctx->reg_width = 1;
11351147
detected = true;
11361148
} else if (detect_possible_sensors(ctx, fd, detect_techpoint_adc,

0 commit comments

Comments
 (0)