[i2c] I2C: Getting Compiation Error for application program
Sachin Rane
SRane at alphion.com
Wed Sep 20 16:52:35 CEST 2006
Hi Jean,
Sorry for incomplete problem description (without error log).
The error list was huge and I fell it is unappropiate to send it as an attachment on mailing list.
(I didn't want to load the Inbox of the mailing list member).
I am attaching the error log file for reference.
Thanks and Regards,
Sachin Rane
________________________________
From: Jean Delvare [mailto:khali at linux-fr.org]
Sent: Wed 9/20/2006 9:12 AM
To: Sachin Rane
Cc: i2c at lm-sensors.org
Subject: Re: [i2c] I2C: Getting Compiation Error for application program
Hi Sachin,
> I am trying to compile simple program (appended), but getting lots of compilation error.
...which you don't show. Are we supposed to guess?
> I am using Timesys Linux 2.6.13 for ppc440 evaluation board.
Please don't post to 3 mailing lists at once. I've stripped the other
two.
> Command used for compilation:
> $> gcc eeprom-client.c -o eeprom-client.o
>
> Could you help me to find out the reason behind getting the errors?
>
> Regards,
> Sachin Rane
>
>
> 8< ------------------------eeprom-client.c -------------------------------------------------------------------------------------
>
> #include <linux/i2c.h>
This header file doesn't exist in userspace, so you don't want to
include it.
> #include <linux/i2c-dev.h>
Are you certain the compiler picks the right file (from the lm_sensors
package and not from the kernel tree?) You should check the
preprocessor output (gcc -E) to make sure.
>
> int main()
> {
> int file;
> int adapter_nr = 0; /* probably dynamically determined */
> char filename[20];
> int addr = 0xA1; /* The I2C address */
No, the 7-bit I2C address of your EEPROM is 0x50.
>
> sprintf(filename,"/dev/i2c-%d",adapter_nr);
> if ((file = open(filename,O_RDWR)) < 0)
> {
> exit(1);
> }
>
> if (ioctl(file,I2C_SLAVE,addr) < 0)
> {
> exit(1);
> }
> else
> {
> printf("\n Able to bind the adapter");
> }
> return 0;
> }
>
> 8< -------------------------------------------------------------------------------------------------------------
>
As a side note, we already have some tools to work with eeproms. Look
under prog/eepromer in the lm_sensors package. Maybe these are OK for
what you want to do and you don't even need to write your own.
--
Jean Delvare
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.lm-sensors.org/pipermail/i2c/attachments/20060920/04dfc784/attachment-0001.html
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CompilationErrorLog.txt
Url: http://lists.lm-sensors.org/pipermail/i2c/attachments/20060920/04dfc784/attachment-0001.txt
More information about the i2c
mailing list