eeprog is a Linux C program that allows you to read and write to
24Cxx EEPROM.
24Cxx EEPROM use the I2C protocol but most common controllers found in most
PC hardware only support SMBus (a superset of I2C).
What eeprog does is using SMBus commands to
read/write to I2C EEPROM so almost every controller could be used.
To use it you have to connect someway a 24Cxx EEPROM to the SMBus bus of
your PC.
I connected a 24C32(32kbit EEPROM) to the I2C connector of my Via Epia board
but you could use one of those parallel-to-I2C devices (I've never seen/used
one of those).
Latest release is 0.7.6
You can download it here: eeprog-0.7.6.tar.gz
Before using eeprog you must load (or build into the kernel) the
following I2C drivers:
# lsmod
Module Size Used by Not tainted
i2c-viapro 3244 0
i2c-proc 6356 0 (unused)
i2c-dev 3936 0
i2c-core 13956 0 [i2c-viapro i2c-proc i2c-dev]
|
i2c-viapro is the driver of my VIA controller, yours will probably differ.
Note that most I2C drivers are not included in the kernel source package but
you can download them from the
lm_sensors site.
To install just unpack the source and type make. You can move eeprog to /usr/local/bin if you want.
If everything has been set up properly you will be able to read the first byte
of the EEPROM at address 0x51 (your address may differ) on bus 0
(i.e. /dev/i2c-0) with:
# eeprog /dev/i2c-0 0x51 -r 0 -x
eeprog, a 24Cxx EEPROM reader/writer
Copyright (c) Stefano Barbato - All rights reserved.
Bus: /dev/i2c-0, Address: 0x51
Reading 1 bytes from 0x0
0000| 5a
|
# eeprog
eeprog, a 24Cxx EEPROM reader/writer
Copyright (c) Stefano Barbato - All rights reserved.
eeprog [ -r addr[:count] | -w addr ] /dev/i2c-N i2c-address
-r addr[:count] Read [count] (1 if omitted) bytes from [addr]
and print them to the standard output
-w addr Write input (stdin) at mem address [addr]
-x Set the hex output mode
-d Dummy mode, display what *would* have been done
The following environment variables could be set instead of the command
line arguments:
EEPROG_DEV device name(/dev/i2c-N)
EEPROG_I2C_ADDR i2c-address
Examples
1- read 64 bytes from the EEPROM at address 0x54 on bus 0 starting
at address 123 (decimal)
eeprog /dev/i2c-0 0x54 -r 123:64
2- prints the hex codes of the first 32 bytes read from bus 1
at address 0x22
eeprog /dev/i2c-1 0x51 -x -r 0x22:0x20
3- write the current timestamp at address 0x200 of the EEPROM on
bus 0 at address 0x33
date | eeprog /dev/i2c-0 0x33 -w 0x200
|
|