-
Couldn't load subscription status.
- Fork 234
Description
Hello,
First, thank you for creating and maintaining this excellent library.
I would like to propose the addition of a new feature: direct support for the EEPROM "User Area". This feature is officially documented by FTDI in their Application Note AN_121, which explains how unused space in the EEPROM can be used by developers to store custom data.
Motivation
Many applications require storing small amounts of custom information on-device, such as hardware revision, license keys, or configuration flags. The User Area is the designated space for this purpose. Currently, accessing it with
pyftdi requires creating a custom subclass of FtdiEeprom to manually calculate offsets and modify the internal buffer.
Integrating this feature directly into the library would make it much more complete and easier to use.
Proposed Implementation
A way to implement this could be new properties on the FtdiEeprom class:
1 - user_area_size (read-only property):
-
Returns the available size (in bytes) of the user area.
-
The logic would follow the formulas in AN_121, accounting for the EEPROM size (93C46 vs. 93C56/66) and the length of the manufacturer/product/serial strings .
2 - user_area (read/write property):
-
Getter: Returns the raw
bytescurrently in the user area. -
Setter: Takes a bytes object, validates its length against user_area_size, writes the data to the correct offset in the internal
_eeprombuffer, and sets the_dirtyflag toTrue.
This would provide a simple and powerful API for developers:
# Example Usage
print(f"Available user area: {eeprom.user_area_size} bytes")
# Read existing data
custom_data = eeprom.user_area
# Write new data
eeprom.user_area = b'\x01\x02\x03\x04'
eeprom.commit()I believe this would be a valuable addition to pyftdi. I'm happy to provide more details from my own implementation if it helps.
Thank you for your consideration.