linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
To: Hugo Meric <hugo.meric-Qt13gs6zZMY@public.gmane.org>
Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Re : [lm-sensors] HMC6343
Date: Wed, 08 Jul 2009 10:37:11 +0000	[thread overview]
Message-ID: <4A5476D7.7090705@cam.ac.uk> (raw)
In-Reply-To: <874671.80619.qm-KpgP/9vcbyPGRxTy+Q50vsz6deESKz/lQQ4Iyu8u01E@public.gmane.org>

Hugo Meric wrote:
> 
> Thank you for the advice. So today I try and I finally got something
> (using code on the internet:
> http://www.stlinux.com/docs/manual/distribution/distribution_guide6.php#1124364
> ). The code seems right and the only problem is that I don't know how to
> get the data at the end.
> 
> After the call ioctl(file, I2C_RDWR, (unsigned long)&work_queue), the
> datas are in work_queue (I hope so) but I don't know how to get the 6
> values of the HMC6343 sensor.
That's a somewhat odd looking bit of code. I'm not remotely sure what they
are doing with it.

As I've never used this particular ioctl, Jean please correct me if I'm wrong.


For some reason they've configured the messages to have length 0 and no associated
data buffer.

     (work_queue.msgs[idx]).len   = 0;
//this next line is really odd.  Either they were adressing a whole array
//or something no where near standard. This should be fixed at the address
//of the chip you are talking to.
     (work_queue.msgs[idx]).addr  = start_address + idx;
     (work_queue.msgs[idx]).buf   = NULL;


so set len to 6 and the buf to point to a 6 byte character array.
You'll also need to set .flags = I2C_M_RD in the msg
in question in order to ensure a read occurs (rather than
attempting to write the contents of buf.

After the ioctl call, your data should  be character array
that you set the pointer buf to point at.

Note you only want the one message to be sent after the delay
after your command message (for which you can use a simple smbus
write byte command).
Jonathan
 

      parent reply	other threads:[~2009-07-08 10:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <23114.97301.qm@web28307.mail.ukl.yahoo.com>
     [not found] ` <20090707095934.7b86524f@hyperion.delvare>
     [not found]   ` <20090707095934.7b86524f-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-07-07 11:38     ` [lm-sensors] HMC6343 Jonathan Cameron
     [not found]       ` <4A5333C6.3080802-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2009-07-07 11:46         ` Jean Delvare
     [not found]           ` <20090707134638.6ff1b324-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-07-07 11:54             ` Jonathan Cameron
     [not found]               ` <4A53375B.9070304-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2009-07-07 12:20                 ` HMC6343 Jean Delvare
     [not found]               ` <874671.80619.qm@web28313.mail.ukl.yahoo.com>
     [not found]                 ` <874671.80619.qm-KpgP/9vcbyPGRxTy+Q50vsz6deESKz/lQQ4Iyu8u01E@public.gmane.org>
2009-07-08 10:37                   ` Jonathan Cameron [this message]

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=4A5476D7.7090705@cam.ac.uk \
    --to=jic23-kwpb1pkirijaa/9udqfwiw@public.gmane.org \
    --cc=hugo.meric-Qt13gs6zZMY@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@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;
as well as URLs for NNTP newsgroup(s).