<div dir="ltr"><div dir="ltr" class="gmail_attr">On Sat, Apr 1, 2023 at 9:57 PM Bo Berglund via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Question:<br>
Can I use Linux file system commands to read/write the data on the i2c EEPROM<br>
memory device and if so how from fpc?<br></blockquote><div> </div><div>To some extent it is possible to handle i2c transactions as file read/write operations, but some ioctl calls are required to configure e.g. the device address [1]. Take note that only a subset of i2c functionality is available using read/write calls. Lazi2cdev [2] uses this approach.<br></div><div><br></div><div>For finer control over the i2c transactions (for example combined write/read transactions) low level ioctl calls are available in Linux.  I wrote an i2c class  [3] using this approach.<br></div><div><br></div><div>1. <a href="https://www.kernel.org/doc/html/latest/i2c/dev-interface.html">https://www.kernel.org/doc/html/latest/i2c/dev-interface.html</a></div><div>2. <a href="https://github.com/laz2wiringpi/lazI2cdev/blob/master/i2cdev_base.pas">https://github.com/laz2wiringpi/lazI2cdev/blob/master/i2cdev_base.pas</a></div><div>2. <a href="https://github.com/ccrause/rpiplc_pas/blob/main/native/i2c.pas">https://github.com/ccrause/rpiplc_pas/blob/main/native/i2c.pas</a></div></div></div>