From: Jean Delvare <khali@linux-fr.org>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] What to use as prefix for TI TMP401 IC,
Date: Sun, 28 Oct 2007 20:09:37 +0000 [thread overview]
Message-ID: <20071028210937.4725b928@hyperion.delvare> (raw)
In-Reply-To: <4722FB3C.9010402@hhs.nl>
Hi Hans,
On Sun, 28 Oct 2007 15:24:06 +0100, Hans de Goede wrote:
> Jean Delvare wrote:
> > Also, I suggest that you add detection for the TMP401 to sensors-detect
> > right away. That's the best way to find early testers for your work.
>
> Done. (not tested I don't have access to the actual hardware at this moment).
In this kind of situation, I can only recommend using Mark Hoffman's
i2c-stub driver. It allows emulating one or more I2C/SMBus chips from
dumps. It works as follows:
* On the machine with the chip, use i2cdump to dump the registers of
the chip:
i2cdump -y 0 0x4c b > tmp401.dump
* On your own workstation, build the i2c-stub driver
(CONFIG_I2C_STUB=m) and load it. You must pass the chip address as a
parameter, so that the driver will emulate a chip at this specific
address:
modprobe i2c-stub chip_addr=0x4c
* Program the emulated chip from the dump. Get my helper script from:
http://jdelvare.pck.nerim.net/sensors/stub-from-dump.pl
Run that script on the dump and it will generate a shell script to
program the emulated chip:
./stub-from-dump.pl tmp401.dump > set_tmp401.sh
Then as root, run the script in question:
sh set_tmp401.sh 6 0x4c
Adjust the bus number so that it matches those of i2c-stub, check with
i2cdetect -l. The script simply runs i2cset for each register.
At this point you have an emulated chip to play with. It will let you
test sensors-detect, device detection at driver load, the sysfs
interface, etc.
Limitations:
* Driver must only use byte register access. i2c-stub supports word
access by my script doesn't (yet).
* Device must not have banks (as Winbond devices do).
* You can't test alarms this way, obviously.
Beware that i2c-stub is very verbose and will flood your logs. This
might help a lot when debugging the driver though.
If this proves useful, I should probably cleanup stub-from-dump.pl and
include it in i2c-tools so that others can benefit.
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2007-10-28 20:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-27 8:47 [lm-sensors] What to use as prefix for TI TMP401 IC, Hans de Goede
2007-10-28 12:43 ` Jean Delvare
2007-10-28 12:55 ` Hans de Goede
2007-10-28 14:24 ` Hans de Goede
2007-10-28 19:20 ` Jean Delvare
2007-10-28 20:09 ` Jean Delvare [this message]
2007-11-01 19:30 ` Jean Delvare
2007-11-01 21:58 ` Hans de Goede
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=20071028210937.4725b928@hyperion.delvare \
--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.