回复: about i2cset tool

zhouyuanqing8 at outlook.com zhouyuanqing8 at outlook.com
Wed May 20 11:52:21 AEST 2020


Hi Brandon,

   Sorry, I did not retain the output information of the i2cset command before, I copied the output information from the i2cget command.

   I tried the following command, the register still cannot be written, and there was no error message.This command is to turn on the LED light.

/usr/sbin# i2cset -f 9 0x10 0x82 0xffff w
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will write to device file /dev/i2c-9, chip address 0x10, data address
0x82, data 0x102, mode word.
Continue? [Y/n] Y

    i2cget command works just fine.
/usr/sbin# i2cget 9 0x10 0x02 i 3
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-9, chip address 0x10, data address
0x02, 3 bytes using read I2C block data.
Continue? [Y/n] Y
3: 0x03 0x00 0x00

/usr/sbin# i2cget 9 0x10 0x02 i 3
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-9, chip address 0x10, data address
0x02, 3 bytes using read I2C block data.
Continue? [Y/n] Y
3: 0x03 0xff 0x00

/usr/sbin# i2cget 9 0x10 0x02 i 3
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-9, chip address 0x10, data address
0x02, 3 bytes using read I2C block data.
Continue? [Y/n] y
3: 0x03 0x00 0x00


________________________________
发件人: openbmc <openbmc-bounces+zhouyuanqing8=outlook.com at lists.ozlabs.org> 代表 Brandon Wyman <bjwyman at gmail.com>
发送时间: 2020年5月20日 3:24
收件人: openbmc at lists.ozlabs.org <openbmc at lists.ozlabs.org>
主题: Re: about i2cset tool



On 2020-05-19 02:40, zhouyuanqing8 at outlook.com<mailto:zhouyuanqing8 at outlook.com> wrote:
Hi All

    I use the i2cget to read the device data, but the i2cset did not write the data to the device, and the operation of i2cset did not report any errors.

for example:

:/usr/sbin# i2cget 9 0x10 0x00 i 3
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-9, chip address 0x10, data address
0x00, 3 bytes using read I2C block data.
Continue? [Y/n]
3: 0x02 0x32 0xcc

:/usr/sbin# i2cset 9 0x10 0x82 0x0101 2
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-9, chip address 0x10, data address
0x00, using read word data.

Well, that is a bit odd. It looks like that just did a read, not a write.


Do you need to use the force access option? What is that 2? Should it be a word (w)?

https://linux.die.net/man/8/i2cset

i2cset -f 9 0x10 0x82 0x0101 w

when I check the 0x82 reg,the value is not changed.

Thanks
harley

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20200520/8b50028d/attachment.htm>


More information about the openbmc mailing list