Hello everyone,
It turns out, flashrom has two different code paths for probing from command line vs probing with libflashrom.
I think the logic should be the same, so as a goal I want to understand which approach is correct and use the same in both places. Have one piece of code and call it in two places.
What is the difference:
Command line keeps probing until the end of flashchips array, and as a result all matches will be found (no matter how many of them are). Currently code is on these lines: https://github.com/flashrom/flashrom/blob/main/cli_classic.c#L1211
Libflashrom only does probing twice, so at most two matches will be found. Currently code is on these lines: https://github.com/flashrom/flashrom/blob/main/libflashrom.c#L250
These two paths were initially introduced like this (>14 and >7yr ago).
To me, command line's approach makes sense - because why stop at two matches? What if there are three matching chip definitions, and #3 is actually what the user has?
So I am interested in what people think.
A context how did this come up: I started working towards giving SFDP-detection more priority and this involves updating the probing logic, and that's how I came to this.