Skip to content

sensors: ImageDesign IDs from vendor drivers, not guesses - #228

Merged
widgetii merged 1 commit into
masterfrom
imagedesign-detection
Oct 4, 2026
Merged

widgetii merged 1 commit into
masterfrom
imagedesign-detection

Conversation

@widgetii

@widgetii widgetii commented Oct 4, 2026

Copy link
Copy Markdown
Member

Rewrites detect_imagedesign_sensor from vendor-driver evidence (and the MIS2008 datasheet register list).

Chip ID Before After Evidence
0x5001 MIS5001 removed added in b328d02 as a "wild guess"; no driver uses it — MIS5001 reads 0x1311 (Ingenic, Sophgo cvi_sensor, Rockchip RV1106)
0x2003 — MIS2003 Ingenic driver + sinfo
0x2009 — MIS2031 Rockchip SDK mis2031.c; MIS2032 (Sophgo, Ingenic) shares it
0x20e1 — MIS20S1 Ingenic t41 driver
0x5003 — MIS5011 Ingenic t41 driver
0x03fc @ 0x541d/0x541e — MIS40C1 Sophgo/aimorelogy driver; only tried when 0x3000 matches nothing
0x2008 MIS2008 unchanged + comment MIS2009 shares it
0x1311 MIS4001 unchanged + comment MIS5001 shares it

Ingenic's MIS40C1 check (0x0004 @ 0x3004/0x3005) is deliberately not used: the MIS2008 datasheet lists 0x3004/0x3005 as BROADCAST_ID, RW, reset default 0x0004 — it would match any MIS part.

The shared IDs follow the SC223A precedent: one name, a comment, no invented discriminator.

sensors_golden.txt diff is exactly the six ImageDesign lines; new imagedesign-alt scenario covers the MIS40C1 fallback. sensors_test passes. Not tested on hardware.

🤖 Generated with Claude Code

Drop the 0x5001 "wild guess": every MIS5001 driver (Ingenic, Sophgo
cvi_sensor, Rockchip RV1106) checks for 0x1311, the MIS4001 ID. Add the
IDs those drivers do check: 0x2003 MIS2003, 0x2009 MIS2031 (MIS2032
shares it), 0x20e1 MIS20S1, 0x5003 MIS5011, and MIS40C1 by 0x03fc at
0x541d/0x541e once 0x3000 has said nothing.

Ingenic's MIS40C1 check (0x0004 at 0x3004/0x3005) is not used: on
MIS2008 that is BROADCAST_ID, read-write with reset default 0x0004, so it
would match any MIS part.

0x2008 (MIS2008/MIS2009) and 0x1311 (MIS4001/MIS5001) are shared IDs with
no known read-only discriminator; they keep one name and a comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can tweak Display settings with a live preview to see your comment before it ships

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Identify ImageDesign sensors using vendor-driver chip IDs

🐞 Bug fix ✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Replace the speculative MIS5001 ID with vendor-driver-backed ImageDesign sensor mappings.
• Identify MIS40C1 through its alternate registers without relying on a writable broadcast ID.
• Extend the sensor fingerprint test to cover the alternate identification path.
Diagram

graph TD
  P["Primary ID registers"] --> D{"Known ID?"} -->|Yes| N["Primary sensor name"]
  D -->|No| F["Alternate ID registers"] --> M{"MIS40C1 ID?"} -->|Yes| C["MIS40C1 name"]
  M -->|No| X["No identification"]
Loading
High-Level Assessment

Keep the vendor-driver-backed mappings and check MIS40C1 only after an unknown primary ID. Guessing distinct names for shared IDs or using the writable BROADCAST_ID as a discriminator would risk false identification.

Files changed (3) +50 / -8

Bug fix (1) +37 / -7
sensors.cCorrect ImageDesign ID mappings and add MIS40C1 fallback +37/-7

Correct ImageDesign ID mappings and add MIS40C1 fallback

• Adds mappings for MIS2003, MIS2031, MIS20S1, and MIS5011 while removing the speculative 0x5001 mapping. Documents shared IDs and checks the alternate 0x541d/0x541e signature for MIS40C1 only when the primary ID is unrecognized.

src/sensors.c

Tests (2) +13 / -1
sensors_golden.txtRecord revised ImageDesign identification results +5/-1

Record revised ImageDesign identification results

• Adds the newly recognized IDs and MIS40C1 alternate-path result, and removes the unsupported MIS5001 result from the committed test fingerprint.

src/sensors_golden.txt

sensors_test.cSweep the MIS40C1 alternate-register path +8/-0

Sweep the MIS40C1 alternate-register path

• Adds a mock scenario that supplies an unknown primary ID and sweeps the alternate ID registers, allowing the fingerprint test to cover MIS40C1 detection.

src/sensors_test.c

@widgetii
widgetii merged commit 2890476 into master Oct 4, 2026
5 checks passed
@widgetii
widgetii deleted the imagedesign-detection branch October 4, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant