readeeprom: Allow FRU ID 0 to be selected
We incorrectly checked that FRU ID != 0, which is the default FRU ID.
Actually, the IPMI spec specifies FRU ID 0xff as reserved, so the check
was changed to prevent that ID from being used instead.
Split out fruid parsing code to its own function to cover various edge
and failure cases.
Tested:
Ran 'phosphor-read-eeprom --eeprom fru.bin --fruid=0' and checked that
values are reported to inventory as expected.
Ran with '--fruid=ff' ('invalid' FRU ID): rejected
Ran with '--fruid=xx' (non-HEX FRU ID): rejected
Ran with '--fruid=100' (out-of-range FRU ID): rejected
Ran with '--fruid="0 0"' (invalid number): rejected
Ran with '--fruid=10.0' (non-integer): rejected
Ran with '--fruid=0x12' (valid HEX FRU ID): accepted
Ran with '--fruid=fe' (valid HEX FRU ID): accepted
Change-Id: Ic1fb79cefc6931f21d0b5cb4363ad5fd44f47c92
Signed-off-by: Oskar Senft <osk@google.com>
1 file changed