All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Tim Sander <tim@krieglstein.org>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] i2c data address question was Re: [PATCH RFC] i2c-tiny-usb
Date: Wed, 9 Dec 2015 18:04:44 +0100	[thread overview]
Message-ID: <56685F2C.2010202@redhat.com> (raw)
In-Reply-To: <1515037.S0cnTfez5T@hydra>



On 09/12/2015 17:40, Tim Sander wrote:
>> > If there is no slave at the requested address, i2c_start_transfer will
>> > return 1.
> Ok, that works. Now probably the last problem i see is that i fail to set the 
> data-address of the i2c-device?
> I know the correct offset address for accesses on the bus e.g. 
> i2cget -y 0 0x50 2
> where 2 is an example offset for the access to this device. 
> 
> So any hint how setting the data-address on the i2c bus in qemu works?

If you have a data address, you probably want to use functions like
smbus_read_byte that do the right write-read sequence for you:

    if (i2c_start_transfer(bus, addr, 0)) {
        return -1;
    }
    i2c_send(bus, command);
    i2c_start_transfer(bus, addr, 1);
    data = i2c_recv(bus);
    i2c_nack(bus);
    i2c_end_transfer(bus);

Paolo

  reply	other threads:[~2015-12-09 17:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 16:35 [Qemu-devel] [PATCH RFC] i2c-tiny-usb Tim Sander
2015-11-26 18:07 ` Alex Bennée
2015-11-27  8:41   ` Tim Sander
2015-11-27  9:35     ` Markus Armbruster
2015-11-27 11:57     ` Alex Bennée
2015-11-27  6:48 ` Gerd Hoffmann
2015-11-27 10:59   ` Tim Sander
     [not found] ` <56582329.5040304@redhat.com>
2015-11-27 12:39   ` Tim Sander
2015-11-27 12:53     ` Paolo Bonzini
2015-12-09 16:40       ` [Qemu-devel] i2c data address question was " Tim Sander
2015-12-09 17:04         ` Paolo Bonzini [this message]
2015-12-16 15:56         ` [Qemu-devel] [PATCH] i2c-tiny-usb: add new usb to i2c bridge Tim Sander
2015-12-17 16:15           ` Gerd Hoffmann

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=56685F2C.2010202@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tim@krieglstein.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.