All of lore.kernel.org
 help / color / mirror / Atom feed
From: whereami@gmail.com (David Sharp)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] read()ing an i2c node results in errno=ENOSYS
Date: Thu, 15 Sep 2005 12:58:18 +0000	[thread overview]
Message-ID: <b4e191e7050915035768c521ef@mail.gmail.com> (raw)

we're working on a robotics project, and are tryng using an i2c bus to
communicate between our microcontrollers and our mini-itx pc
(via-embedded Epia ML).

the kernel is rather patched to support the hardware, but i think the
important bits are untouched (I didn't do the kernel patching myself).
It is fairly a recent kernel, i'm pretty sure 2.6.11 (i'd check, but
the box is not in front of me atm).

We have been trying to write some preliminary testing code to
communicate over the i2c bus. some of the original testing code used
i2c-dev.h from the lm_sensors project to use the SMBus functions.
These seem to work correctly. However, we don't want to use SMBus, as
it is more difficult to implement in the microcontrollers. Instead, we
would like to use plain i2c.

From my reading of Documentation/i2c/dev-inteface and some of the
kernel source, we should be able to open(), then use ioctl() to set
the slave address, and finally use read() and write() to make i2c
reads and writes.

although the dev-interface file seems to be outdated (the i2c_smbus_*
"macro's" it refers to are no longer in the kernel headers, and are
now only in the lm_sensors' i2c-dev.h), my amateur reading of the
kernel source supports that this should work. However, a read call
results in errno=ENOSYS (Function not implemented), although on one
run, i actually got EPERM, and another time resulted in SEGV.

I'm sure we've done something wrong, but I can't figure out what it
is, and the ENOSYS mystifies me. I'm fairly sure all necessary kernel
modules are loaded (i2c-core, i2c-dev, i2c-viapro, some others...)
since i2cdetect works, as well as the test using
i2c_smbus_write_block_data().

Thanks,
David Sharp
CalPoly Robotics Club

             reply	other threads:[~2005-09-15 12:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-15 12:58 David Sharp [this message]
2005-09-16 20:56 ` [lm-sensors] read()ing an i2c node results in errno=ENOSYS Jean Delvare
2005-09-17 10:42 ` David Sharp
2005-09-18  4:25 ` David Sharp
2005-09-18  9:22 ` Jean Delvare
2005-09-18 23:34 ` Mark M. Hoffman

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=b4e191e7050915035768c521ef@mail.gmail.com \
    --to=whereami@gmail.com \
    --cc=lm-sensors@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.