| Main index | Section 8 | Options |
The options are as follows:
| | |
| 7-bit address on the I2C device to operate on (hex). | |
| | binary mode - when performing a read operation, the data read from the device is output in binary format on stdout. |
| | |
| number of bytes to transfer (decimal). | |
| | transfer direction: r - read, w - write. Data to be written is read from stdin as binary bytes. |
| | |
| I2C bus to use (default is /dev/iic0). | |
| | Interpreted mode |
| | Help |
| | |
| addressing mode, i.e., I2C bus operations performed after the offset for the transfer has been written to the device and before the actual read/write operation. | |
| tr | complete-transfer |
| ss | stop then start |
| rs | repeated start |
| no | none |
| | address(es) to be skipped during bus scan. One or more addresses ([0x]xx) or ranges of addresses ([0x]xx-[0x]xx or [0x]xx..[0x]xx) separated by commas or colons. |
| | offset within the device for data transfer (hex). The default is zero. Use "-w 0" to disable writing of the offset to the slave. |
| | reset the controller. |
| | scan the bus for devices. |
| | be verbose. |
| |
device offset width (in bits).
This is used to determine how to pass
offset
specified with
|
Available commands:
| 'r' bus address [0|8|16|16LE|16BE] offset count | Read command, count bytes are read and hexdumped to stdout. |
| 'w' bus address [0|8|16|16LE|16BE] offset hexstring | Write command, hexstring (white-space is allowed) is written to device. |
| 'p' anything | Print command, the entire line is printed to stdout. (This can be used for synchronization.) |
All numeric fields accept canonical decimal/octal/hex notation.
Without the
With the
Blank lines and lines starting with '#' are ignored.
i2c -s
i2c -s -n 0x56,45-47
i2c -a 0x56 -d r -c 8
i2c -a 0x56 -d w -c 16 -o 0x10 -b < data.bin
i2c -a 0x56 -f /dev/iic1 -d r -c 0x4 -b | i2c -a 0x57 -f /dev/iic0 -d w -c 4 -b
i2c -f /dev/iic1 -r
i2c -i 'r 0 0x50 16BE 24 8'
echo 'r 0 0x50 16BE 48 8' | i2c -i 'r 0 0x50 16BE 24 8' -
Poul-Henning Kamp <Mt phk@FreeBSD.org> added interpreted mode.
| I2C (8) | May 22, 2019 |
| Main index | Section 8 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
| “ | Like a classics radio station whose play list spans decades, Unix simultaneously exhibits its mixed and dated heritage. There's Clash-era graphics interfaces; Beatles-era two-letter command names; and systems programs (for example, ps) whose terse and obscure output was designed for slow teletypes; Bing Crosby-era command editing (# and @ are still the default line editing commands), and Scott Joplin-era core dumps. | ” |
| — The Unix Haters' handbook | ||