public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Fabien Marteau <fabien.marteau-QFKgK+z4sOrR7s880joybQ@public.gmane.org>
Cc: i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: Re: Simple read byte data compilation problem
Date: Tue, 21 Oct 2008 14:59:56 +0200	[thread overview]
Message-ID: <20081021145956.4a65467e@hyperion.delvare> (raw)
In-Reply-To: <ce62e9d00810210244p3194a50fj3b6b19209465ac7e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Salut Fabien,

On Tue, 21 Oct 2008 11:44:28 +0200, Fabien Marteau wrote:
> I wrote a simple user program to test an i2c bus driver. I found in
> Documentation/i2c/dev-interface their is macro function to read data
> (i2c_smbus_read_byte_data). I used it but I have link error when I compile :
> $ arm-linux-gcc -O i2cread.c -o i2cread
> /tmp/ccfa90st.o: In function `read_byte':
> i2cread.c:(.text+0x3c): undefined reference to `i2c_smbus_read_byte_data'
> collect2: ld returned 1 exit status
> 
> Is someone know what is the problem ?

Documentation/i2c/dev-interface says:

So let's say you want to access an i2c adapter from a C program. The
first thing to do is "#include <linux/i2c-dev.h>". Please note that
there are two files named "i2c-dev.h" out there, one is distributed
with the Linux kernel and is meant to be included from kernel
driver code, the other one is distributed with i2c-tools and is
meant to be included from user-space programs. You obviously want
the second one here.

Apparently you missed this paragraph.

As a side note, if you only need to test your bus driver, the
i2cdetect, i2cget, i2cset and i2cdump utilities from the i2c-tools
package should be a good start, maybe you don't need to write your own
utility.

-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

  parent reply	other threads:[~2008-10-21 12:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21  9:44 Simple read byte data compilation problem Fabien Marteau
     [not found] ` <ce62e9d00810210244p3194a50fj3b6b19209465ac7e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-10-21 12:59   ` Jean Delvare [this message]
     [not found]     ` <20081021145956.4a65467e-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-10-21 16:10       ` Fabien Marteau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081021145956.4a65467e@hyperion.delvare \
    --to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
    --cc=fabien.marteau-QFKgK+z4sOrR7s880joybQ@public.gmane.org \
    --cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox