From ffff9b59a47c2a545e97bf405df5bdb36a1bed94 Mon Sep 17 00:00:00 2001 From: AI Dev Date: Fri, 30 Oct 2026 19:13:21 +0000 Subject: [PATCH 1/2] sensors: detect SmartSens SC1135 by 0x3008/0x3005 The SC1135 has no ID in 0x3107/0x3108, so the SmartSens probe gave up on it ("SC1135 catches here") and the camera reported no sensor. It is told by 0x3008 = 0x60 and 0x3005 = 0x22: that is the pair the Xiongmai XM510 isp daemon accepts as an SC1135 once 0x3107/0x3108 matched none of its IDs. Under emulation (qemu-bench's xm510 machine with its generic xm-sensor), every 0x3005 value was tried with 0x3008 = 0x60 and the daemon accepted 0x22 alone, logging "SC1135 sensor init OK"; the open XM510 ISP in OpenIPC/openxiongmai carries that sensor's scripts. The check runs only when 0x3107/0x3108 names no known part, after the SOI, onsemi, OmniVision and Sony probes, so nothing identified today is read differently. Unknown IDs other than 0 and 0xffff still report their value. Tested in the same emulator: SC1135 registers give SmartSens SC1135, 0x3005 = 0x23 gives no sensor, SC1235 registers still give SC1235. On two real XM510 cameras the JX-H62 and the AR0130 are unchanged. Not tested on SC1135 hardware. --- src/sensors.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/sensors.c b/src/sensors.c index 2d3bef11..bc99d1e9 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -468,6 +468,15 @@ static int detect_onsemi_sensor(sensor_ctx_t *ctx, int fd, return sid; } +// SC1135 holds no ID in 0x3107/0x3108; it is told by 0x3008 = 0x60 and +// 0x3005 = 0x22. That is the pair the Xiongmai XM510 isp daemon accepts as an +// SC1135 once 0x3107/0x3108 matched none of its IDs: a sweep of every 0x3005 +// value with 0x3008 = 0x60 under emulation accepted 0x22 alone. +static bool is_smartsens_sc1135(int fd, unsigned char i2c_addr) { + return i2c_read_register(fd, i2c_addr, 0x3008, 2, 1) == 0x60 && + i2c_read_register(fd, i2c_addr, 0x3005, 2, 1) == 0x22; +} + static int detect_smartsens_sensor(sensor_ctx_t *ctx, int fd, unsigned char i2c_addr) { if (i2c_change_addr(fd, i2c_addr) < 0) @@ -483,8 +492,6 @@ static int detect_smartsens_sensor(sensor_ctx_t *ctx, int fd, if (lower == -1) return false; - // check for SC1035, SC1145, SC1135 '0x3008' reg val is equal to 0x60 - int res = high << 8 | lower; switch (res) { case 0x0010: @@ -707,12 +714,13 @@ static int detect_smartsens_sensor(sensor_ctx_t *ctx, int fd, case 0xeb2c: strcpy(ctx->sensor_id, "SC2355"); return true; - case 0: - case 0xffff: - // SC1135 catches here - return false; default: - SENSOR_ERR("SmartSens", res); + if (is_smartsens_sc1135(fd, i2c_addr)) { + strcpy(ctx->sensor_id, "SC1135"); + return true; + } + if (res != 0 && res != 0xffff) + SENSOR_ERR("SmartSens", res); return false; } From a7f7682cceca31ee8b3bb29068af013874c74d38 Mon Sep 17 00:00:00 2001 From: AI Dev Date: Fri, 30 Oct 2026 19:19:07 +0000 Subject: [PATCH 2/2] sensors: SC1135 only when 0x3107/0x3108 read empty; fingerprint it The two extra reads are 16-bit addressed, which an 8-bit device takes as a register write, so they are made only where 0x3107/0x3108 read 0x0000 or 0xffff, where SC1135 was noted to land. An unknown non-zero ID is reported as before and reads nothing more. sensors_test gets a smartsens-sc1135 path: 0x3107/0x3108 empty, every 0x3008/0x3005 value swept. The fingerprint gains one line, 6022 SC1135, and nothing else changes. --- src/sensors.c | 13 +++++++++---- src/sensors_golden.txt | 1 + src/sensors_test.c | 9 +++++++++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/sensors.c b/src/sensors.c index bc99d1e9..9d1e1eec 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -471,7 +471,9 @@ static int detect_onsemi_sensor(sensor_ctx_t *ctx, int fd, // SC1135 holds no ID in 0x3107/0x3108; it is told by 0x3008 = 0x60 and // 0x3005 = 0x22. That is the pair the Xiongmai XM510 isp daemon accepts as an // SC1135 once 0x3107/0x3108 matched none of its IDs: a sweep of every 0x3005 -// value with 0x3008 = 0x60 under emulation accepted 0x22 alone. +// value with 0x3008 = 0x60 under emulation accepted 0x22 alone. The reads are +// 16-bit addressed, which an 8-bit device takes as a register write, so they +// are made only when 0x3107/0x3108 read empty. static bool is_smartsens_sc1135(int fd, unsigned char i2c_addr) { return i2c_read_register(fd, i2c_addr, 0x3008, 2, 1) == 0x60 && i2c_read_register(fd, i2c_addr, 0x3005, 2, 1) == 0x22; @@ -714,13 +716,16 @@ static int detect_smartsens_sensor(sensor_ctx_t *ctx, int fd, case 0xeb2c: strcpy(ctx->sensor_id, "SC2355"); return true; - default: + case 0: + case 0xffff: + // SC1135 has no ID here; only then are two more registers read if (is_smartsens_sc1135(fd, i2c_addr)) { strcpy(ctx->sensor_id, "SC1135"); return true; } - if (res != 0 && res != 0xffff) - SENSOR_ERR("SmartSens", res); + return false; + default: + SENSOR_ERR("SmartSens", res); return false; } diff --git a/src/sensors_golden.txt b/src/sensors_golden.txt index 51b9f706..3accbc35 100644 --- a/src/sensors_golden.txt +++ b/src/sensors_golden.txt @@ -63,6 +63,7 @@ smartsens da23 SC1345 smartsens da4d SC1346 smartsens dc42 SC4336 smartsens eb2c SC2355 +smartsens-sc1135 6022 SC1135 soi 0500 JXK00 soi 0501 JXK01 soi 0502 JXK02 diff --git a/src/sensors_test.c b/src/sensors_test.c index b8fc6daa..fb7082cc 100644 --- a/src/sensors_test.c +++ b/src/sensors_test.c @@ -139,6 +139,14 @@ static void sc_smartsens(uint32_t id) { mock_set(0x3107, 2, 1, id >> 8); mock_set(0x3108, 2, 1, id & 0xff); } +/* SC1135 has no ID in 0x3107/0x3108: they read empty, and 0x3008/0x3005 + * name it. */ +static void sc_smartsens_sc1135(uint32_t id) { + mock_set(0x3107, 2, 1, 0x00); + mock_set(0x3108, 2, 1, 0x00); + mock_set(0x3008, 2, 1, id >> 8); + mock_set(0x3005, 2, 1, id & 0xff); +} static void sc_soi(uint32_t id) { mock_set(0x0a, 1, 1, id >> 8); mock_set(0x0b, 1, 1, id & 0xff); @@ -221,6 +229,7 @@ static void sc_techpoint(uint32_t id) { static const struct scenario scenarios[] = { {"smartsens", detect_smartsens_sensor, sc_smartsens}, + {"smartsens-sc1135", detect_smartsens_sensor, sc_smartsens_sc1135}, {"soi", detect_soi_sensor, sc_soi}, {"onsemi", detect_onsemi_sensor, sc_onsemi}, {"omni", detect_omni_sensor, sc_omni},