| 1 | .TH I2C-STUB-FROM-DUMP 8 "March 2010" |
|---|
| 2 | .SH NAME |
|---|
| 3 | i2c-stub-from-dump \- feed i2c-stub with dump files |
|---|
| 4 | |
|---|
| 5 | .SH SYNOPSIS |
|---|
| 6 | .B i2c-stub-from-dump |
|---|
| 7 | .IR address [, address ,...] |
|---|
| 8 | .IR dump-file " [" dump-file " ...]" |
|---|
| 9 | |
|---|
| 10 | .SH DESCRIPTION |
|---|
| 11 | i2c-stub-from-dump is a small helper script for the i2c-stub kernel driver. |
|---|
| 12 | It lets you setup one or more fake I2C chips on the i2c-stub bus based on |
|---|
| 13 | dumps of the chips you want to emulate. |
|---|
| 14 | |
|---|
| 15 | i2c-stub-from-dump requires i2cdetect and i2cset to be installed and |
|---|
| 16 | reachable through the user's PATH. The former is used to find out the i2c-stub |
|---|
| 17 | bus number, while the latter is used to write to the fake I2C chips. |
|---|
| 18 | |
|---|
| 19 | .SH EXAMPLE |
|---|
| 20 | You have an I2C chip on system A. You would like to do some development on its |
|---|
| 21 | driver on system B. Here are the few steps you have to follow. |
|---|
| 22 | |
|---|
| 23 | On system A, use i2cdump to capture a dump from the chip. Assuming that the |
|---|
| 24 | chip in question lives at address 0x4c on I2C bus 0, you would run: |
|---|
| 25 | |
|---|
| 26 | i2cdump -y 0 0x4c b > chip.dump |
|---|
| 27 | |
|---|
| 28 | Adjust the bus number and chip address for your case. i2cdetect can help |
|---|
| 29 | you find out their values. If the device uses word (16-bit) register |
|---|
| 30 | access instead of the traditional byte (8-bit) access, use mode \fBw\fR |
|---|
| 31 | instead of \fBb\fR. |
|---|
| 32 | |
|---|
| 33 | Copy the dump file to system B. |
|---|
| 34 | |
|---|
| 35 | On system B, run: |
|---|
| 36 | |
|---|
| 37 | i2c-stub-from-dump 0x4c chip.dump |
|---|
| 38 | |
|---|
| 39 | This will load the required i2c-dev and i2c-stub kernel drivers if needed, |
|---|
| 40 | then write all the register values to the emulated I2C chip at address 0x4c. |
|---|
| 41 | Again, adjust the address as needed. |
|---|
| 42 | |
|---|
| 43 | .SH LIMITATIONS |
|---|
| 44 | There are some limitations to the kind of devices that can be handled: |
|---|
| 45 | .IP \(bu |
|---|
| 46 | Device must not have banks (as most Winbond devices do). |
|---|
| 47 | |
|---|
| 48 | .SH SEE ALSO |
|---|
| 49 | i2cdump(8), i2cdetect(8), i2cset(8) |
|---|
| 50 | |
|---|
| 51 | .SH AUTHOR |
|---|
| 52 | Jean Delvare |
|---|