3

I have a 24CS02 EEPROM on my I2C bus. I can successfully read it and have successfully written to the beginning of the EEPROM (ie from /sys/bus/i2c/devices/1-0050/eeprom). I am wondering if/how to read and write a specific address. I am hoping for something a little more efficient than reading the entire EEPROM, and overwriting the part I want to write and then writing the whole thing back. Is this possible from sysFS?

2

Yes, you can use dd or write your own program and use the seek function on the file to move to the offset you want to write to. For example if you wanted to write 64 bytes from input.bin starting from offset 2048 you could do the following...

dd if=input.bin of=/sys/bus/i2c/devices/1-0050/eeprom bs=1 count=64 skip=2048 seek=2048

Skip is the offset to start from for the input file and seek is the offset to start at for the output (eeprom). Count is the number of bytes to write.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.