All of lore.kernel.org
 help / color / mirror / Atom feed
From: khali@linux-fr.org (Jean Delvare)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] read()ing an i2c node results in errno=ENOSYS
Date: Sun, 18 Sep 2005 09:22:16 +0000	[thread overview]
Message-ID: <20050918092253.1b199195.khali@linux-fr.org> (raw)
In-Reply-To: <b4e191e7050915035768c521ef@mail.gmail.com>

Hi David,

> We've now implemented simple SMBus on our microcontrollers, and it is
> mostly working. block writes work perfectly, but we are having a small
> problem with block reads on the PC side. It seems from the register
> dumps in the kernel logs that the first byte is going to the DAT0
> register instead of into the BLK, so in userspace, it appears like the
> first byte is lost. (DAT1 remains 00, though). As far as we can tell,
> the data on the bus is correct, but our oscilloscope is nice and old,
> making it impossible to see the whole transaction.

There are two kinds of block reads defined in the SMBus specification,
regular Block Read and I2C Block Read. In the former, the first byte
received is an information of how many bytes follow. This first byte
typically goes in DAT0 rather than the BLK buffer. In the latter, data
is send directly and all bytes are stored in BLK. I guess that you
currently use the former when what you need is actually the latter.

Note that a client chip can only support one of the two kinds of block
reads at any register address ("command byte" in the SMBus
specification), as there is no way to distinguish between both commands
from the client's point of view. It's up to the master (PC) to use the
correct one depending on what the client implements.

> The EPERMs reappeared as we were working, but disappeared when we
> started doing things correctly on the bus. They were probably actually
> a Good Thing, better than getting garbage or something more fatal, so
> I don't think you should worry about it.

OK, thanks for lettng me know.

-- 
Jean Delvare

  parent reply	other threads:[~2005-09-18  9:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-15 12:58 [lm-sensors] read()ing an i2c node results in errno=ENOSYS David Sharp
2005-09-16 20:56 ` Jean Delvare
2005-09-17 10:42 ` David Sharp
2005-09-18  4:25 ` David Sharp
2005-09-18  9:22 ` Jean Delvare [this message]
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=20050918092253.1b199195.khali@linux-fr.org \
    --to=khali@linux-fr.org \
    --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.