eeprom handling: Unify handling of boolean bit flags
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Thu, 14 May 2020 20:38:37 +0000 (22:38 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 27 May 2020 18:24:12 +0000 (20:24 +0200)
commit37388ecee483f0facac38486741d4e1680ddc51b
tree096640fcd6cceeb974b0e640447196851227164b
parent0f683bb574ff665aeabd1db8f1c0cc1cc8dc87b8
eeprom handling: Unify handling of boolean bit flags

Boolean bit flags should be zero or one in memory,
not the actual eeprom value FTDI assigned to them.

Example of the code change in ftdi_eeprom_build():

ftdi_eeprom_build():
-            if (eeprom->suspend_dbus7 == SUSPEND_DBUS7_BIT)
+            if (eeprom->suspend_dbus7)

The changes should not break any backward compatibility
in ftdi_build_eeprom().

The function ftdi_decode_eeprom() will return slightly different values
for boolean fields, but callers should test using "if (flag_enabled)"
instead of "if (flag_enabled == specific_value)" anyway.

Test done: Decoded eeprom of a FT232 serial cable stayed the same.
$ diff -u dump-old.txt dump-new.txt
-> no change
src/ftdi.c