pimoroni / inky

Combined library for V2/V3 Inky pHAT and Inky wHAT.
https://shop.pimoroni.com/?q=inky
MIT License
582 stars 122 forks source link

Magic number and checksum for eeprom #164

Open kevinjwalters opened 1 year ago

kevinjwalters commented 1 year ago

The EEPROMs used to identify some Pimoroni displays doesn't currently include any identifiers to indicate the data is valid.

https://github.com/pimoroni/inky/blob/master/library/inky/eeprom.py would benefit from

  1. A magic number to indicate the EEPROM contains Pimoroni data.
  2. An identifier that hardware is a display.
  3. Some sort of checksum for data integrity - this would also catch any rare issues with corruption over the wire (i2c).
  4. A specific error indicating EEPROM has never been written to (do these contain 0xff by default?) to aid diagnosis of rare uninitialised/wiped EEPROMs.

This was highlighted by an issue with a faulty Inky Impression 7.3 in
Pimoroni Forums: Inky Impression 7.3 Auto Detection Not Working (might be github user @caeci11ius).

Gadgetoid commented 1 year ago

Agreed, though we'd have to find some way to preserve backwards compatibility in addition to rolling out data validation and that introduces something of a problem- if it fails validation and falls back to the old method, it's not- afaik?- meaningfully any different to just using the old method?

I can't conceive of a way to handle this. Though I don't exactly have my best thinking hat on right now.