All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy <singularity_2@yahoo.com>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] i2c device w/o registers
Date: Wed, 08 Jun 2011 22:25:45 +0000	[thread overview]
Message-ID: <71347.44874.qm@web30206.mail.mud.yahoo.com> (raw)
In-Reply-To: <609440.53865.qm@web30206.mail.mud.yahoo.com>

read() and write() worked well.  I just had to set the slave address w/ ioctl()

thanks,

Randy



----- Original Message ----
From: Jean Delvare <khali@linux-fr.org>
To: Randy <singularity_2@yahoo.com>
Cc: lm-sensors@lm-sensors.org
Sent: Mon, June 6, 2011 11:48:12 PM
Subject: Re: [lm-sensors] i2c device w/o registers

Hi Randy,

On Mon, 6 Jun 2011 17:25:10 -0700 (PDT), Randy wrote:
> I have an ADC (MCP3424) that doesn't use registers/commands. 
> 
> To configure the device, you simply write the configuration to the appropriate 

> I2C device address.
> 
> To read the sensor data, you simply issue a read to the device, which will 
> return the ADC sample and the current control register (3 or 4 bytes total, 
> depending on mode).
> 
> All the commands in i2c-tools and the i2c drivers, except for the read/write 
> byte commands, want to take an additional register parameter.  This extra param 
>
> going over the wire messes up the chip.
> 
> Is there any simple way to support devices that don't support registers?  I 
> searched the archive, and found some requests for a i2c_smbus_read_word() 
> command, but that's about it.

This question would have better been asked on the linux-i2c list,
methinks.

Anyway, the I2C commands you need aren't part of the SMBus command
subset, so you have to use raw I2C messaging. The functions you need
are i2c_master_send() and i2c_master_recv() in kernel space. In
user space, you'd simply call read() and write() on the device node. I
don't think there's any example of this in i2c-tools, but the i2c-dev
driver supports it.

-- 
Jean Delvare


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  parent reply	other threads:[~2011-06-08 22:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07  0:25 [lm-sensors] i2c device w/o registers Randy
2011-06-07  6:48 ` Jean Delvare
2011-06-07  8:18 ` Ben Dooks
2011-06-07 18:57 ` Randy
2011-06-07 19:02 ` Guenter Roeck
2011-06-08 22:25 ` Randy [this message]
2011-06-13 21:18 ` Randy
2011-06-16 20:11 ` Randy

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=71347.44874.qm@web30206.mail.mud.yahoo.com \
    --to=singularity_2@yahoo.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.