<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Vijay,</div><div>Currently, I bypass the 8/16bit checking to try dbus-sensor.</div><div><br></div><div>I just followed your suggestion and only changed the one line.</div><div>But I couldn't find the fru device under the tree of /xyz/openbmc_project/FruDevice/</div><div><br></div><div>There was the below error message in the journal.</div><div><div>Mar 26 08:17:56 henbin fru-device[1111]: failed to format fru for device at bus 6address 50<br></div></div><div><br></div><div>Please let me know if you want to try other.</div><div><br></div><div>BRs.</div><div>Henbin.</div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Vijay Khemka <<a href="mailto:vijaykhemka@fb.com">vijaykhemka@fb.com</a>> 於 2019年3月26日 週二 上午7:05寫道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US">
<div class="gmail-m_-6690780380188087163WordSection1">
<p class="MsoNormal">Hi Henbin,<u></u><u></u></p>
<p class="MsoNormal">I am assuming your device is 16 bit and in your last email you said 16bit check is failing. If that check fails then following code will not get executed. Also while loop is same as i2c_smbus_read_i2c_block_data(). <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I would suggest one thing, if your 16bit check is passing and still you don’t see fru device, please make only one line change below and test.<u></u><u></u></p>
<p class="MsoNormal"> int ret = i2c_smbus_write_byte_data(file, high_addr, low_addr);<u></u><u></u></p>
<p class="MsoNormal"> //int ret = i2c_smbus_write_byte_data(file, 0, low_addr);<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Please let me know result.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Regards<u></u><u></u></p>
<p class="MsoNormal">-Vijay<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12pt;color:black">From: </span></b><span style="font-size:12pt;color:black">Henbin Chang <<a href="mailto:henbinchang@gmail.com" target="_blank">henbinchang@gmail.com</a>><br>
<b>Date: </b>Sunday, March 24, 2019 at 6:39 PM<br>
<b>To: </b>Vijay Khemka <<a href="mailto:vijaykhemka@fb.com" target="_blank">vijaykhemka@fb.com</a>><br>
<b>Cc: </b>James Feist <<a href="mailto:james.feist@linux.intel.com" target="_blank">james.feist@linux.intel.com</a>>, OpenBMC Maillist <<a href="mailto:openbmc@lists.ozlabs.org" target="_blank">openbmc@lists.ozlabs.org</a>><br>
<b>Subject: </b>Re: Some problems about FruDevice in the entity-manager<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Thanks for your response. <u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I also encountered another problem.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">That's, I found the content of 16-bit EEPROM through the combination of the SMBUS APIs was not incorrect.<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"> /* This is for 16 bit addressing EEPROM device. First an offset<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> * needs to be written before read data from a offset<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> */<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> int ret = i2c_smbus_write_byte_data(file, 0, low_addr);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> if (ret < 0)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return ret;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"> return i2c_smbus_read_i2c_block_data(file, high_addr, len, buf);<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">So I referred to i2c-tools to modify them. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">And then I could see my FRU under the tree of 'xyz/openbmc_project/FruDevice/'<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"> int ret = i2c_smbus_write_byte_data(file, high_addr, low_addr);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> //int ret = i2c_smbus_write_byte_data(file, 0, low_addr);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> if (ret < 0)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> {<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return ret;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> while (index < len){<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">buf[index] = i2c_smbus_read_byte(file);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">index++;<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> }<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"> //return i2c_smbus_read_i2c_block_data(file, high_addr, len, buf);<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> return len;<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Let me know if you have any comments.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks.<u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote></div></div></div></div>