From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jean Delvare Subject: Re: [lm-sensors] HMC6343 Date: Tue, 7 Jul 2009 13:46:38 +0200 Message-ID: <20090707134638.6ff1b324@hyperion.delvare> References: <23114.97301.qm@web28307.mail.ukl.yahoo.com> <20090707095934.7b86524f@hyperion.delvare> <4A5333C6.3080802@cam.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4A5333C6.3080802-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org> Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Jonathan Cameron Cc: Hugo Meric , linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-i2c@vger.kernel.org On Tue, 07 Jul 2009 11:38:46 +0000, Jonathan Cameron wrote: > Basically it's protocol is a standard smbus type write byte command > (address 0x19) followed by a delay (command specific) and then > a read of multiple bytes (number is command dependant.) > > Unfortunately the device doesn't seem do anything helpful like notify > you of how many bytes it is sending (as per smbus block read). > > I fear to make this work you'll need to write a kernel space driver. > The first step is a conventional smbus send byte command. Follow this > with a suitable delay. The second will need to make use of > i2c_transfer with a msg looking something like > > char bob[6]; > struct i2c_msg read_msg = { > .addr = 0x19, > .flags = I2C_M_RD, > .len = 6, // as appropriate to the command > .buf = bob, > }; > > then i2c_transfer(adap, &read_msg, 1); > > should do the job. Note: this could be done from userspace too if needed. The i2c-dev interface supports raw reads and writes. -- Jean Delvare