--- eeprom.c 2003-05-31 06:18:24.000000000 +0200 +++ eeprom.cpatched 2003-08-30 21:22:02.000000000 +0200 @@ -18,11 +18,11 @@ settings. */ -#define DEFAULT_I2C_BUS "/dev/i2c-0" +#define DEFAULT_I2C_BUS "/dev/i2c-2" #define DEFAULT_EEPROM_ADDR 0x50 /* the 24C16 sits on i2c address 0x50 */ -#define DEFAULT_NUM_PAGES 8 /* we default to a 24C16 eeprom which has 8 pages */ +#define DEFAULT_NUM_PAGES 4 /* we default to a 24C16 eeprom which has 8 pages */ #define BYTES_PER_PAGE 256 /* one eeprom page is 256 byte */ -#define MAX_BYTES 8 /* max number of bytes to write in one chunk */ +#define MAX_BYTES 16 /* max number of bytes to write in one chunk */ /* ... note: 24C02 and 24C01 only allow 8 bytes to be written in one chunk. * * if you are going to write 24C04,8,16 you can change this to 16 */ @@ -185,16 +185,18 @@ } } - + fprintf(stderr,"base-address of eeproms : 0x%02x\n",addr); fprintf(stderr,"number of pages to read : %d (0x%02x .. 0x%02x)\n", pages,addr,addr+pages-1); if(fn){ if(!rwmode) /* if we are reading, *WRITE* to file */ + if (fn[0] == '-') f=1; else f=open(fn,O_WRONLY|O_CREAT,0666); else /* if we are writing to eeprom, *READ* from file */ - f=open(fn,O_RDONLY); + f=open(fn,O_RDONLY); + if(f<0){ fprintf(stderr,"Could not open data-file %s for reading or writing\n",fn); perror(fn);