<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX Processorsのトピックaccess error i2c device file</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/access-error-i2c-device-file/m-p/910564#M137213</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I&amp;nbsp; get EACCESS error when opening i2c-2 device file when using Android-NDK build and called via JNI&lt;/P&gt;&lt;P&gt;When using i2c tools i don't have this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="color: #000000; background-color: #ffffff; font-size: 9.0pt;"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;int &lt;/SPAN&gt;i2cbus = &lt;SPAN style="color: #0000ff;"&gt;2&lt;/SPAN&gt;;
sprintf(fileName, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"/dev/i2c-&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;%d&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"&lt;/SPAN&gt;, i2cbus);

&lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;((file = open(fileName,&lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;O_RDWR&lt;/SPAN&gt;)) &amp;lt; &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;) {
    &lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;LOGE&lt;/SPAN&gt;(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Error opening %s file=%d error=%d"&lt;/SPAN&gt;, fileName, file, &lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;errno&lt;/SPAN&gt;);
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;(&lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;errno &lt;/SPAN&gt;== &lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;EACCES&lt;/SPAN&gt;) &lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;LOGE&lt;/SPAN&gt;(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Run as root?&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"&lt;/SPAN&gt;);
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return &lt;/SPAN&gt;-&lt;SPAN style="color: #0000ff;"&gt;1&lt;/SPAN&gt;;
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seems&amp;nbsp; i have to change the access rights of the device file. How to do this permanently. When i do chmod 666&amp;nbsp; setting is changed but after reboot it is getting its old value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;Does someone knows how to solve this issue&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;Thanks Jan&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Sep 2019 12:02:50 GMT</pubDate>
    <dc:creator>janmennen</dc:creator>
    <dc:date>2019-09-11T12:02:50Z</dc:date>
    <item>
      <title>access error i2c device file</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/access-error-i2c-device-file/m-p/910564#M137213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I&amp;nbsp; get EACCESS error when opening i2c-2 device file when using Android-NDK build and called via JNI&lt;/P&gt;&lt;P&gt;When using i2c tools i don't have this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="color: #000000; background-color: #ffffff; font-size: 9.0pt;"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;int &lt;/SPAN&gt;i2cbus = &lt;SPAN style="color: #0000ff;"&gt;2&lt;/SPAN&gt;;
sprintf(fileName, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"/dev/i2c-&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;%d&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"&lt;/SPAN&gt;, i2cbus);

&lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;((file = open(fileName,&lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;O_RDWR&lt;/SPAN&gt;)) &amp;lt; &lt;SPAN style="color: #0000ff;"&gt;0&lt;/SPAN&gt;) {
    &lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;LOGE&lt;/SPAN&gt;(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Error opening %s file=%d error=%d"&lt;/SPAN&gt;, fileName, file, &lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;errno&lt;/SPAN&gt;);
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;(&lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;errno &lt;/SPAN&gt;== &lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;EACCES&lt;/SPAN&gt;) &lt;SPAN style="color: #1f542e; font-weight: bold;"&gt;LOGE&lt;/SPAN&gt;(&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"Run as root?&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"&lt;/SPAN&gt;);
    &lt;SPAN style="color: #000080; font-weight: bold;"&gt;return &lt;/SPAN&gt;-&lt;SPAN style="color: #0000ff;"&gt;1&lt;/SPAN&gt;;
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Seems&amp;nbsp; i have to change the access rights of the device file. How to do this permanently. When i do chmod 666&amp;nbsp; setting is changed but after reboot it is getting its old value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;Does someone knows how to solve this issue&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;Thanks Jan&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Sep 2019 12:02:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/access-error-i2c-device-file/m-p/910564#M137213</guid>
      <dc:creator>janmennen</dc:creator>
      <dc:date>2019-09-11T12:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: access error i2c device file</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/access-error-i2c-device-file/m-p/910565#M137214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This may help you &lt;A class="link-titled" href="https://stackoverflow.com/questions/47131267/aosp-device-node-access-permissions" title="https://stackoverflow.com/questions/47131267/aosp-device-node-access-permissions"&gt;android - AOSP device node access permissions - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2019 08:28:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/access-error-i2c-device-file/m-p/910565#M137214</guid>
      <dc:creator>jimmychan</dc:creator>
      <dc:date>2019-09-12T08:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: access error i2c device file</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/access-error-i2c-device-file/m-p/910566#M137215</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Problem is related to security mode&amp;nbsp;avc: denied kernel error&lt;/P&gt;&lt;P&gt;When i enable permissive mode the problem is solved see:&lt;/P&gt;&lt;P&gt;&lt;A href="https://source.android.com/security/selinux"&gt;https://source.android.com/security/selinux&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class="" dir="ltr" style="color: #37474f; background: 0px center;"&gt;androidboot.selinux=permissive&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Sep 2019 13:47:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/access-error-i2c-device-file/m-p/910566#M137215</guid>
      <dc:creator>janmennen</dc:creator>
      <dc:date>2019-09-16T13:47:08Z</dc:date>
    </item>
  </channel>
</rss>

